ARCHIVE
LinuxMCE Forums
May 23, 2013, 07:15:03 am GMT-1 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Rule #1 - Be Patient - Rule #2 - Don't ask when, if you don't contribute - Rule #3 - You have coding skills - LinuxMCE's small brother is available: http://www.agocontrol.com
 
   Home   Help Search Chat Login Register  
Pages: [1]
  Print  
Author Topic: mythtv nuv recordings supported as videos ?  (Read 901 times)
archived
Hello, I'm new here

Posts: 0


View Profile
« on: October 12, 2005, 03:17:33 pm »

Hi,

I've created directory mythtv under videos and added mythlink.sh script that links mythtv recordings with pretty names to this directory, so they can be used as normal videos.

I've added this script to cron to be run each minute. Not nice hack, but it works..... if you want to see mythtv recordings you have to go into mythtv and you can't do this from other MDs or Orbiters....

mythlink.sh (from mythtv mailing lists):

 
Code:

#!/bin/sh
# mythlink.sh - Symlinks mythtv files to more readable version in /tv/pretty
# by Dale Gass
# modified by Dave Misevich for slightly prettier names and doesn't destroy/recreate valid links.
# (I found a windows box watching a recording would terminate if the link was removed)
# Bug fixed caused by programs that don't have a subtitle. Use start time/date to create one.
# modified to add .mpg to end of symlink. Thanks mike at the mysettopbox.tv forum for the code.
# 6th Ocotober 2005 by Garth Kirkwood
# - change structure from do to if for easier logic (my thoughts)
# - cleanlinks run first to remove dud links from pretty
# Currently UNTESTED

# Remove dud links
cd /home/public/data/videos/mythtv/
 
cleanlinks

mysql -uroot  mythconverg -B --exec "select chanid,DATE_FORMAT(starttime,'%Y%m%d%H%i%s'),DATE_FORMAT(endtime,'%Y%m%d%H%i%s'),title,subtitle from recorded;" >/tmp/mythlink.$$
perl -w -e '

        my $mythpath= "/home/mythtv/shows/192.168.0.1";
        my $altpath= "/home/public/data/videos/mythtv";
        my $dfile= "";
        my %month = ( "01","Jan", "02","Feb", "03","Mar", "04","Apr", "05","May", "06","Jun",
                      "07","Jul", "08","Aug", "09","Sep", "10","Oct", "11","Nov", "12","Dec");
        if (!-d $altpath) {
               mkdir $altpath or die "Failed to make directory: $altpath\n";
        }
        opendir(DIR, $altpath) or die "cannot opendir $altpath: $!";
        while (defined($file = readdir(DIR))) {
                next if $file =~ /^\.\.?$/;     # skip . and ..
                @dirlist = (@dirlist,$file);
            }
            closedir(DIR);
        <>;
        while (<>) {
              chomp;
              my ($chanid,$start,$end,$title,$subtitle) = split /\t/;
              $subtitle = "" if(!defined $subtitle);
              my $ofn = "${chanid}_${start}_${end}.nuv";
              my $nfn = $title."-".$subtitle;

              #define name of new file
              $start =~ /^....(........)/;
              if ($subtitle eq "") {
                 # if no subtitle then build one from start time.
                 $subtitle = $month{substr($start,4,2)} . substr($start,6,2);
                 $subtitle = $subtitle . "_" . substr($start,0,4) . "_" . substr($start,8,4);
              }
              $nfn =~ s/&/+/g;
              $nfn =~ s/\047//g;
              $nfn =~ s/[^+0-9a-zA-Z_-]+/_/g;
              $nfn =~ s/_$//g;
             
               # create dummy if the nuv doesnt exist
      if ( !-e "$mythpath/$ofn") {
         
                   #print "Creating missing file $mythpath/$ofn\n";
                   open ($dfile,">$mythpath/$ofn") || die("Could not open txt file. $!");
                   print $dfile "Creating dummy file for $title $subtitle \n";
                   close ($dfile);
                  }
               # otherwise create the symlink
      else {
                   #print "\$ofn = $ofn $title \$nfn = $nfn\n";
                   # make a list of existing nuv filenames for use later.
                   $goodfile{$nfn.".mpg"} = 1;
                   if (!-s "$altpath/$nfn".".mpg"){
                      #  print "Creating $altpath/$nfn\n";
                       symlink "$mythpath/$ofn", "$altpath/$nfn".".mpg" or die "Failed to create symlink $altpath/$nfn".".mpg".": $!";
                   }
                }
        }

' /tmp/mythlink.$$
rm /tmp/mythlink.$$


HTH,

regards,

Rob.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!
Pluto provided a snapshot of their forums with approximately 5,000 posts in February, 2007 when LinuxMCE branched off. Browse those forum posts in the Archive section. Those posts have been included in the search engine and can be found with keyword searches.