diff options
Diffstat (limited to 'utils/rhrd-schedules')
-rwxr-xr-x | utils/rhrd-schedules | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/utils/rhrd-schedules b/utils/rhrd-schedules index fbd8227..1bd3776 100755 --- a/utils/rhrd-schedules +++ b/utils/rhrd-schedules @@ -30,7 +30,7 @@ use DateTime::Format::Strptime; sub print_usage { - print STDERR "Usage: rhrd-schedules generate YYYY-MM-DD\n" . + print STDERR "Usage: rhrd-schedules (generate|get) YYYY-MM-DD\n" . " rhrd-schedules show (W1|W2|W3|W4|ALL) (MO|TU|WE|TH|FR|SA|SU|ALL)\n" . " rhrd-schedules orphans\n"; } @@ -90,6 +90,22 @@ sub generate return $errcnt; } +sub get +{ + my ($ctx, $year, $month, $day) = @_; + + my @shows = RHRD::rddb::get_schedule_log($ctx, $year, $month, $day); + if(!defined $shows[0] && defined $shows[1]) { + print STDERR "$shows[1]: $shows[2]\n"; + return 1; + } + for my $href (@shows) { + print $href->{'START'} . ": " . $href->{'ID'} . " | " . $href->{'TITLE'} . " (" . $href->{'LEN'} . " ms)\n"; + } + + return 0; +} + sub show__day { my ($ctx, $year, $month, $day) = @_; @@ -327,6 +343,13 @@ if(defined $ctx) { print_usage(); $ret = 1; } + } if($cmd eq "get") { + if($num_args == 2 && $ARGV[1] =~ m/^(\d{4})-(\d{2})-(\d{2})$/) { + $ret = get($ctx, $1, $2, $3); + } else { + print_usage(); + $ret = 1; + } } elsif($cmd eq "show") { if($num_args != 3) { print_usage(); |