summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-09-15 12:49:52 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-09-15 12:49:52 (GMT)
commitb7d1173fe4b74fe584fc6817dde18cdc52437d64 (patch)
tree4fee6b2cf707a15c06c3dc87da8ad72c8b66280c
parent2020cc498dcc71ba0c7ab21fa253a5d4dbd09193 (diff)
minor refactoring
-rwxr-xr-xutils/rhrd-show29
1 files changed, 15 insertions, 14 deletions
diff --git a/utils/rhrd-show b/utils/rhrd-show
index ac08e25..b7ee202 100755
--- a/utils/rhrd-show
+++ b/utils/rhrd-show
@@ -33,7 +33,8 @@ sub print_usage
" rhrd-show (show|remove) <show-id>\n" .
" rhrd-show add <groupname> <name> <title> <num-carts> <rhythm> <dow> <starttime> <len>\n" .
" rhrd-show edit <show-id> <title> <rhythm> <dow> <starttime> <len>\n" .
- " multi show handling:\n" .
+ "\n" .
+ " multi show handling:\n" .
" rhrd-show multi-list\n" .
" rhrd-show (multi-show|multi-remove) <multi-show-id>\n" .
" rhrd-show multi-add <title> <week>=<show-id> [ <week>=<show-id> [ .. ] ]\n" .
@@ -338,8 +339,8 @@ sub multi__parse_shows
my %shows = ( 1 => 0, 2 => 0, 3 => 0, 4 => 0 );
foreach my $show (@_) {
- my ($week, $show_id) = split('=', $show, 2);
- unless(defined $week && defined $show_id) {
+ my ($week, $showid) = split('=', $show, 2);
+ unless(defined $week && defined $showid) {
print STDERR "'" . $show . "' is invalid, needs to have format <week>=<showid>\n";
return undef;
}
@@ -354,34 +355,34 @@ sub multi__parse_shows
return undef;
}
- $show_id = int($show_id);
- my ($show_id_min, $show_id_max, $errorstring) = RHRD::rddb::get_showid_range($ctx);
- unless(defined $show_id_min) {
- print STDERR $show_id_max . ": " . $errorstring . "\n";
+ $showid = int($showid);
+ my ($showid_min, $showid_max, $errorstring) = RHRD::rddb::get_showid_range($ctx);
+ unless(defined $showid_min) {
+ print STDERR $showid_max . ": " . $errorstring . "\n";
return undef;
}
- if ($show_id < $show_id_min || $show_id > $show_id_max) {
- print STDERR "show-id '" . $show_id . "' is out of range (min: $show_id_min, max: $show_id_max)\n";
+ if ($showid < $showid_min || $showid > $showid_max) {
+ print STDERR "show-id '" . $showid . "' is out of range (min: $showid_min, max: $showid_max)\n";
return undef;
}
- (my $exists, my $status, $errorstring) = RHRD::rddb::check_show_exists($ctx, $show_id);
+ (my $exists, my $status, $errorstring) = RHRD::rddb::check_show_exists($ctx, $showid);
unless(defined $exists) {
print STDERR $status . ": " . $errorstring . "\n";
return undef;
}
if($exists != 1) {
- print STDERR "show with id '" . $show_id . "' does not exist!\n";
+ print STDERR "show with id '" . $showid . "' does not exist!\n";
return undef;
}
- (my $title, undef, $status, $errorstring) = RHRD::rddb::get_show_title_and_log($ctx, $show_id);
+ (my $title, undef, $status, $errorstring) = RHRD::rddb::get_show_title_and_log($ctx, $showid);
unless(defined $title) {
print STDERR $status . ": " . $errorstring . "\n";
return undef;
}
- $shows{$week} = $show_id;
+ $shows{$week} = $showid;
- print " - W$week: ($show_id) $title\n";
+ print " - W$week: ($showid) $title\n";
}
return \%shows;