Fincher's Follies

Yeah… just let someone else host it

Building my own media server

First, I’m going to go ahead an apologize for the sheer text in this post. I was so focused on getting everything together that I didn’t really take any build pics so this will be mostly text. ¬†Sorry about that! Continue at your own risk ūüėČ


I have a growing media collection on my home computer and I have been looking at better ways to disseminate it to other devices in my home. Since I have a PS3 and my DVR can access DLNA servers, I spent a little time trying to get a server running on my old mac mini using TVMOBiLi.  It seemed to work ok for a bit (though the way files were organized was sub-par), but then I started having issues.  They likely stemmed from my mac mini dying, but I had reservations about TVMOBiLi anyhow since the free version actually had a data cap for streaming.

Since I don’t usually need to watch movies immediately, I just set up a script to generate a web page of links to movie files then accessed the webpage through the PS3 browser. ¬†Then I would just download the file beforehand, watch it locally on the PS3, then delete the file. ¬†While it only took 20-30 minutes to download a ~2 hour movie, the playback if I tried to watch while downloading was abysmal. So that was pretty much the way things worked for a while.¬†Then my iMac started filling up! ¬†I figured it was just about time to set up a separate media server, preferably DLNA-compatible so that I could more easily stream to our TVs.

The Build

I started with the small but more costly from this guide on Lifehacker. I really wanted a small form factor box, but wanted to put at least 2 drives in it so I could have a primary and a backup since I’d be moving a lot of the media off my iMac, and it is never good to have anything you want to keep stored in only one place. So the basic breakdown of what I got was as follows:

  • ARK ITX/CS-CI03 Black Mini ITX Server Chassis
  • ASRock A75M-ITX FM1 AMD A75 Motherboard
  • AMD A4-3400 Liano 2.7GHz Dual Core Processor
  • 4 GB DDR3 RAM
  • 2 Western Digital Caviar Green WD20EARX 2TB hard drives

It had been a while since I built a computer myself (probably since the one I built while I was at Auburn in 2003), but I managed to get everything packed in to the tiny little case and it booted up on the first try! If I had really been thinking about it, I would have taken build pics, but I was too focused on trying not to break anything, :-). Now the truly tricky part was finding a software configuration that was (hopefully) free, yet gave me all the functionality that I want.

4 Hot-swappable drive bays are handy

One might call me a cable management guru

The Setup

I had previously read about several programs that ran on linux so I figured I would start out with a basic linux installation and go from there. ¬†Since I don’t have an optical drive, I had to install via usb flash drive. I thought this would be pretty simple, but it didn’t go as smoothly as I had hoped. I downloaded the Ubuntu Server iso and tried to load it following this guide. I never got the result of that to boot, so I looked around some more and switched to using UNetbootin to make it and had much better luck. ¬†I got Ubuntu server installed, then was playing around with it some and decided I’d rather have a little more than a command line while I was first getting things set up so I switched to the standard Ubuntu install.

The first program that I had read about was PS3MediaServer. I actually got it up and running fairly easily. I copied a few movie files over then tested it out through the PS3. At first, I thought the files weren’t appearing, but further inspection turned them up a few directories below where I thought they’d be. A lot of the videos I have are .m4v files, which are playable on the PS3 and shouldn’t cause any issues. ¬†For some reason, PS3MediaServer had them in a subdirectory labeled “transcode” as though it was having to convert them on the fly. That, plus the fact that the basic organization was pretty crappy (lots of different folders and subfolders to look through to access any of the movies) spurned me to evaluate some other options.

The next thing I looked at was GeexBox. Instead of just a program that you run, GeexBox is a full mini-OS to run. I obviously didn’t read all the documentation because I tried for a while (to no avail) to install the OS over my Ubuntu install when, it turns out, GeexBox is meant to be run from the usb drive. They are working on the ability to actually install it like a typical linux distribution, but that is only in the development build (though I couldn’t get it to actually install). Since that was coming, I decided to try it out as it is currently meant to run and it was ok. It looked like running XBMC on linux and the organization was ok from what I could tell, but ultimately I wanted a little more freedom and definitely didn’t want to have to keep a usb drive plugged in all the time. If I had been setting this box up to be directly connected to the TV, I think I would have given GeexBox a little more testing, but for the goal I had in mind it didn’t quite handle my needs.

Thus I decided to revert back to Ubuntu to try more application-based options. The next one that I tried was MiniDLNA. This sounded appealing because it is a pretty bare-bones DLNA compliant server so it seemed like organization would be up to me and, therefore, I would have more freedom to set things up like I wanted. Unfortunately, I could never get it to share the actual media. I changed the config file, shutdown and restarted the server, shut down and restarted the computer, and it would still just display basic “Music,Video, Photos” folders (that were empty) when the config only had one directory where my movies were stored. As you have probably guessed, I wasn’t in the mood for posting in forums and waiting for an answer. I DID look in forums and documentation for issues I had with each server, but none were helpful and I wanted something that came much closer to working right off the bat.

The next option turned out to be the one I am sticking with for the time being, Serviio. It is free, though you start with a 15 day trial of the $25 Pro version, after which you just revert back to the free version. From looking over the list of features, I believe that the free version will suit all my needs (though the MediaBrowser web-based player and API for access over the internet could come in handy). It started up without fuss and had a nice GUI console to modify settings and such. It actually listened when I added folders to be included and seemed to keep things fairly organized.  One of my favorite features of Serviio was that it queries a database for metadata based on the name of the file. This is handy because it means that I can browse content by information that I would never take the time to input (year released, director, etc.).

I’ve encountered a couple of glitches, but for the most part my test files were found without much incident. The first glitch was with the movie X-Men. ¬†Now if you have a file named X-MEN.m4v, you would think the logical match would be for the movie X-Men, but the database kept identifying it as X-Men:First Class. I tried multiple variations and the only thing that worked was to rename it to X-MEN(2000).m4v so it would use the release date. Some of the misnamings are super random. For example, I had a file name PATCH_ADAMS.m4v and when Serviio tried to automatically determine what movie it was, it chose 101 Dalmations II- Patch’s London Adventure. ¬†That’s not even close! The other glitch was with season 1 of Star Trek: The Next Generation (as if this post didn’t sound geeky enough). I ¬†tried numerous different naming schemes, but was never able to find one that enables it to find the appropriate entry in the database at first.

I decided to go ahead and transfer all my regular movies over and, unfortunately, it did a pretty abysmal job in automatically finding the metadata. ¬†One thing that really irks me is that underscores seem to trip it up and it likes spaces instead. SPACES!? I am on a linux box, not some stupid windows POS. I don’t put damn spaces or parentheses in my file names. ¬†If I have to escape characters to reference a file, THAT FILE IS NAMED INCORRECTLY! How annoying. I found a file renamer called FileBot that queries the online databases then provides options. It has it’s own issues, but it let me get a lot of my files in a different naming state which seemed to help Serviio get a lot more of them correct. It also seemed to fix the issue I was having with Star Trek TNG, so that’s pretty awesome. Luckily, I found a forum post where a user manually updated the derby database storing the file information for the files. I haven’t tried it yet, but I’m hoping that allows me to correct all the errors in movie identification that I have left. ¬†It got enough of them done that I think I’m just going to gradually repair everything and be more cognizant of my naming scheme for future movies.

Other than the movie misidentifications, the only other thing I have found with Serviio that I don’t like is that my Moxi doesn’t seem to be able to view it. I am not sure why, and it doesn’t really matter since the PS3 and Moxi are connected to the same TV. I just found it odd because I thought the Moxi looked for DLNA servers, but perhaps TVMOBiLi that I used initially actually offers more protocols and that is why it was accessible. I have enough going on that I don’t really care to try to find out. If I make any significant changes to my setup, I will put together another post about it. ūüôā

Final Tweaks

After I got the server in a (mostly) working state, there were a few things I wanted to go to make its use run a little more smoothly. The first couple were the obvious things like set up Serviio to run upon boot and set up my iMac so it can communicate back and forth with the media server without a password (useful since the iMac will still be my primary ripping computer and I can set them up to automatically sync). Then I found this guide to using avahi to allow me to use an actual name for the media server. I may end up setting it up for more general file hosting and it will be nice to not have to deal with ip addresses for access from various devices.

While I will probably do most administrative stuff through ssh, I went ahead and set up a VNC server so I could pull up a remote desktop if I felt like it. Pretty simple to set up. I also set up a new directory for DVD rips and set up a cron job on the media-server to check that directory daily and grab any new files. For now I will just deal with clearing them out on my own once I’m sure everything else is working well.

One tweak that I thought would be minor but turned out to be a pain the ass was getting the media server to shut down when I shut down my iMac. ¬†Whenever I am out of town, I always power down my computer and, especially since I’ll be running the server headless, I wanted to save me the step of trying to remember to shut it down before I shut down my iMac. I knew that I could send the shutdown command remotely from my iMac, so I figured it should be pretty simple to call a script on shutdown/logout. ¬†Turns out that isn’t simple at all. I tried using rc.local.shutdown/rc.shutdown.local, adding a service to StartupItems, and played around with launchd. None of these would call the script upon shutting down. ¬†After wrestling with it for a bit, I decided to approach it from the other side and actually got it running fairly quickly. While the ip can change because it uses DHCP, the name of my iMac (its .local address) seems to stay pretty consistent. So I set up a cronjob that calls a simple script that I wrote. The script simply pings my iMac and if the ping fails I assume the iMac is off so it shuts down the computer. ¬†Hopefully my internal network is consistent enough that this won’t be an issue, especially since it just checks once an hour, but my initial testing shows that it is working fine.

