XBMC Tips 1

Posted by JD 02/21/2011 at 22:00

I’ve been playing with XBMC on an Asus Eee 1008H for a few months, but never bothered to set it up as the main player in the house. This weekend, I attended a demonstration of XBMC at a local computer security meeting and was impressed. Very Impressed. Below are some tips that I learned setting up XBMC on my home network.

Oct 2013 Update

My Setup

  • Asus Eee running XBMC 10.04 version
    • dual core N280 based netbook
    • 2GB RAM
    • 100 base-tx ethernet
    • WiFi-G, but not used
    • 160GB HDD
    • Roswell Windows7 Media Center Remote ($17 from Newegg)
      This machine only does stereo audio and 800×600 video as configured to connect to an HDTV using the VGA (15-pin) connector.
  • Video Content stored on
    • CIFS / Samba share(s) from Linux – Windows Shares
    • USB 2.x HDDs
    • Tiny local storage
      I’ll use media on the internal network. No bittorrent or Usenet is used to get more content, but you can do this if you like (hey, your morals are not mine). Check your local laws first. There are lots of guides for how to get the 3 programs working to do file downloading – but not here. My content came from years and years of recording TV off cable ($100+/month) and over the air (OTA) broadcasts. Fair use is a wonderful thing.

I use Linux, not MS-Windows. Most of the things here are not specific to Linux, so you can translate them for OSX or Windows, if you like. Some plugins only work on Windows like Netflix. Hulu Desktop works on both Windows and Linux.

Setup

Remote and WiFi

Installation of the newest XBMC on the Eee was pretty easy. The only issues I had were with the remote control doing double clicks and getting the WiFi to connect to my WPA2 network. Some quick googling found a setting to fix the Lirc settings in /etc/lirc/ and how to setup a wpa-supplicant on Eee to get WiFi working. Since then, those things are fine. I assume you can google for those solutions too.

Directories

XBMC has a specific directory structure that it prefers. Don’t fight it. There are slight differences for Movies, TV and Music, but, in general, organization is key. Do not mix TV and Movie content. So, if you have mixed libraries, you’ll want to split them. Trust me. Split them before you start using the Library or you will probably have to delete the library and start over. Video content, like home movies or sporting events need to be placed somewhere else. Why? Different directories use different scrapers to determine your content and acquire metadata. TV scrapers are different from Movie scrapers are different from music scrapers, so you really don’t want to throw TV titles at a movie DB or all the metadata in your library will be wrong. Once bad data gets into the library, well … let’s just say that clean up is usually easiest by wiping the library completely and starting over.

TV/
Movies/
Music/
Other/

These can be placed on your network and shared. In fact, You may want multiple shares from different machines or on external disk drives with this layout structure just to stay consistent. XBMC doesn’t make you know where any content is, just that it is available somewhere on the network. In library mode, all movies are merged, all TV shows are merged completely independent of the network locations.

If you want to setup something quick to get an idea of how XBMC works, copy a few movies and a few TV shows into some other directory areas and use them to play. Don’t use your main areas and definitely don’t move the files. You may delete files thru the GUI accidentally. Be careful.

You don’t have to follow my rules below and there are lots of other ways to make all this work wonderfully, however, these are what I’ve found work best for me.

