1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-05 10:49:37 +02:00

Fix album batch download. Fix browse catalog (bug with mediaTable). Update some syntax on batch.

This commit is contained in:
SUTJael 2014-03-26 21:58:15 +01:00
parent 8e604cac5b
commit dd63f44c93
4 changed files with 81 additions and 61 deletions

View file

@ -62,7 +62,7 @@ function get_song_files($media_ids)
* @param string $name name of the zip file to be created
* @param string $song_files array of full paths to songs to zip create w/ call to get_song_files
*/
function send_zip( $name, $song_files )
function send_zip($name, $song_files)
{
// Check if they want to save it to a file, if so then make sure they've
// got a defined path as well and that it's writable.
@ -75,37 +75,37 @@ function send_zip( $name, $song_files )
$in_memory = '0';
$basedir = AmpConfig::get('tmp_dir_path');
}
} else {
$in_memory = '1';
} // if file downloads
/* Require needed library */
require_once AmpConfig::get('prefix') . '/modules/archive/archive.lib.php';
$arc = new zip_file( $name . ".zip" );
$options = array(
'inmemory' => $in_memory, // create archive in memory
'basedir' => $basedir,
'storepaths' => 0, // only store file name, not full path
'level' => 0, // no compression
'comment' => AmpConfig::get('file_zip_comment')
);
require_once AmpConfig::get('prefix') . '/modules/archive/archive.lib.php';
$arc = new zip_file($name . ".zip" );
$options = array(
'inmemory' => $in_memory, // create archive in memory
'basedir' => $basedir,
'storepaths' => 0, // only store file name, not full path
'level' => 0, // no compression
'comment' => AmpConfig::get('file_zip_comment'),
'type' => "zip"
);
$arc->set_options( $options );
foreach ($song_files as $dir => $files) {
$arc->add_files( $files, $dir );
}
$arc->set_options( $options );
foreach ($song_files as $dir => $files) {
$arc->add_files($files, $dir);
}
if (count($arc->error)) {
debug_event('archive',"Error: unable to add songs",'3');
return false;
} // if failed to add songs
if (!$arc->create_archive()) {
if (!$arc->create_archive()) {
debug_event('archive',"Error: unable to create archive",'3');
return false;
} // if failed to create archive
$arc->download_file();
$arc->download_file();
} // send_zip