diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2009-03-07 19:44:00 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2009-03-07 19:44:00 +0000 |
commit | 059f6d4d5cde3a66b3c1a998ce123e7eb88e7a98 (patch) | |
tree | 0f5cd4d5d651b15225bccab6a607662f6be5a165 /lib/batch.lib.php | |
parent | 6ff7d498cf43c7f9453bcef495ca137da298ccf0 (diff) | |
download | ampache-059f6d4d5cde3a66b3c1a998ce123e7eb88e7a98.tar.gz ampache-059f6d4d5cde3a66b3c1a998ce123e7eb88e7a98.tar.bz2 ampache-059f6d4d5cde3a66b3c1a998ce123e7eb88e7a98.zip |
fix download and batch download Addresses #408 and #407
Diffstat (limited to 'lib/batch.lib.php')
-rw-r--r-- | lib/batch.lib.php | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/lib/batch.lib.php b/lib/batch.lib.php index a4120110..e2c1d354 100644 --- a/lib/batch.lib.php +++ b/lib/batch.lib.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2007 Ampache.org + Copyright (c) Ampache.org All Rights Reserved This program is free software; you can redistribute it and/or @@ -25,19 +25,25 @@ * tmakes array of song ids and returns * array of path to actual files */ -function get_song_files($song_ids) { +function get_song_files($media_ids) { - $song_files = array(); - foreach ($song_ids as $song_id) { - $song = new Song($song_id); - /* Don't archive disabled songs */ - if ($song->enabled) { - $total_size += sprintf("%.2f",($song->size/1048576)); - array_push($song_files, $song->file); - } // if song isn't disabled + $media_files = array(); + + foreach ($media_ids as $element) { + if (is_array($element)) { + $type = array_shift($element); + $media = new $type(array_shift($element)); + } + else { + $media = new Song($element); + } + if ($media->enabled) { + $total_size += sprintf("%.2f",($media->size/1048576)); + array_push($media_files, $media->file); + } } - return array($song_files,$total_size); + return array($media_files,$total_size); } //get_song_files |