Friday, June 7, 2013

Added an OPDS library book server to my media server.

I had no real concept about what software was available to share a library onto a network.  I knew that it was possible because I saw the option in fbreader.  Fbreader is some great software that I have been using for years.  

I did a google search and stumbled across this site by luck:  http://blog.slucas.fr/en/oss/calibre-opds-php-server

What this person did was to use a database and directory created in Calibre as the basis of his library, and then write software to put that library onto the network using the OPDS protocol so that it was accessible to any compatible book reader.    His philosophy is that Calibre is a great product, but way too large a foot print and too many dependencies to use for an embedded file sharing system, like I built last weekend.
 
Getting the service running was a breeze. I just followed the 5 step directions on the site where I downloaded the web app. The only snag I hit was having a space in the directory name of the path to the book folder. Once I got rid of the space it just worked. The error page I got was very clear and pointed me right at the problem.


I pointed fbreader on my pad computer at the library by clicking back, open network library, add catalog and putting in the path to where the software lives on my web server.   

This web service works amazingly well. I am using fbreader on my pad computer and am able to browse the directory of books about 100 times faster than browsing the same directories on a local sd card on the pad computer itself.   The memory consumption and required processing power to share the library is minimal as well.

Great job Sebastien Lucas!  He is the author of this great web service.

Now I just need to load everything I own into that Calibre library and I will be set.

This is the view of the web service running in a web browser.


--

I ran into one issue with minidlna needing too much memory if I had it include my image and music folders.  I only have 256MB of RAM on the server, but plan on buying a 1GB memory card next week when I make a trip to the big city. This should allow me to index and share my music and images using minidlna.

Every American with a phone is being monitored by the NSA.

This blog is not just about technology, it is also a blog about freedom and rights. Because if you are not free then you are not free to use technology in the ways you want.  In a totalitarian regime it is illegal to communicate freely, so you can't share cool hacks with each other.  It becomes illegal to use encryption, or to program micro-controllers, except under the watchful eye of a political officer.

We are finally finding out just how far down the rabbit hole we have fallen. Last month we found out how many reporters were being electronically surveilled. https://pressfreedomfoundation.org/blog/2013/05/virtually-everything-government-did-wikileaks-now-being-done-mainstream-us-reporters  This month we get to find out exactly how many American Citizens are being monitored daily, and it appears that anyone with a phone is being tracked.  The EFF organization has a great write up regarding this entire issue which arrived in my inbox tonight.  The subject line begins  with two words.  "Stunned. Angry."

https://supporters.eff.org/civicrm/mailing/view?reset=1&id=427

This is not a Republican issue, or a Democrat issue, since the same thing has now happened under two different administrations, one of each party. This is an American issue that we should all care about.

I doubt very much that the Feds would just make Verizon hand over all their records everyday, so this must be happening with every telecom company in America. It appears that every phone call in the USA; local, state, interstate, and international, is being illegally tracked without a warrant. How many of those calls are also being listened to, authorized by a judge that will rubber stamp literally anything that crosses his desk, is anyone's guess. 

If they track who you are calling then they have a list of your friends, family, and business associates. For what purpose they need lists like this I have no idea, but the purposes that such lists have been used historically is sickening.

Thursday, June 6, 2013

Low cost electric boosted covered seated bike.

Gas prices getting you down?  

I am working on an electric boosted, covered, one person seated bike.  Basically take a tandem frame style bike with a shell and add an electric motor.  Cover the bike for aerodynamics, safety, and to allow the bike to run in bad weather.

Design specification

Take one person, a book bag, and a couple of bags of groceries from home, to school, and then back home again.  Keep the person driving the bike from getting too hot or too cold, keep them dry, and be safe.  A 10 mile trip should take about a half an hour.

Aerodynamic

It is important that a design like this needs to be aerodynamic so that it will slip through the air with as little effort as possible, this allows you to use much smaller batteries and motors to maintain the speed you want. Design will have to incorporate a light weight carbon fiber shell that covers every part of the vehicle.  This shell would have to be very light weight, mostly just a single layer of carbon fiber, but with reinforcements in critical areas, and large enough windows to allow the person in the bike a clear field of view.

Insulated

About a half an inch inside the shell I would like to have a layer of silver bubble paper to reflect summer heat away from the person in the seat.  This stuff is very light weight and is great at reflecting heat.

