summaryrefslogtreecommitdiff
path: root/rhimport
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-07-23 16:56:31 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-07-23 16:56:31 (GMT)
commitd9df4264e66e6091538ab24c41fad20131526460 (patch)
treedc09937184619221e13e279ae0e9906be93ee370 /rhimport
parentec10a98e49866edf037443504f892cd578d28038 (diff)
fetch dropboxes and listing allowed shows works now
Diffstat (limited to 'rhimport')
-rwxr-xr-xrhimport26
1 files changed, 18 insertions, 8 deletions
diff --git a/rhimport b/rhimport
index 3a29733..ba40b9a 100755
--- a/rhimport
+++ b/rhimport
@@ -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;