Anyway, you want to follow these rules for your TV and Movie directories:

  1. Any video content that isn’t TV or Movies needs to be placed outside these directories. Home movies and Sports, for example.
  2. Place TV content into TV specific folder(s) – this is a top level thing due to a single scraper setting.
  3. Place Movie content into Movie specific folder(s) – scraper setting.
  4. Place any content that you don’t want scraped into a different directory from the TV and Movie content.
  5. Create individual folders/directories for each TV show; ignore seasons at this level
  6. Create individual folders/directories for each Movie
  7. Name the directories for both TV and Movies with Title (Year) where the Year is the first release year for the content. When in doubt, check IMDB for the exact title. This is at the directory level. Years are only needed if the scraper gets confused.
  8. Name the actual video file as close to the directory as comfortable. Somewhere in XBMC settings, you can force the folder names to be used over the individual video filenames. This is important of you have VTS_xx.VOB files or just don’t want to be bothered renaming other video files.
  9. For multi-part movies, use -cd1, -cd2, -cd3 to have the multiple files be merged into a single listing in the library. There are other nomenclatures that also work too, but they use more characters. Using cd1 for the main movie and cd2 for bonus features might be nice. movie_title-cd1.mkv and movie_title-cd2.mkv would be automatically merged into a single Movie metadata inside the library. You probably want that.
  10. For TV shows where you have multiple seasons, make a subdirectory for each season. Perhaps S1, S2, S3 … You can spell it out as Season 1 if you like.
  11. Use S0/ for the specials, webisodes, and add-on movies. Battlestar Galactica is an example with both multiple webisode series AND extra movies. Battlestar_Galactica-033-Razor_Flashbacks.mkv, Battlestar_Galactica-023-The_Resistance.flv, Battlestar_Galactica-022-The_Plan.mkv are examples. The only way to find which episode number is to check the specific scraper website. The cool think is that XBMC shows these Specials in Library mode in the correct order intermixed with other normal episodes. Way Ccol!
  12. TV Show video files should be named {title}.{ep}.{ep-title}.{ext}, but only the {ep} part seems to be required if you use the folder name to determine the show title. The ‘.’ characters are regular expressions for “any character”, so good choices are – _ or . Regex is fantastic and how the scrapers work.
  13. TV Shows with episodes denote the different episodes in a few different ways. All these formats work.
    1. s1e04
    2. 1×04
    3. 104
      I have not been happy with TV show file names that contain dates like Windows7 Media Center creates. Of course, they playback fine, but they don’t show up in library-mode at all because the episode data cannot be determined. This could also be due to the specific shows being aired every weekday without episodic information.

Here’s a directory tree for TV example:

TV
|____Chappelles Show
|    |____s1
|    |____s2
|    |____Extras
|____Penn & Teller: Bullshit
|____Battlestar Galactica (2003)
|    |____s0
|    |____s1
|    |____s2
|    |____s3
|    |____s4
|____V (1984)
|____V (2009)
|    |____s1
|    |____s2
|____The Amazing Race Unfinished Business (2011)
|____Human Target (2010)
|____Smallville
|____Firefly
|____Leverage
|____Burn Notice
|____Nikita (2010)
|____Chuck
|    |____s1
|    |____s2
|____Space: Above and Beyond (1995)

For Movies:

Movies
|____Eddy Murphy-Raw
|____Fifth Element
|____Greedy
|____Monty Pythons The Meaning of Life
|____Bond
|    |____For Your Eyes Only
|    |____Live and Let Die
|    |____Octopussy
|    |____The Living Daylights
|    |____Thunderball
|    |____Moonraker
|    |____Never Say Never Again
|    |____The Man With the Golden Gun
|    |____The Spy Who Loved Me
|    |____On Her Majesty's Secret Service
|    |____From Russia with Love
|    |____Golden Eye
|    |____Goldfinger
|    |____Licence to Kill
|    |____A View to a Kill
|    |____Diamonds Are Forever
|    |____Dr. No
|    |____You Only Live Twice
|____The Matrix
|____Lord of the Rings

Notice how subdirectories can be used to group movies, but these groupings don’t seem to have any impact in the library view. It seems that you can control that grouping with data inside .nfo files, but I haven’t gotten there yet.

You can have multiple top level TV, Movie and Music directories. That isn’t any issue, just name them in a useful way. The library view will merge the content together. However, if you have duplicate files, those will be duplicated in the library too. Initially, I didn’t follow the -cd1, -cd2 stuff above, so duplicate titles was a big issue.
Each top level can have different scraping rules. Grouping English TV shows together makes sense, then grouping Spanish together will allow a different scraper, different language – after all, the English TV scraping sites do not contain Spanish Telenovella data.

Inside the XBMC interface, I name the different server shared directories with TV on {server} or Movies on {server} so all TV is displayed together under the top level Video interface. Again, in the library mode, this information isn’t displayed, just the metadata about the content without the server.

Refresh Content Lists

With all the TV capabilities of XBMC, you’d think that it would automatically refesh the library every few hours. It doesn’t work that way, at least not automatically. A solution is to force an rescan every 4 hours (or at least daily) with a tiny script run from cron on the XBMC machine:

refresh_video.sh

