mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-05 19:41:55 +02:00
Fix album batch download. Fix browse catalog (bug with mediaTable). Update some syntax on batch.
This commit is contained in:
parent
8e604cac5b
commit
dd63f44c93
4 changed files with 81 additions and 61 deletions
|
@ -75,7 +75,6 @@ function send_zip( $name, $song_files )
|
|||
$in_memory = '0';
|
||||
$basedir = AmpConfig::get('tmp_dir_path');
|
||||
}
|
||||
|
||||
} else {
|
||||
$in_memory = '1';
|
||||
} // if file downloads
|
||||
|
@ -88,7 +87,8 @@ function send_zip( $name, $song_files )
|
|||
'basedir' => $basedir,
|
||||
'storepaths' => 0, // only store file name, not full path
|
||||
'level' => 0, // no compression
|
||||
'comment' => AmpConfig::get('file_zip_comment')
|
||||
'comment' => AmpConfig::get('file_zip_comment'),
|
||||
'type' => "zip"
|
||||
);
|
||||
|
||||
$arc->set_options( $options );
|
||||
|
|
|
@ -44,8 +44,11 @@ class archive {
|
|||
|
||||
public function set_options($options) {
|
||||
|
||||
foreach ($options as $key => $value)
|
||||
foreach ($options as $key => $value) {
|
||||
$this->options[$key] = $value;
|
||||
debug_event("archive.lib.php", "Setting option ".$key."[".$value."]...", "5");
|
||||
}
|
||||
|
||||
if (!empty ($this->options['basedir']))
|
||||
{
|
||||
$this->options['basedir'] = str_replace("\\", "/", $this->options['basedir']);
|
||||
|
@ -92,8 +95,9 @@ class archive {
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
$this->archive = "";
|
||||
}
|
||||
|
||||
switch ($this->options['type'])
|
||||
{
|
||||
|
@ -139,8 +143,9 @@ class archive {
|
|||
if ($this->options['inmemory'] == 0)
|
||||
{
|
||||
fclose($this->archive);
|
||||
if ($this->options['type'] == "gzip" || $this->options['type'] == "bzip")
|
||||
if ($this->options['type'] == "gzip" || $this->options['type'] == "bzip") {
|
||||
unlink($this->options['basedir'] . "/" . $this->options['tmpname'] . ".tmp");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -217,34 +222,39 @@ class archive {
|
|||
|
||||
foreach ($list as $current)
|
||||
{
|
||||
debug_event("archive.lib.php", "Listing file {".$current."}...", "5");
|
||||
|
||||
$current = str_replace("\\", "/", $current);
|
||||
$current = preg_replace("/\/+/", "/", $current);
|
||||
$current = preg_replace("/\/$/", "", $current);
|
||||
if (substr($current, 0, 1) == "/" ) { $current = "/" . $current; }
|
||||
if (strstr($current, "*"))
|
||||
{
|
||||
if (strstr($current, "*")) {
|
||||
$regex = preg_replace("/([\\\^\$\.\[\]\|\(\)\?\+\{\}\/])/", "\\\\\\1", $current);
|
||||
$regex = str_replace("*", ".*", $regex);
|
||||
$dir = strstr($current, "/") ? substr($current, 0, strrpos($current, "/")) : ".";
|
||||
$temp = $this->parse_dir($dir);
|
||||
foreach ($temp as $current2)
|
||||
if (preg_match("/^{$regex}$/i", $current2['name']))
|
||||
foreach ($temp as $current2) {
|
||||
if (preg_match("/^{$regex}$/i", $current2['name'])) {
|
||||
$files[] = $current2;
|
||||
}
|
||||
}
|
||||
unset ($regex, $dir, $temp, $current);
|
||||
}
|
||||
else if (@is_dir($current))
|
||||
{
|
||||
else if (@is_dir($current)) {
|
||||
$temp = $this->parse_dir($current);
|
||||
foreach ($temp as $file)
|
||||
foreach ($temp as $file) {
|
||||
$files[] = $file;
|
||||
}
|
||||
unset ($temp, $file);
|
||||
}
|
||||
else if (@file_exists($current))
|
||||
$files[] = array ('name' => $current, 'name2' => $this->options['prepend'] .
|
||||
preg_replace("/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr($current, "/")) ?
|
||||
substr($current, strrpos($current, "/") + 1) : $current),
|
||||
else if (@file_exists($current)) {
|
||||
$files[] = array ('name' => $current,
|
||||
'name2' => $this->options['prepend'] . preg_replace("/(\.+\/+)+/",
|
||||
"",
|
||||
($this->options['storepaths'] == 0 && strstr($current, "/")) ? substr($current, strrpos($current, "/") + 1) : $current),
|
||||
'type' => @is_link($current) && $this->options['followlinks'] == 0 ? 2 : 0,
|
||||
'ext' => substr($current, strrpos($current, ".")), 'stat' => stat($current));
|
||||
}
|
||||
}
|
||||
|
||||
chdir($pwd);
|
||||
|
@ -256,33 +266,37 @@ class archive {
|
|||
|
||||
function parse_dir($dirname)
|
||||
{
|
||||
if ($this->options['storepaths'] == 1 && !preg_match("/^(\.+\/*)+$/", $dirname))
|
||||
if ($this->options['storepaths'] == 1 && !preg_match("/^(\.+\/*)+$/", $dirname)) {
|
||||
$files = array (array ('name' => $dirname, 'name2' => $this->options['prepend'] .
|
||||
preg_replace("/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr($dirname, "/")) ?
|
||||
substr($dirname, strrpos($dirname, "/") + 1) : $dirname), 'type' => 5, 'stat' => stat($dirname)));
|
||||
else
|
||||
}
|
||||
else {
|
||||
$files = array ();
|
||||
}
|
||||
|
||||
$dir = @opendir($dirname);
|
||||
|
||||
while ($file = @readdir($dir))
|
||||
{
|
||||
$fullname = $dirname . "/" . $file;
|
||||
if ($file == "." || $file == "..")
|
||||
if ($file == "." || $file == "..") {
|
||||
continue;
|
||||
else if (@is_dir($fullname))
|
||||
{
|
||||
}
|
||||
else if (@is_dir($fullname)) {
|
||||
if (empty ($this->options['recurse']))
|
||||
continue;
|
||||
$temp = $this->parse_dir($fullname);
|
||||
foreach ($temp as $file2)
|
||||
$files[] = $file2;
|
||||
}
|
||||
else if (@file_exists($fullname))
|
||||
else if (@file_exists($fullname)) {
|
||||
$files[] = array ('name' => $fullname, 'name2' => $this->options['prepend'] .
|
||||
preg_replace("/(\.+\/+)+/", "", ($this->options['storepaths'] == 0 && strstr($fullname, "/")) ?
|
||||
substr($fullname, strrpos($fullname, "/") + 1) : $fullname),
|
||||
'type' => @is_link($fullname) && $this->options['followlinks'] == 0 ? 2 : 0,
|
||||
'ext' => substr($file, strrpos($file, ".")), 'stat' => stat($fullname));
|
||||
}
|
||||
}
|
||||
|
||||
@closedir($dir);
|
||||
|
@ -617,14 +631,19 @@ class zip_file extends archive
|
|||
$offset += strlen($temp);
|
||||
unset ($temp);
|
||||
}
|
||||
else
|
||||
else {
|
||||
$this->error[] = "Could not open sfx module from {$this->options['sfx']}.";
|
||||
}
|
||||
|
||||
$pwd = getcwd();
|
||||
chdir($this->options['basedir']);
|
||||
|
||||
foreach ($this->files as $current)
|
||||
{
|
||||
foreach ($current as $key => $value) {
|
||||
debug_event("archive.lib.php", "Processing ".$key."[".$value."]...", "5");
|
||||
}
|
||||
|
||||
if ($current['name'] == $this->options['name'])
|
||||
continue;
|
||||
|
||||
|
@ -683,8 +702,9 @@ class zip_file extends archive
|
|||
$files++;
|
||||
$offset += (30 + strlen($current['name2']) + $size);
|
||||
}
|
||||
else
|
||||
else {
|
||||
$this->error[] = "Could not open file {$current['name']} for reading. It was not added.";
|
||||
}
|
||||
}
|
||||
|
||||
$this->add_data($central);
|
||||
|
|
|
@ -99,13 +99,13 @@ if (AmpConfig::get('show_played_times')) {
|
|||
</li>
|
||||
<?php if (Access::check('interface','75')) { ?>
|
||||
<li>
|
||||
<a href="<?php echo $web_path; ?>/albums.php?action=clear_art&album_id=<?php echo $album->id; ?>" onclick="return confirm('<?php echo T_('Do you really want to reset album art?'); ?>');"><?php echo UI::get_icon('delete', T_('Reset Album Art')); ?></a>
|
||||
<a href="<?php echo $web_path; ?>/albums.php?action=clear_art&album_id=<?php echo $album->id; ?>" onclick="return confirm('<?php echo T_('Do you really want to reset album art?'); ?>');"><?php echo T_('Reset Album Art'); ?></a>
|
||||
<a href="<?php echo $web_path; ?>/albums.php?action=clear_art&album_id=<?php echo $album->id; ?>" onclick="return confirm('<?php echo T_('Do you really want to reset album art?'); ?>');"><?php echo UI::get_icon('delete', T_('Reset Album Art')); ?></a>
|
||||
<a href="<?php echo $web_path; ?>/albums.php?action=clear_art&album_id=<?php echo $album->id; ?>" onclick="return confirm('<?php echo T_('Do you really want to reset album art?'); ?>');"><?php echo T_('Reset Album Art'); ?></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<li>
|
||||
<a href="<?php echo $web_path; ?>/albums.php?action=find_art&album_id=<?php echo $album->id; ?>"><?php echo UI::get_icon('view', T_('Find Album Art')); ?></a>
|
||||
<a href="<?php echo $web_path; ?>/albums.php?action=find_art&album_id=<?php echo $album->id; ?>"><?php echo T_('Find Album Art'); ?></a>
|
||||
<a href="<?php echo $web_path; ?>/albums.php?action=find_art&album_id=<?php echo $album->id; ?>"><?php echo UI::get_icon('view', T_('Find Album Art')); ?></a>
|
||||
<a href="<?php echo $web_path; ?>/albums.php?action=find_art&album_id=<?php echo $album->id; ?>"><?php echo T_('Find Album Art'); ?></a>
|
||||
</li>
|
||||
<!--<?php if ((Access::check('interface','50'))) { ?>
|
||||
<li>
|
||||
|
@ -135,8 +135,8 @@ if (AmpConfig::get('show_played_times')) {
|
|||
<?php } ?>
|
||||
<?php if (Access::check_function('batch_download')) { ?>
|
||||
<li>
|
||||
<a href="<?php echo $web_path; ?>/batch.php?action=album&id=<?php echo $album->id; ?>"><?php echo UI::get_icon('batch_download', T_('Download')); ?></a>
|
||||
<a href="<?php echo $web_path; ?>/batch.php?action=album&id=<?php echo $album->id; ?>"><?php echo T_('Download'); ?></a>
|
||||
<a href="<?php echo $web_path; ?>/batch.php?action=album&<?php echo $album->get_http_album_query_ids('id'); ?>"><?php echo UI::get_icon('batch_download', T_('Download')); ?></a>
|
||||
<a href="<?php echo $web_path; ?>/batch.php?action=album&<?php echo $album->get_http_album_query_ids('id'); ?>"><?php echo T_('Download'); ?></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
</ul>
|
||||
<br/>
|
||||
<form method="post" action="<?php echo AmpConfig::get('web_path'); ?>/admin/catalog.php?action=update_from">
|
||||
<table class="tabledata" cellspacing="0" cellpadding="0">
|
||||
<table class="tabledata2" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><?php /* HINT: /data/myNewMusic */ ?><?php printf (T_('Add from [%s]'), '<span class="information">/data/myNewMusic</span>'); ?></td>
|
||||
<td><input type="text" name="add_path" value="/" /></td>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue