diff options
Diffstat (limited to 'rhimport')
-rwxr-xr-x | rhimport | 26 |
1 files changed, 18 insertions, 8 deletions
@@ -32,10 +32,6 @@ my $FILE = ""; my $DROPBOX = ""; my $LISTALLOWED = 0; -binmode(STDIN, ":utf8"); -binmode(STDOUT, ":utf8"); -binmode(STDERR, ":utf8"); - GetOptions ("help!" => \$HELP, "file=s" => \$FILE, "dropbox=s" => \$DROPBOX, @@ -48,8 +44,8 @@ usage: $0 --file <audio file> --dropbox <path to dropbox> --list-allowed options: -f | --file the media file or playlist to import - -d | --dropbox the path to the dropbox to use - -l | --list-allowed list allowed dropboxes and exit + -i | --id the show id to import to + -l | --list-allowed list allowed shows and exit EOF exit 0; @@ -57,17 +53,31 @@ EOF my $user = `/usr/bin/id -un`; $user =~ s/\n//; +$user = 'heslinki'; my ($dbh, $errorstring) = rhimport::opendb(); if(!defined $dbh) { print "$errorstring\n"; exit 1; } -my @allowed_dbs = rhimport::get_dropboxes($dbh, $user); +(my @allowed_dbs, $errorstring) = rhimport::get_dropboxes($dbh, $user); +unless(defined $allowed_dbs[0]) { + print "$allowed_dbs[1]\n"; + exit 1; +} if($LISTALLOWED) { + print "| id | Title\n"; + print "+-------+-------------------------------------------------------------------\n"; for my $href ( @allowed_dbs ) { - print "$href->{'NAME'} \t-> $href->{'PATH'}\n" unless $href->{'NAME'} =~ /^autoimport/; + if($href->{'TYPE'} eq 'show') { + my @show_carts = rhimport::get_show_carts($dbh, $href->{'SHOWLOG'}, $href->{'GROUPLOWCART'}, $href->{'GROUPHIGHCART'}); + unless(defined $show_carts[0]) { + print "$show_carts[1]\n"; + exit 1; + } + print "| $href->{'SHOWID'} | $href->{'SHOWTITLE'}, Carts: [" . join(', ', @show_carts) . "]\n"; + } } rhimport::closedb($dbh); exit 0; |