Ventilation

There will have to be air vents that allow external air to flow through the compartment on hot days, these vents would have to be adjustable so that on colder days you can close the vents to keep the compartment warm.  The compartment has to be sealed tight enough so that the shell reinforces the frame, but enough air has to come in to keep the driver from suffocating.

Power

A small electric motor and small battery pack will supplement pedal power, not replace it.  Shouldn't even require a license plate, electric bikes that can only go 20mph don't need to be licensed.  You state laws will vary.  As you accelerate or go uphill the motor will boost the person pedalling to make it easier.  When you decelerate or go down hill the motor will brake the bike and recharge the battery.

If possible put a thin solar panel on top of the bike to recharge the battery as long as the sun is shining.  We will also be able to hook a small fan to force air through the cockpit to keep the person cool, and power that fan directly from the solar panel. The more intense the sun shine, the harder the fan will blow. 

No heater

A lightweight design with thin tires would just not be safe in the winter anyway.

Frame

The frame would have to also be a light weight welded aluminium with a heavy duty light weight floor that can handle a lot of abuse. Maybe put a thin wooden panel over the aluminium frame using construction adhesive, and then vacuum seal a carbon fiber layer on both sides of the frame, sandwiching the floor panel and frame inside a carbon fiber and epoxy shell. 

Phone Dock

Use power from the battery to recharge the phone and run a low power amp running a couple of speakers so you can listen to music or audio-blog as you ride around.  

Security

Because this bike is light enough to carry away then there has to be an external strong point to lock it to the end of a bike rack.  The compartment should also lock at a strong point.

Started programming the Google Reader Replacement.

I wrote about why I am working on this project

There is going to be a server side and a web client side of things.

On the server side I need to:

  1. Query the database for the next feed to read and when.
  2. Schedule the read.
  3. Read the feed.
  4. Store the feed so that there are no duplicates.  (what to do with updated records?)
  5. Update the record to show when the feed was read.
  6. Repeat.

