If you are like me, you are a huge fan of mythtv and you have a huge video collection. Mine is well over 1000 files and growing everyday. I like to keep my movies up to date with the information from imdb, including covers. However this is a cumbersome task since every time I add a new movie, I have to go crawling through the Video Manager until I find it.
There has to be an easier way I thought, and I have been searching for a long time. I have seen a lot of people complaining about the same thing but no real solutions. So I decided to do some digging and that is when I discovered filters and categories. However I could not find any documentation out there.
To begin I should first describe my setup. I have inside my main video directory two subdirectories, Movies and Television, were I keep the files respectively. The problem I had was that in the Video Manager all these files appeared in one giant list. This made it next to impossible to navigate through the list to find a recently added movie to update.
The first step in this was to create the categories. To do this go into the Video Manager and then select any video file and edit its metadata. Here, select the category and create one for each sub directory you have. For me, I created two categories, tv and movies. Once these are created exit back out of the Video Manager.
Now the next step would be to manually go through all 1000+ files updating the metadata, setting the category to the appropriate value. Initially I started doing this, but after the first 100 or so, I realized there had to be an easier way. And there is, not only is it more accurate but its way easier. What is it, how do you do it? Well let me tell you. I decided to do a mass update on the Video database.
Thats right, with just a few cleverly executed sql statements all this could be done for me, fast and efficient. The first thing we need to do, is find out the ID of the categories. So the proper sql statement to do this is:
SELECT * FROM videocategory
This gives me the following result:
intid category 1 tv 2 movie
Thats pretty simple and all we really need, to do the mass update. So my next step is to set the category to tv for everything I have in the Television directory. To do that all I have to do is run the following sql statement:
UPDATE videometadata SET category=1 WHERE filename LIKE ('%Television%')
Notice that the category value is the intid value from our previous sql statement. Also notice the percent before and after Television. I did this because it doesn’t matter where you have your video directory mounted, or named it will work regardless. Be careful with this, with my setup Television only appears in the pathname for my tv shows, and does not exist elsewhere. If you are not 100% sure of your file structure, change the first percent to the entire path. So for me this would be ‘/video/videos/Television%’. Once that is done, repeat for as many subdirectories and categories as you have, changing the category and filename as appropriate to fit your needs.
Now its time to go back into the Video Manager and setup a default view. A default view only shows files based on category, which we just setup. By default the view is set to ALL and if you are happy with that, you can skip this step. I wanted my default view to be movies, since those are the ones I like to keep updated. Never ever set your default view to “Unknown”. If you do the Video Manager will be useless until you add a new file. I at least could not find a way to switch views when there is nothing in the list.
To set the default view, select any file and then select “Filter Display” near the bottom of the menu. Here change the category to whatever you want the default to be, for me this was movies. Then go to the bottom and click “Save as default”. This is also how you can switch between views. So if you want to see everything with the category tv, select tv as the category and then select Done.
So now with everything organized into categories, I can easily update newly added movies by changing my view to unknown. Presto, only newly added files are listed, which should be a much easier list to deal with. Now just update the imdb info and change the category to the appropriate value, and your finished. Its just that easy.
I also know some people are going to say, you could have reduced that sql statement into just one using a sub-select. Well yes I know, but since sub-selects are fairly new to mysql I decided its best to show all the steps. Besides its only 1 tiny query, that will work for everyone, so who cares.
I have also been thinking about how to automate this process, and may build something for mythweb. So if you would like something like that, please give me some encouraging words to help get me motivated. If anyone has any ideas or tips on how to improve this process let me know. Lord knows I would appreciate those as well.
Enjoy!