#!/bin/sh
URL="http://localhost:8080"
curl --get "$URL/xbmcCmds/xbmcHttp?command=ExecBuiltIn(UpdateLibrary(video)) "
exit 0;

You can run this script from any machine on your network since it is just visiting a REST interface. Obviously, change the URL IP address as needed for your setup. BTW, curl was pre-installed on my XBMC. I don’t know if I did it or it was part of the distribution. I’ve read that the XBMC team has deprecated the REST interfaces. They prefer JSON, which sucks for non-WSDL programmers.

Run that script every few hours to keep all your video (TV, Movies and Music Videos) updated. I’m certain there are other xbmcCmds that would be useful. Anyone have a link?

There is an addon that will refresh TV and Movies, but people have reported system stability issues after loading it. I have needed to reboot twice daily since loading it myself.

Bogus Information for a Show

If you find that the metadata for a show or movie is wrong, you can provide a hint to XBMC with a text file placed in the same directory as the video with the same name as the video file or tvshow.nfo, for TV, if you are lazy.
So if you have a directory named … Penn & Teller: Bullshit/ and the show isn’t being properly determined by the scraper (mine wasn’t), then inside the subdirectory, create a file named Penn & Teller: Bullshit.nfo and put a URL hint inside for the scraper.

http://www.imdb.com/title/tt0346369/

That’s all that is needed. These .nfo files can hold all sorts of other data in XML format, but for today, having the IMDB or thetvdb.com link is enough. This works for TV and Movies. Place it in the top level directory if your TV show has multiple seasons in subdirectories. I don’t flatten TV shows.

Web Interface to XBMC

The XBMC web interface is here http://xbmc-ip:8080/ Enjoy.
It requires ajax and a full browser – yuck.

I guess many people have Android and iPhone/iWhatever devices. Those have XBMC specific apps to make remote control easy. I have a Nokia N800 and LOVE IT, but it doesn’t work too nicely with the default web interface. Since most people don’t have an N800, nobody is creating apps to control XBMC from that device. The web page will List the Movies and you can start playback through the web interface, but only with a fairly new browser. Resume doesn’t seem possible. However, I don’t see any TV shows and doing simple things like search doesn’t seem possible in the web interface.

An alternate, simple web interface is needed. I hope the REST interface isn’t really deprecated, since it is very useful to non-professional programmers.

Missing Things That I Still Need

I had to wipe my database already because I didn’t have content properly organized and starting over was the easiest way. I’d like a few other things:

  1. Trivial way to have offline content displayed, but when accessed – have XBMC tell me which numbered volume needs to be mounted. This would be useful for external DVDs, external optical disks and external USB/Firewire/eSATA disk drives. I found a possible way to deal with this, but haven’t gotten it working. It uses empty files and .NFO data. I’m unclear on how the “Load media XYZ will be displayed still. Adding this with a dedicated .NFO XML tag would be the best solution for me.
  2. Easy way to wipe content from the library without risking the physical files. There are clean functions, but in my research on them, I’ve been warned that they could delete the files too. I’d like to have a menu item that worked from a remote to delete the specific show/movie from the library, but clearly leave the files alone.
  3. Better Web interface with more complete control that works on dumber browsers. It should control Movies, TV, and Music.
  4. Music playback shouldn’t waste CPU with stupid visualizations. Show the metadata for a song for 15 seconds, then turn off or blank the display. This appears to be a setting.
  5. Metadata editor for content that isn’t from the internet or found with scrapers. This should build .NFO files and store them.

Summary

With all these capabilities, XBMC has become addictive in just a few days of use. Give it a try for a few hours and see if you don’t become addicted too.

Trackbacks

Use the following link to trackback from your own site:
https://blog.jdpfu.com/trackbacks?article_id=1002

  1. JD 06/15/2011 at 19:42

    Lots of folks seem to want to clean out their XBMC database based on search terms. The DB files are just SQLite files. Deleting them is easy. Just stop XMBC from the shell, then delete the *.db files like MyVideos34.db under the ~/.xbmc directory. When you restart XMBC, new files will automatically be created.

    Of course, it would be a good idea to simply move the old files to a different name rather than delete them. This way, you can get them back if something bad happens.

    You may want to read up over at the XBMC wiki for more details.