[mythtv-commits] Re: Ticket #334: Update mythlink.pl to work with
the new filenames
MythTV
mythtv at cvs.mythtv.org
Wed Sep 21 19:12:26 UTC 2005
#334: Update mythlink.pl to work with the new filenames
----------------------------------------------+-----------------------------
Reporter: sphery <mtdean at thirdcontact.com> | Owner: xris
Type: patch | Status: new
Priority: minor | Milestone:
Component: mythtv | Version:
Severity: low | Resolution:
----------------------------------------------+-----------------------------
Comment (by anaerin at gmail.com):
I've changed my version of mythlink.pl so it works with both (And any
future versions) based on the DB changes that have happened. So rather
than looking up the details by splitting the filename, it looks up the
filename in the DB (As it should).
{{{
# Prepare a database query
$sh = $dbh->prepare('SELECT title, subtitle, description, recgroup,
category, originalairdate, date_format(progstart,\'%Y\'),
date_format(progstart,\'%m\'), date_format(progstart,\'%d\'),
date_format(progstart,\'%H\'), date_format(progstart,\'%i\'),
date_format(progstart,\'%S\')), date_format(progend,\'%Y\'),
date_format(progend,\'%m\'), date_format(progend,\'%d\'),
date_format(progend,\'%H\'), date_format(progend,\'%i\'),
date_format(progend,\'%S\'), chanid FROM recorded WHERE basename=?');
# Create symlinks for the files on this machine
foreach my $file (<$video_dir/*>) {
next if ($file =~ /^ringbuf/);
# Pull out the various parts that make up the filename
# my ($channel,
# $syear, $smonth, $sday, $shour, $sminute, $ssecond,
# $eyear, $emonth, $eday, $ehour, $eminute, $esecond) = $file
=~/^$video_dir\/([a-z0-9]+)_(....)(..)(..)(..)(..)(..)_(....)(..)(..)(..$
# Found a bad filename?
# unless ($channel) {
# print "Unknown filename format: $file\n";
# next;
# }
# Query the desired info about this recording
$file =~ s/$video_dir\///;
$sh->execute($file)
or die "Could not execute ($q): $!\n\n";
my ($title, $subtitle, $description, $recgroup, $category, $oad,
$syear, $smonth, $sday, $shour, $sminute, $ssecond, $eyear, $emonth,
$eday, $ehour, $eminute, $esecond, $channel) = $sh->fetchrow_array;
my $rows = $sh->rows;
# print "Got $rows, $title, $subtitle, $description, $recgroup,
$category, $oad, $syear, $smonth, $sday, $shour, $sminute, $ssecond, $eye$
if ($rows > 0) {
# Format some fields we may be parsing below
# Start time
my $meridian = ($shour > 12) ? 'AM' : 'PM';
my $hour = ($shour > 12) ? $shour - 12 : $shour;
if ($hour < 10) {
}}}
And so on...
{{{
}
symlink "$video_dir/$file", "$dest/$name$suffix"
or die "Can't create symlink $dest/$name$suffix: $!\n";
print "$dest/$name$suffix\n";
}
}}}
This should work a lot better.
The only (other) issue is that it causes some mpg files that were created
with the previous version to be labelled as .nuv's, but that's not that
major TBH.
--
Ticket URL: <http://svn.mythtv.org/trac/ticket/334>
MythTV <http://www.mythtv.org/>
MythTV
More information about the mythtv-commits
mailing list