Video Management

From MythTV Official Wiki
Revision as of 21:48, 10 August 2008 by Chaoticmachinery (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Video Management

Video Management is pretty easy to do and pretty painless. Pretty much what I am referring to is managing those videos found under the Watch Videos menu.

What I did here are hook up a couple of 500 gig external drives via USB to my MythTV machine. Then using a couple of scripts I can add videos to Mythtv via symbolic links. This way I can add drives to the system as needed with out having to expand my LVM file system. As far as MythTV is concern it is one big listing of files.

1) Create mount points for the new drives. I mount everything under /export.

$ mount /export/movie

2) Create the file system. Add the drive to the system. Then use dmesg to see what the device is for the new drive.

$ mkfs.ext3 {device}

3) Mount the new file system.

$ mount {device] /export/movie

4) Now create your category directories.

$ cd /export/movie
$ mkdir action_adventure cartoon comedy drama family horror mystery romance scfi

5) Upload or move your videos to the directory you want them in.

6) Then run the following Perl script. One word of warning: If you have real files in your current MythTV video directory, move them to you new storage directory. The script recreates the directory each time it is ran. Please pay attention to the comments in the script. You will have to edit it to make it work for your setup.

Movie-Links Perl Script


# By K Murphy
# This will make symbolic links from your video drives to the path MythTV uses for Video.
# Any time you add a video to the external/internal drives just run the script. Then go and
# into the Video Manger and add them.

use File::Path;
use File::Copy;
use Cwd;

# I have all of my MythTV content under /mnt/mythtv. You will have to edit the path in all of the lines where your video content is. 
# Just replace anything that says /mnt/mythtv to what ever path you are using

# Remove the old video directory if it is there
system("rm -R /mnt/mythtv/video.old");

# Reanme the current video directory to video.old
move("/mnt/mythtv/video", "/mnt/mythtv/video.old");

# Path for where you video content is

# Category directories. They must be the same as on your video drives

# List the mount points for your video drives. As you can see I have two going so far. 

@filelist = ();

sub create_dir {
        print "\n";
        foreach (@dirlist) {
                print "Creating Dir: $movie_link_dir/$_\n";
                mkpath "$movie_link_dir/$_";
        print "\n";
mkpath "$movie_link_dir";
foreach $movieloc (@movieloc) {
        print "\nWorking on movie storage location: $movieloc\n";
        foreach $dirlist (@dirlist) {
                print "\tChange dir to: $movieloc/$dirlist\n";
                chdir ("$movieloc/$dirlist");
                $cwd = cwd();
                if ("$movieloc/$dirlist" eq $cwd) {
                        @filelist = <*>;
                        foreach $file (@filelist) {
                                if ( -f "$file" ) {
                                        print "\t\tSymlink: $movieloc/$dirlist/$file  --> $movie_link_dir/$dirlist/$file \n";
                } else {
                        print "\t\t$dirlist does not exist.\n";

7) Go into Video Manager and add the video.

Now if you go into your Mythtv video directory it should list the category directories. Then in each directory are symbolic links to the video files stored on your hard drives.


1) I found that the Maxtor OneTouch externals are pretty nice. The one caveat to them is that if they went into sleep mode, it takes 30+ seconds to wake them up. So you might see a pause when Mythtv goes to display the details about the movie.