Media Library

From AwkwardTV
Revision as of 03:22, 25 March 2007 by 69.16.139.102 (talk) (Added patch for title setting on cli)
Jump to: navigation, search

The Media Library file (in /mnt/Media/Media Library) is similar to iTunesDB on the iPod. The path to the actual media files are relative to /mnt/Media/Media Files/

Patch for gnupod (http://www.gnu.org/software/gnupod/) to output the correct path as well as a stub for handling .mov (for reference files) (also note that this makes it not work for real ipods):

--- gnupod-orig/src/ext/FileMagic.pm    2006-09-27 02:52:23.000000000 -0700
+++ gnupod-0.99.1/src/ext/FileMagic.pm  2007-03-24 16:48:43.000000000 -0700
@@ -73,6 +73,20 @@
   elsif(!-r $file) {
    warn "FileMagic.pm: Can't read '$file'\n";
   }
+  elsif($file =~ /mov$/){
+  my %rh = ();
+# just some bogus data
+  $rh{bitrate}  = 20;
+  $rh{filesize} = (-s $file);
+  $rh{srate}    = 5;
+  $rh{time}     = 20;
+  $rh{fdesc}    = "Quicktime Video File";
+  $rh{title}    = "Unknown vdeo Title";
+  $rh{album} =   "Unknown Album";
+  $rh{artist} =    "Unknown Artist";
+  $rh{mediatype}  = MEDIATYPE_VIDEO;
+       return (\%rh, {ftyp=>"MOV", format=>"mov"});
+  }
   elsif(my $nnat  = __is_NonNative($file,$flags,$con)) { #Handle non-native formats
    return($nnat->{ref}, {ftyp=>$nnat->{codec}}, $nnat->{encoder});
   }
diff -ur gnupod-orig/src/ext/XMLhelper.pm gnupod-0.99.1/src/ext/XMLhelper.pm
--- gnupod-orig/src/ext/XMLhelper.pm    2006-02-03 12:47:24.000000000 -0800
+++ gnupod-0.99.1/src/ext/XMLhelper.pm  2007-03-24 16:48:53.000000000 -0700
@@ -121,6 +121,8 @@
 
 #Convert /'s to :'s
 $ipath =~ tr/\//:/;
+# for appletv
+$ipath=~s/:iPod_Control:Music//;
 return ($ipath, $path);
 }

This patch will let you set the title on the command-line with "--set-title=":

--- gnupod-orig/src/gnupod_addsong.pl   2006-03-22 12:05:24.000000000 -0700
+++ gnupod-0.99.1/src/gnupod_addsong.pl 2007-03-25 03:17:33.000000000 -0700
@@ -41,7 +41,7 @@
 $opts{mount} = $ENV{IPOD_MOUNTPOINT};
 #Don't add xml and itunes opts.. we *NEED* the mount opt to be set..
 GetOptions(\%opts, "version", "help|h", "mount|m=s", "decode=s", "restore|r", "duplicate|d", "disable-v2", "disable-v1",
-                   "set-artist=s", "set-album=s", "set-genre=s", "set-rating=i", "set-playcount=i",
+                   "set-artist=s", "set-album=s", "set-genre=s", "set-rating=i", "set-playcount=i", "set-title=s",
                    "set-songnum", "playlist|p=s", "reencode|e=i");
 GNUpod::FooBar::GetConfig(\%opts, {'decode'=>'s', mount=>'s', duplicate=>'b',
                                    'disable-v1'=>'b', 'disable-v2'=>'b', 'set-songnum'=>'b'},
@@ -138,6 +138,7 @@
                $fh->{genre}       = $opts{'set-genre'}       if $opts{'set-genre'};
                $fh->{rating}      = $opts{'set-rating'}      if $opts{'set-rating'};
                $fh->{playcount}   = $opts{'set-playcount'}   if $opts{'set-playcount'};
+               $fh->{title}       = $opts{'set-title'}       if $opts{'set-title'};
                $fh->{songnum}     = 1+$addcount              if $opts{'set-songnum'};
 
                #Set the addtime to unixtime(now)+MACTIME (the iPod uses mactime)

After gnupod is built:

  • mkdir MediaNew
  • export IPOD_MOUNTPOINT=`pwd`/MediaNew
  • gnupod_INIT.pl
  • gnupod_addsong.pl <whatever>
  • mktunes.pl

Copy these files to the appletv:

  • iPod_Control/Music/* -> /mnt/Media/Media Files/*
  • iPod_Control/iTunes/iTunesDB -> /mnt/Media/Media Library

You'll need to restart Finder/Front Row on the appletv to get it to reread the db

Trying to figure out the format for TV Shows now so you can put them in there instead of being unsorted in Movies.