summaryrefslogtreecommitdiffstats
path: root/playlist.php
diff options
context:
space:
mode:
authorPaul Arthur <paul.arthur@flowerysong.com>2012-09-21 10:48:37 -0400
committerPaul Arthur <paul.arthur@flowerysong.com>2012-09-21 10:52:47 -0400
commita24b711143080d3819034e831aaed6c44cb5b9b0 (patch)
treefdf0f16400ebeb7d2abdf1c51f2a9cb182415334 /playlist.php
parentc9dab7bf4e63ae29d40e6252c3e4fbf810f34315 (diff)
downloadampache-a24b711143080d3819034e831aaed6c44cb5b9b0.tar.gz
ampache-a24b711143080d3819034e831aaed6c44cb5b9b0.tar.bz2
ampache-a24b711143080d3819034e831aaed6c44cb5b9b0.zip
Some cleanup of the playlist import code
Global variables are ugly and unnecessary.
Diffstat (limited to 'playlist.php')
-rw-r--r--playlist.php24
1 files changed, 15 insertions, 9 deletions
diff --git a/playlist.php b/playlist.php
index c15918b8..990f96bf 100644
--- a/playlist.php
+++ b/playlist.php
@@ -103,18 +103,24 @@ switch ($_REQUEST['action']) {
$catalog = new Catalog();
$result = $catalog->import_m3u($filename);
- if($result == false) {
- $url = Config::get('web_path') . '/playlist.php?action=show_import_playlist';
- $title = T_('Playlist Not Imported');
- $body = $reason;
- } else {
- $url = Config::get('web_path') . '/playlist.php?action=show_playlist&amp;playlist_id='.$playlist_id;
+ if($result['success']) {
+ $url = 'show_playlist&amp;playlist_id=' . $result['id'];
$title = T_('Playlist Imported');
$body = basename($_FILES['filename']['name']);
- $body .= "<br />";
- $body .= $reason;
+ $body .= '<br />' .
+ sprintf(
+ T_ngettext(
+ 'Successfully imported playlist with %d song.',
+ 'Successfully imported playlist with %d songs.',
+ $result['count']),
+ $result['count']);
}
- show_confirmation($title,$body,$url);
+ else {
+ $url = 'show_import_playlist';
+ $title = T_('Playlist Not Imported');
+ $body = T_($result['error']);
+ }
+ show_confirmation($title, $body, Config::get('web_path') . '/playlist.php?action=' . $url);
break;
case 'set_track_numbers':
/* Make sure they have permission */