diff options
author | Andreas Mair <amair.sob@googlemail.com> | 2006-03-08 11:34:02 +0100 |
---|---|---|
committer | Andreas Mair <amair.sob@googlemail.com> | 2006-03-08 11:34:02 +0100 |
commit | 2723bd07c1a821c2198f43a313570c600907c327 (patch) | |
tree | feece2d6565c4f8508dfd2cf8aedc2e07959d25c /convert.pl | |
parent | fd84627622f927bb6bf6f5c5d9e02295355a22c3 (diff) | |
download | vdradmin-am-3.4.4beta.tar.gz vdradmin-am-3.4.4beta.tar.bz2 |
2006-03-08: 3.4.4betav3.4.4beta
- Added script "convert.sh" to convert the AutoTimer information in VDR's timers.conf to the new format (see "convert.sh" for usage).
- Use the summary/aux timer field to store AutoTimer information to be compatible to VDR v1.3.44 and later.
- Removed "Add summary to new timers" option. The EPG summary is no longer copied to the timer's summary/aux field (for VDR 1.3.44+) or always copied (VDR 1.3.43-).
- Made summary textfield readonly while adding/editing a timer.
- Unless NO_EVENTID or NO_EVENTID_ON is used the EPG-ID is stored in every (auto)timer set using VDRAdmin-AM.
- For every timer the current start/stop margins are saved in its summary/aux field. These are used for checking AutoTimers by time.
- Fixed bug while checking for already programmed (auto)timers if not using EPG-ID.
Diffstat (limited to 'convert.pl')
-rwxr-xr-x | convert.pl | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/convert.pl b/convert.pl new file mode 100755 index 0000000..84303f0 --- /dev/null +++ b/convert.pl @@ -0,0 +1,64 @@ +#!/usr/bin/perl + +use strict; + +if(scalar(@ARGV) != 3) { + print("Usage: convert.pl <vdradmin-am config> <timers in> <timers out>\n"); + print("\t<vdradmin-am config> VDRAdmin-AM's vdradmind.conf\n"); + print("\t<timers in> Source timers.conf\n"); + print("\t<timers out> Destination timers.conf\n"); + exit 1; +} + +my %CONFIG; +my $CONFFILE = @ARGV[0]; +my $timers_in = @ARGV[1]; +my $timers_out = @ARGV[2]; + +ReadConfig(); + +print("Converting $timers_in to $timers_out\n"); +my $in = open(FH_IN, "<$timers_in") if(-e "$timers_in"); +my $out = open(FH_OUT, ">$timers_out"); +if($in and $out) { + while(<FH_IN>) { + chomp; + s/#.*//; + s/^\s+//; + s/\s+$//; + next unless length; + my ($status, $channel, $day, $start, $stop, $priority, $lifetime, $file, $aux) = split(":", $_); + my $autotimer = 1 if($status & 0x8000); + my $active = $status & 0x7FFF; + my $event_id = $status >> 16; + if($autotimer) { + $autotimer = 2 if($event_id); + $aux .= "|" if($aux); + $aux .= "<vdradmin-am><epgid>$event_id</epg_id><autotimer>$autotimer</autotimer><bstart>$CONFIG{TM_MARGIN_BEGIN}</bstart><bstop>$CONFIG{TM_MARGIN_END}</bstop></vdradmin-am>"; + } + print(FH_OUT "$active:$channel:$day:$start:$stop:$priority:$lifetime:$file:$aux\n"); + } + close(FH_IN); + close(FH_OUT); + print("\nNOTE:\n"); + print("Please check the new timers.conf for errors before replacing the old timers.conf!\n"); +} else { + print("Failed to open files!\n"); + exit 1; +} + +sub ReadConfig { + if(-e $CONFFILE) { + open(CONF, $CONFFILE); + while(<CONF>) { + chomp; + my($key, $value) = split(/ \= /, $_, 2); + $CONFIG{$key} = $value; + } + close(CONF); + } else { + print "$CONFFILE doesn't exist. Exiting\n"; + exit(1); + } + return(0); +} |