At home in the cubby

To Do List

  1. Clean up the metadata so all the videos are displayed with the proper information
  2. Transfer and organize the other videos I have on my computer
  3. Set up media server to back up all files onto 2nd drive
  4. Figure out why the fans on the case seem to be running constantly even though it isn’t overheated
  5. See if I can have the iMac automatically boot the media server on startup (i.e. when I get back from out of town I only have to start the iMac)
  6. Work on organizing and ripping more of the TV seasons that I have
  7. Set up basic webserver so that any device on the network can at least access/download files

Setting up my Pertelian LCD on my linux box showing recent tweets

If you didn’t pick up on it from the title, this is going to be a pretty geeky post ūüôā I had a little time over Christmas break to finally play around with setting up my Pertelian X2040 LCD screen that Julie gave me LAST Christmas! How slow am I? ¬†I ran into a couple snags and had to code up some things for it to display as I would like so I figured I would post it in case any fellow geeks started looking to do something similar.

First, I had to get my screen talking to my linux box at work.  While it seems like a geeky little gift, Pertelian only lists it as being compatible with Windows (LAME!!) so I had to go looking around for an alternative means of connecting.  I came across lcd4linux that listed my screen as one they were working on supporting. I had to use the pre-release build for version 0.11 because the upcoming release is the first one to include the Pertelian drivers.  Getting it basically up and running was fairly simple (just a few edits to the included lcd4linux.config file to add my display.


Display pert-lcd {
   Driver 'Pertelian'
   Port '/dev/ttyUSB0'
   Size '20x4'
   Backlight 1
   Icons 1


Anyhow, I got it so I could do some basic display things through the program so it was on to configure it for my exact application, displaying recent tweets! ¬†I don’t check Twitter that often, so I thought it would be cool if I could set up my little screen to constantly display recent tweets. ¬†Twitter no longer provides an RSS feed for your timeline (all the tweets from people you follow), but with some searching I discovered this post describing using Roomatic to generate an RSS feed for you. ¬†Once I got that, I put together a little bash script to parse out the 4 most recent tweets. Then I tried to use the Text layout from lcd4linux along with a readline to read each tweet in. ¬†After much digging and frustration, I discovered that readline only reads the first 80 characters. ¬†Not too handy for tweets that can be 140 characters! ¬†So I resigned to just show the 2 most recent tweets each split across lines and was almost done with that when I remembered a brief example that I saw that concatenated strings. So I revamped my script to split each tweet into two 80 character lines, then concatenated them within my config file. ¬†Here’s an example:


Widget Twitter1 {
   class 'Text'
   expression file::readline('timeline.txt', 1).file::readline('timeline.txt', 2)
   width 20
   align 'M'
   speed 200 
   update tick


So everything that is displayed on the screen is done through widgets.  Then you have a Layout that tells the screen where to put each widget. In the above widget, I want to display the first tweet in my timeline. Since I parsed it to have half on line one and the other half on line 2, I use the . to concatenate these two strings.  I still find it odd that lcd4linux has no issue dealing with strings longer than 80 characters, yet readline has that limit. Anyhoo, I combine the widgets for each tweet into a layout for my screen.


Layout Twitter {
   Row01.Col1 'Twitter1'
   Row02.Col1 'Twitter2'
   Row03.Col1 'Twitter3'
   Row04.col1 'Twitter4'


In the widget, you see that the align parameter is set to ‘M’ which means marquee. ¬†This is what we want since a tweet can have over 140 characters, yet my screen is only 20 characters wide. ¬†So the result is 4 lines, each slowly scrolling through the most recent 4 tweets in my timeline! Luckily, lcd4linux constantly performs the readline operations so I just tossed my timeline parsing script in my crontab to run every 15 minutes and as soon as it is updated the display updates with the current timeline. Success!

The only thing I’d really like to tweak now is how exactly it runs. ¬†If I try to run the basic lcd4linux command, it just starts and closes without doing anything. ¬†To make it actually use my designated layout, I have to run it with the -F option that prevents it from forking and runs it in the foreground. ¬†The odd thing is that if I run ‘lcd4linux -F &’ then it puts it in the background and it runs fine. ¬†No idea what they are doing when they fork off, but apparently my machine doesn’t like it. Yay for geeky projects!