diff options
author | Christian Pointner <equinox@helsinki.at> | 2010-04-29 11:36:49 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2010-04-29 11:36:49 (GMT) |
commit | db51fc7641c5c3c7055df8424a85e8c55dceb7cd (patch) | |
tree | 29069223ab0fd0fdb1c920cffad4dbad165c5f2a | |
parent | a0d9b3061f1f59fff3403819b991d865aa79e59a (diff) |
check for Deleted stanza in rdimport output
ignore non-existent or unreadable files in m3u
ignore directories in m3u
-rw-r--r-- | TODO | 5 | ||||
-rw-r--r-- | rhimport.pm | 14 |
2 files changed, 15 insertions, 4 deletions
@@ -1,4 +1,5 @@ -* check last line of rdimport output (Deleted <filename>) * multi-cart-show - upload a single file.. +* multi-cart/pool - check size of pool vs length of m3u * add "show log" button after import -* m3u file ignore directories (files only)
\ No newline at end of file + + diff --git a/rhimport.pm b/rhimport.pm index b9a430a..6597fb4 100644 --- a/rhimport.pm +++ b/rhimport.pm @@ -159,12 +159,16 @@ sub import_playlist next if($entry =~ /^#/); next if($entry =~ /^\s/); $entry =~ s/\n$//; + next if(-d $entry); + next if(!-r $entry); push @entries, $entry; } close(FILE); my $num_entries = scalar(@entries); print " ($num_entries Files in list)\n"; + + return (0, ""); my $cnt = 0; my $ret = 0; my $log = ""; @@ -268,11 +272,17 @@ sub import_file my ($volume, $directories, $remote_file) = File::Spec->splitpath($file); $remote_file = "$ssh_dir/$user/$remote_file"; my ($out ,$error) = ssh_exec_command("$rdimport_wrapper --path \"$dropbox\" --file \"$remote_file\""); - if($error ne "") { + my $lastline = $1 if $out =~ /\n(.*)$/; + if($error ne "" || $lastline !~ /^[0-9:\- ]+:\s+Deleted file/) { print "Import Error\n"; delete_file($remote_file); if($error_cb) { - return $error_cb->("Import Fehler: $error"); + if($error) { + return $error_cb->("Import Fehler: $error"); + } + else { + return $error_cb->("Import Fehler: \n$out"); + } } return 0; } |