summaryrefslogtreecommitdiff
path: root/test/get-dropboxes
blob: 89a4935d058ff8db073538b373da7f02aeb307f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/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 POSIX;
use lib "../lib/";
use RHRD::rddb;


my $username = $ARGV[0];
my $groupname = $ARGV[1];
$groupname = undef if (defined($groupname) && $groupname eq '');
my $type = $ARGV[2];


my @dropboxes = ();
my ($ctx, $status, $errorstring) = RHRD::rddb::init();
if(defined $ctx) {
  @dropboxes = RHRD::rddb::get_dropboxes($ctx, $username, $groupname, $type);
  if(!defined $dropboxes[0] && defined $dropboxes[1]) {
    print STDERR "$dropboxes[1]: $dropboxes[2]";
    RHRD::rddb::destroy($ctx);
    exit 1;
  }
  RHRD::rddb::destroy($ctx);
} 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";
}