User Tools

Site Tools


myth_tv_homebrew_project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
myth_tv_homebrew_project [2009/03/01 15:00] davidmyth_tv_homebrew_project [2009/03/01 15:42] (current) david
Line 447: Line 447:
 ===== Human Readable File Names ===== ===== Human Readable File Names =====
  
 +  * Note this is specific to Mythbuntu
  
-For Mythbuntu, I wanted to add a cronjob that builds links to the files: 
- 
-  - Copy the rename script to somewhere you can run it:  <code> 
-mkdir ~/bin 
-cp /usr/share/doc/mythtv-backend/contrib/mythrename.pl.gz ~/bin 
-gunzip ~/bin/mythrename.pl.gz 
-chmod 755 ~/bin/mythrename.pl 
-</code> 
   - Create a directory under recordings that you can write to:  <code>   - Create a directory under recordings that you can write to:  <code>
 sudo mkdir /var/lib/mythtv/recordings/links sudo mkdir /var/lib/mythtv/recordings/links
 sudo chgroup video /var/lib/mythtv/recordings/links sudo chgroup video /var/lib/mythtv/recordings/links
 sudo chmod 775 /var/lib/mythtv/recordings/links sudo chmod 775 /var/lib/mythtv/recordings/links
 +</code>
 +  - Use the **mythlink.sh** scripts with a couple modifications to make the directories and links to your files whenever you need them.
 +
 +<code>
 +
 +#!/bin/sh
 +
 +# mythlink.sh - Symlinks mythtv files to more readable versions
 +# by Dale Gass modified by Jacob Stoner
 +
 +if [ ! -d /var/lib/mythtv/recordings/links ]; then mkdir /var/lib/mythtv/recordings/links; fi
 +rm -R -f /var/lib/mythtv/recordings/links/*
 +
 +echo "Done RM"
 +mysql -umythtv -pYOURPASSWORDGOESHERE  mythconverg -B --exec "select chanid,starttime,endtime,title,subtitle from recorded;" >/tmp/mythlink.$$
 +perl -w -e '
 +        my $mythpath= "/var/lib/mythtv/recordings";
 +        my $altpath= "/var/lib/mythtv/recordings/links";
 +        if (!-d $altpath) {
 +                mkdir $altpath or die "Failed to make directory: $altpath\n";
 +        }
 +        <>;
 +        while (<>) {
 +                chomp;
 +                my ($chanid,$start,$end,$title,$subtitle) = split /\t/;
 +                $start =~ s/[^0-9]//g;
 +                $end =~ s/[^0-9]//g;
 +                $subtitle = "" if(!defined $subtitle);
 +                my $ofn = "${chanid}_${start}.mpg";
 +                do { print "Skipping $mythpath/$ofn\n"; next } unless -e "$mythpath/$ofn";
 +                $start =~ /^....(........)/;
 +                #my $nfn = "$1_${title}_${subtitle}";
 +                my $nfn = "${title}";
 +                if ($subtitle) {$nfn="${nfn}_${subtitle}"}
 +                $nfn =~ s/ /_/g;
 +                $nfn =~ s/&/+/g;
 +                $nfn =~ s/[^+0-9a-zA-Z_-]+/_/g;
 +                $nfn = "${nfn}.mpg";
 +                print "Creating $nfn\n";
 +                unlink "$altpath/$nfn" if(-e "$altpath/$nfn");
 +                mkdir "$altpath/$title";
 +                symlink "$mythpath/$ofn", "$altpath/$title/$nfn" or print "Failed to create symlink $altpath/$nfn: $!";
 +        }
 +' /tmp/mythlink.$$
 +rm /tmp/mythlink.$$
 </code> </code>
  
myth_tv_homebrew_project.1235919654.txt.gz · Last modified: 2009/03/01 15:00 by david