[mythtv-users] Automatic nuvexport scripts
John W. Thomas
me at johnwesleythomas.com
Sun Feb 29 19:55:28 EST 2004
Andrew Turner wrote:
>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."
>}
>----------------
>
>
>
>
Nice script suite.
The only problem is that I had to substitute a ffmpeg command line
within nuvAwk for the nuvexport command. I was looking to trancode into
Divx (mp4), but nuvexport doesn't accept divx as a command line option.
Only svcd and dvd.
Thanks for uploading.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: me.vcf
Type: text/x-vcard
Size: 123 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-users/attachments/20040229/e83a04d4/me.vcf
More information about the mythtv-users
mailing list