summaryrefslogtreecommitdiff
path: root/rhimport.pl
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2010-02-17 15:30:48 (GMT)
committerChristian Pointner <equinox@helsinki.at>2010-02-17 15:30:48 (GMT)
commitaed8761dd9b9f00cecf1655be88e3eb6ff29359e (patch)
treefba2ec38d28b1dabf8fe066c0de38ad85595a1bb /rhimport.pl
parent145bb3eaaf4ec22c044548fc9789140f890419a1 (diff)
get list of allowed dropboxes
git-svn-id: https://svn.helsinki.at/rhimport/trunk@2 7c65635b-ec39-4f67-a626-873dbafdd612
Diffstat (limited to 'rhimport.pl')
-rwxr-xr-xrhimport.pl59
1 files changed, 59 insertions, 0 deletions
diff --git a/rhimport.pl b/rhimport.pl
new file mode 100755
index 0000000..a8b1c0a
--- /dev/null
+++ b/rhimport.pl
@@ -0,0 +1,59 @@
+#!/usr/bin/perl -w
+#
+#
+
+use strict;
+
+use Getopt::Long;
+use DBI;
+
+my $DBHOST = "airplay";
+my $DBUSER = "rivendellro";
+my $DBPW = "lldrivenro";
+my $DB = "rivendell";
+my $HELP = 0;
+my $M3U = "";
+my $DONTCONCAT = 0;
+
+GetOptions ("help!" => \$HELP,
+ "m3u=s" => \$M3U,
+ "dont-concat!" => \$DONTCONCAT,
+ );
+
+if($HELP || !$M3U) {
+ print << "EOF";
+usage: $0 --m3u <playlist file> --dont-concat
+
+options:
+ --m3u the playlist file to import
+ --dont-concat dont concat the audio files, import as seperate files
+
+EOF
+ exit;
+}
+
+(-e "$M3U") or die "file '$M3U' not found";
+
+my $user = $ENV{'USER'};
+
+$user or die "Username not found in environment";
+
+print "Will import $M3U, with user $user\n";
+
+
+my $dbh = DBI->connect( "DBI:mysql:$DB:$DBHOST","$DBUSER","$DBPW") or die "Database Error: $DBI::errstr";
+
+my $sql = qq{select USER_PERMS.GROUP_NAME,DROPBOXES.PATH from USER_PERMS, DROPBOXES where USER_PERMS.USER_NAME='$user' and DROPBOXES.GROUP_NAME=USER_PERMS.GROUP_NAME;};
+
+my $sth = $dbh->prepare($sql);
+$sth->execute();
+my $cur_start_time = "out of order";
+my $cart_cnt = 0;
+while(my ($group, $path) = $sth->fetchrow_array()) {
+ $path =~ s/\/\*$//;
+
+ print "GROUP: $group, PATH: $path\n"
+}
+
+$sth->finish();
+$dbh->disconnect();