On the web client side I need to:

  • Create a login system to keep people's feeds separate. 
  • Create a form that allows people to manage (add, remove, and organize) what feeds they are subscribed to.
  • Create a form that allows people to view their feeds. (I'll add marking records as read later.)

One of the beautiful things about this system is that if there are a million people all subscribed to the same feed then you only have to download that feed once and store it once.  The server side will scale pretty easily.

The client side is a different story.  With each person having a different set of unread records, the more users, the more power is going to be needed to track everything.

Today, on the server side I am looking at the basics of doing the server side actions:

Using libcurl to read an rss file. 

Example code here: http://curl.haxx.se/libcurl/c/simple.html
More examples here: http://curl.haxx.se/libcurl/c/example.html

Using libxml2 to parse the xml in the rss file.

The web site is here: http://www.xmlsoft.org/
Example code is here: http://www.xmlsoft.org/examples/index.html

Store the records in mysql.

Example code is here:  http://zetcode.com/db/mysqlc/


Sunday, June 2, 2013

Building a Media Center to work with Raspbmc hooked to TV.

Now that I have a proper media center using UPnP to play videos from a laptop computer, I want to free up that laptop again and create a much more robust solution that uses much less power and is dedicated to just sharing files on my network.

My hardware I choose to use is a now ancient Mini-ITX board by Via, called the EPIA-M.  I had bought this board 8 or 9 years ago, added a 12v powered DC-DC power block, and then threw it in a box and ignored it for all these years.  It only draws 10 watts, and has no fan or moving parts to wear out.   It has 256MB or RAM, but I am going to expand this out to 1GB.

I ran into one hold up, the built in networking had been turned off which made me pass on FreeNAS without giving it a shot at first, but when I began to install Debian, it also could not see the built in networking on the motherboard, so I knew it was a problem and was able to reboot again, change the setting and try out FreeNAS.

FreeNAS

I gave this a shot.  I had known of the system for many years and was interested in checking it out.

Pros:
  • Very powerful.
  • Can do just about anything and is extendable using plugins.
  • Looks like once it is set up it would work for even large divisions.
  • Beautiful web interface gives you access to everything.
Cons:
  • Very complicated and has a steep learning curve
  • Even something as simple as installing plugins is not pre-setup for the user.
  • Takes a higher end system with a lot of RAM

If FreeNAS wants me as a user they need to make a version that is meant to be used on low end devices with just a little RAM.  I am a home user that just wants to serve files that are on external usb hard drives, things should just work and transmission and dnla should be built-in.

When I plug in a drive things should "just work".  The drive should be shared to the network as a windows file share and the media file tree it contains should be indexed and shared using UPnP.  Plus, the system kept crashing because evidently I need a base 6GB of RAM, plus 1 GB of RAM for each TB I wanted to serve.   I couldn't install the plug-in jail system properly and after I messed it up I couldn't modify the settings anymore.

OpenFiler

Failed to load, needed a newer motherboard than I had.

Debian

That's right, I fell back to Debian 7.0 and I got it all working in just a few hours.  Even though in some ways this is harder than just learning FreeNAS, because I already am comfortable using Debian and UNIX in general on the command line this was easy for me to get everything installed and working. 

I had to do a base install, then modify the apt-repository list to stop looking at the usb drive for packages, and added in the main Debian repository, then apt-get a bunch of packages to give me samba, minidlna, and other services I wanted to run on the box.  I just googled for help with each part in turn.  These are all just normal Debian things, and you can find a lot of info on every step.

One thing that I had always wondered how to do was to mount disks by label.

http://debian-resources.org/node/9/

And how to assign the label to a DOS disk in Debian?  Mtools!

http://www.linuxquestions.org/questions/linux-general-1/how-to-change-volume-label-of-the-usb-drives-594875/

Work left to do?  Add all the USB drives so they auto mount to the right place.  Configure Samba to share all the directories read/write.

I went with mounting the drives by UUID, here is the relevant section I added to the end of /etc/fstab:

UUID=58212b6a-dc48-45e7-8e9f-1f360d765985 /media/SciFi  auto rw,user,auto 0 2
UUID=beb927ca-4da4-4fc9-b222-be343c4fec38 /media/Text   auto rw,user,auto 0 2
UUID=c7980548-7182-404b-b32d-02c5accd8963 /media/3D     auto rw,user,auto 0 0
UUID=f25eaad0-5896-499c-b476-f57ed12bd49c /media/Comedy auto rw,user,auto 0 2
At boot up this mounts 4 usb drives that are configured with either ext3 or ext4 to the same place each time.

I shared my media directory, where all the drives are mounted with the following section in /etc/samba/smb.conf :

[media] ; user="root"
   force user = root
   comment = Media Directory
   read only = no
   locking = no
   path = /media
   guest ok = yes
   public = yes
This gives full read/write access to all the drives I mounted under the media directory.  I know, I know, "oh you gave root access to these directories" but I am the only one that has access to these folders on my local network and the machine never executes anything from these folders, so no problem.

UPnP Remote Control

I found an application called BubbleUPnP that runs on my android Pad over Wifi and sits between what they call a library and a renderer.    You can even play things locally.  But the amazing thing happens when I selected the new NAS I just built as the librar and Raspbmc as the renderer, and a second later my TV was playing what I had told it to play on my pad computer. As the media plays you have full control of the player, able to pause, fast forward, change the volume and you can read the title and see where you are in the media timewise. All in all a truly amazing thing.  I did have to check a single box on the XBMC settings to advertise my Raspi as a rendering device. So now I can almost get by without having a direct link to XBMC at all.

I noticed another app that can do everything my wireless keyboard/mouse can do, which is also interesting, will have to give that a try.

3D Printed Case

Right now I am trying to find a case I can print that will fit the mini-ITX motherboard with a nice big 120mm fan for cooling of the mother board and the usb drives I plan to place on top of the case.  If I can't find one I will work on designing one that will work for me.  The board is about 17×17 cm (or 6.7×6.7 inches) wide and deep and about 3 inches tall.   Unfortunately the build place on my Replicator 2 is just 6.3 inches deep, so I am short .4 inches.  Will have to figure out how to make something work.

Physical Setup

Current setup on bookshelf until I can get it in a case.




I had to buy an extension cord and a set of orange extenders to allow me to plug in the 6 power bricks.  This is all plugged into a backup power supply.   Then I wired up the power and the usb connections to a 7 port powered hub that I was using on the laptop machine.    The beauty of this is that I can easily shut this system down and test a Raspi model A computer I am working on to act as a NAS and file sharer as well.  I am not sure how good the power supply is going to be for the mini-itx board.