diff options
author | Christian Pointner <equinox@spreadspace.org> | 2015-09-27 03:16:04 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2015-09-27 03:16:04 (GMT) |
commit | 222541ee6348f21a0b8107bebb3701422614ba88 (patch) | |
tree | 7329a6df0424df69b38ad8e570cb93ff754b7005 /test | |
parent | b8b6d19d27ba5847ef9d93cd1d13f724a850b020 (diff) |
get_dropboxes can now look optionally look for a specific group
Diffstat (limited to 'test')
-rwxr-xr-x | test/get-dropboxes | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/test/get-dropboxes b/test/get-dropboxes new file mode 100755 index 0000000..6282a92 --- /dev/null +++ b/test/get-dropboxes @@ -0,0 +1,73 @@ +#!/usr/bin/perl -w +# +# rhrdlibs +# +# Copyright (C) 2015 Christian Pointner <equinox@helsinki.at> +# +# This file is part of rhrdlibs. +# +# rhrdlibs is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# any later version. +# +# rhrdlibs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with rhrdlibs. If not, see <http://www.gnu.org/licenses/>. +# + +use strict; +use lib "../lib/"; + +use POSIX; +use RHRD::rddb; + + +my $username = $ARGV[0]; +my $groupname = $ARGV[1]; + +my @dropboxes = (); +my ($dbh, $status, $errorstring) = RHRD::rddb::opendb(); +if(defined $dbh) { + @dropboxes = RHRD::rddb::get_dropboxes($dbh, $username, $groupname); + if(!defined $dropboxes[0] && defined $dropboxes[1]) { + print STDERR "$dropboxes[1]: $dropboxes[2]"; + RHRD::rddb::closedb($dbh); + exit 1; + } + RHRD::rddb::closedb($dbh); +} else { + print STDERR "$errorstring\n"; + exit 1; +} + + +print "Dropboxes:\n"; +for my $href (@dropboxes) { + print " * group:" . $href->{'GROUP'} . "\n"; + print " group-description:" . $href->{'GROUPDESC'} . "\n"; + print " group-low-cart:" . $href->{'GROUPLOWCART'} . "\n"; + print " group-high-cart:" . $href->{'GROUPHIGHCART'} . "\n"; + print " normalization-level:" . floor($href->{'NORMLEVEL'}/100) . "\n"; + print " autotrim-level:" . floor($href->{'TRIMLEVEL'}/100) . "\n"; + print " parameters:" . $href->{'PARAM'} . "\n"; + print " type:" . $href->{'TYPE'} . "\n"; + if($href->{'TYPE'} eq "show") { + print " show-id:" . $href->{'SHOWID'} . "\n"; + print " show-title:" . $href->{'SHOWTITLE'} . "\n"; + print " show-log:" . $href->{'SHOWLOG'} . "\n"; + print " show-rhythm:" . $href->{'SHOWRHYTHM'} . "\n"; + print " show-dayofweek:" . $href->{'SHOWDOW'} . "\n"; + print " show-starttime:" . $href->{'SHOWSTARTTIME'} . "\n"; + print " show-length:" . $href->{'SHOWLEN'} . "\n"; + } elsif($href->{'TYPE'} eq "jingle") { + print " jingle-title:" . $href->{'JINGLETITLE'} . "\n"; + } elsif($href->{'TYPE'} eq "musicpool") { + print " musicpool-title:" . $href->{'MUSICPOOLTITLE'} . "\n"; + } + print "\n"; +} |