summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2009-03-07 19:44:00 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2009-03-07 19:44:00 +0000
commit059f6d4d5cde3a66b3c1a998ce123e7eb88e7a98 (patch)
tree0f5cd4d5d651b15225bccab6a607662f6be5a165
parent6ff7d498cf43c7f9453bcef495ca137da298ccf0 (diff)
downloadampache-059f6d4d5cde3a66b3c1a998ce123e7eb88e7a98.tar.gz
ampache-059f6d4d5cde3a66b3c1a998ce123e7eb88e7a98.tar.bz2
ampache-059f6d4d5cde3a66b3c1a998ce123e7eb88e7a98.zip
fix download and batch download Addresses #408 and #407
-rw-r--r--batch.php21
-rw-r--r--config/ampache.cfg.php.dist4
-rwxr-xr-xdocs/CHANGELOG1
-rw-r--r--lib/batch.lib.php28
-rw-r--r--lib/class/preference.class.php3
-rw-r--r--lib/class/stream.class.php3
-rw-r--r--lib/class/video.class.php1
7 files changed, 30 insertions, 31 deletions
diff --git a/batch.php b/batch.php
index 4555f27e..461491ff 100644
--- a/batch.php
+++ b/batch.php
@@ -33,39 +33,32 @@ set_time_limit(0);
switch ($_REQUEST['action']) {
case 'tmp_playlist':
- $tmpPlaylist = new tmpPlaylist($_REQUEST['id']);
- $data = $tmpPlaylist->get_items();
-
- // We have to translate these :(
- foreach ($data as $row) {
- $song_ids[] = $row['0'];
- }
-
+ $media_ids = $GLOBALS['user']->playlist->get_items();
$name = $GLOBALS['user']->username . ' - Playlist';
break;
case 'playlist':
$playlist = new Playlist($_REQUEST['id']);
- $song_ids = $playlist->get_songs();
+ $media_ids = $playlist->get_songs();
$name = $playlist->name;
break;
case 'album':
$album = new Album($_REQUEST['id']);
- $song_ids = $album->get_songs();
+ $media_ids = $album->get_songs();
$name = $album->name;
break;
case 'artist':
$artist = new Artist($_REQUEST['id']);
- $song_ids = $artist->get_songs();
+ $media_ids = $artist->get_songs();
$name = $artist->name;
break;
case 'genre':
$id = scrub_in($_REQUEST['id']);
$genre = new Genre($id);
- $song_ids = $genre->get_songs();
+ $media_ids = $genre->get_songs();
$name = $genre->name;
break;
case 'browse':
- $song_ids = Browse::get_saved();
+ $media_ids = Browse::get_saved();
$name = 'Batch-' . date("dmY",time());
default:
// Rien a faire
@@ -73,7 +66,7 @@ switch ($_REQUEST['action']) {
} // action switch
// Take whatever we've got and send the zip
-$song_files = get_song_files($song_ids);
+$song_files = get_song_files($media_ids);
set_memory_limit($song_files['1']+32);
send_zip($name,$song_files['0']);
diff --git a/config/ampache.cfg.php.dist b/config/ampache.cfg.php.dist
index e5f61472..873e82d1 100644
--- a/config/ampache.cfg.php.dist
+++ b/config/ampache.cfg.php.dist
@@ -97,8 +97,8 @@ catalog_file_pattern = "mp3|mpc|m4p|m4a|mp4|aac|ogg|rm|wma|asf|flac|spx|ra|ape|s
; This defines which video file types Ampache will attempt to catalog
; You can specify any file extension you want in here seperating them with
; a | but ampache may not be able to parse them
-; DEAFULT: avi|mpg
-catalog_video_pattern = "avi|mpg"
+; DEAFULT: avi|mpg|flv|m4v
+catalog_video_pattern = "avi|mpg|flv|m4v"
; Prefix Pattern
; This defines which prefix Ampache will ignore when importing tags from
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index 25c6a473..f5febe26 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,7 @@
--------------------------------------------------------------------------
v.3-5-Alpha2
+ - Fix Version checking and Version Error Message on install (Thx Paleo)
- Moved Statistics to main menu, split out newest/popular/stats
- Fixed bug where saved Thumbnails were almost never used
- Fixed Localplay HTTPQ and MPD controls to reconize Live Stream
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
diff --git a/lib/class/preference.class.php b/lib/class/preference.class.php
index 3bd87b0b..370655c1 100644
--- a/lib/class/preference.class.php
+++ b/lib/class/preference.class.php
@@ -394,14 +394,13 @@ class Preference {
return true;
}
-
$user_id = $GLOBALS['user']->id ? Dba::escape($GLOBALS['user']->id) : '-1';
/* Get Global Preferences */
$sql = "SELECT `preference`.`name`,`user_preference`.`value`,`syspref`.`value` AS `system_value` FROM `preference` " .
"LEFT JOIN `user_preference` `syspref` ON `syspref`.`preference`=`preference`.`id` AND `syspref`.`user`='-1' AND `preference`.`catagory`='system' " .
"LEFT JOIN `user_preference` ON `user_preference`.`preference`=`preference`.`id` AND `user_preference`.`user`='$user_id' AND `preference`.`catagory`!='system'";
- $db_results = Dba::query($sql);
+ $db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) {
$value = $row['system_value'] ? $row['system_value'] : $row['value'];
diff --git a/lib/class/stream.class.php b/lib/class/stream.class.php
index b8242832..0c16dd4e 100644
--- a/lib/class/stream.class.php
+++ b/lib/class/stream.class.php
@@ -547,8 +547,7 @@ class Stream {
// Build up our object
$song_id = $this->media['0'];
- $song = new Song($song_id);
- $url = $song->get_url();
+ $url = Song::play_url($song_id);
// Append the fact we are downloading
$url .= '&action=download';
diff --git a/lib/class/video.class.php b/lib/class/video.class.php
index 12894b4b..81e6ba7b 100644
--- a/lib/class/video.class.php
+++ b/lib/class/video.class.php
@@ -23,6 +23,7 @@ class Video extends database_object implements media {
public $id;
public $title;
+ public $enabled;
public $file;
/**