[mythtv-users] Automatic nuvexport scripts

Steven Cruysberghs steven.cruysberghs at pi.be
Sun Feb 29 03:24:46 EST 2004


Hi,

Another possible sollution I was thinking of until someone comes up with
a "real" Mytharchive plugin... 

In current CVS you can put your recordings in recording groups. I was
thinking of creating a group "To Be archived" and create a script that
call's nuvexport for all the recordings in that group.
You can use the frontend to put shows in that group after commercial
flagging.

The script would be automaticly run every night.

Steven

Op za 28-02-2004, om 22:56 schreef Andrew Turner:
> Hey all... as has been said many times (but I haven't gotten my chance yet) Excellent work on MythTV! I've sold the idea to many of my (albeit geeky) friends.
> 
> Anyways, one thing I've noticed missing has been the automatic archiving of shows. Nuvexport is great, but having to go in each time and run it to export my shows after 2 
> hours. Myth is recording more shows than I get time to backup! :) 
> 
> Well, I would love to help with development of MythTV, but I'm already super-busy with other projects, and after programming all day, coming home to program doesn't seem 
> quite as appealing. Anyways, I finally sat down and wrote some scripts to use nuvexport commandline interface to automatically archive sets of shows. The scripts are rather 
> messy (also by the fact that they use bash, sed, awk, and perl ;) I wanted to get my hands dirty in each of these) but they work as follows.
> 
> The main sript "nuvFind" takes 1 parameter, a show title to search for. nuvFind then goes and attempts to archive all of the recordings you currently have of that show in 
> SVCD format. It checks to see if there is already a directory to store these (nominally the base is /mnt/media/videos/ShowTitle) and whether that particular episode has 
> already been archived. If it has, then the script moves onto the next episode, and if the archive is not there, the script uses nuvexport to create the archive. 
> 
> Example:
> ./nuvFind "Good Eats"
> 
> will attempt to archive my entire collection of "Good Eats" (mmmm... yummy) The first time I run it, the script will archive every episode I have. After than, whenever I run it, 
> the script will just archive new shows. 
> 
> The scripts will take some tweaking for your setup (format other than SVCD, diff't parameters, diff't directories/storage names, etc.) And these could probably be cleaned up 
> to be more streamlined. However, this was my first time with sed, and awk (and I got the perl script from online).
> 
> Thanks! 
> Andy
> 
> 
> Scripts Below: save each as the filename in the dashes. Then chmod +x both nuvFind and nuvSed
> 
> ---- nuvFind ----
> #!/bin/bash
> 
> nuvexport --title="$1" > listings.txt
> ./nuvSed listings.txt > listings2.txt
> perl -pe 'chop if /,$/;' < listings2.txt > listings.txt
> awk -F, -f nuvAwk listings.txt
> 
> rm listings.txt
> rm listings2.txt
> ----------------
> 
> ---- nuvSed ----
> #!/usr/bin/sed -f
> #Remove nuvexport greetings
> s/Matching\([^$]*\)//g
> s/Thanks\([^$]*\)//g
> 
> # clear blank lines
> /./!d
> 
> #Remove fields
> s/[^:]*://g
> 
> #add comma to every line, then compress shows to one line
> s/$/,/g
> s/nuv,/nuv/g
> 
> #remove whitespace
> s/^ *//g
> 
> #remove ' (apostrophes)
> s/'//g
> ----------------
> 
> ---- nuvAwk ----
> {
>         outputDir = "\"/mnt/media/videos/" $1 "/\""
>         outputFile = outputDir "\""  $1 " - " $2 ".mpg\""
> 
>         findDirCmd = "[ -d " outputDir " ]"
>         createDirCmd = "mkdir " outputDir
>         findFileCmd = "[ -f " outputFile " ]"
> 
>         nuvexportCmd = "nuvexport --mode=svcd --denoise --chanid=" $3 " --start=" $4 " --out="outputFile
>         if ( system(findDirCmd) != 0 )
>         {
>                 print outputDir " doesn't exist. Creating..."
>                 if( system(createDirCmd) != 0 )
>                         print "Error creating " outputDir
>         }
> 
>         if ( system(findFileCmd) != 0 )
>         {
>                 print nuvexportCmd
>                 system(nuvexportCmd)
>         }
>         else
>                 print outputFile " already exists."
> }
> ----------------
> 



More information about the mythtv-users mailing list