summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-01-14 03:00:05 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-01-14 03:00:05 +0000
commitc19f5121801b2d0d8d922ccb68bfca8162d0df9c (patch)
tree8e940a3ec6af1dea5531d1e21f5a69a1a091ac7c
parent29420520e96437e6738744d96049b6f2a025e623 (diff)
downloadampache-c19f5121801b2d0d8d922ccb68bfca8162d0df9c.tar.gz
ampache-c19f5121801b2d0d8d922ccb68bfca8162d0df9c.tar.bz2
ampache-c19f5121801b2d0d8d922ccb68bfca8162d0df9c.zip
* Added new functions to HttpQ controller
* Fixed Catalog cleaning issues and album art issues * Fixed a minor javascript error with the localplay stuff * Started work on write_playlists.php.inc (https://ampache.bountysource.com/task/show/542)
-rw-r--r--bin/write_playlists.php.inc77
-rwxr-xr-xdocs/CHANGELOG7
-rw-r--r--lib/class/catalog.class.php16
-rw-r--r--modules/httpq/httpqplayer.class.php110
-rw-r--r--modules/localplay/httpq.controller.php54
-rw-r--r--server/ajax.server.php5
6 files changed, 218 insertions, 51 deletions
diff --git a/bin/write_playlists.php.inc b/bin/write_playlists.php.inc
new file mode 100644
index 00000000..40e803ec
--- /dev/null
+++ b/bin/write_playlists.php.inc
@@ -0,0 +1,77 @@
+<?php
+/*
+
+ Copyright 2001 - 2006 Ampache.org
+ All Rights Reserved
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License v2
+ as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+/*
+ * Use with caution, this hasn't been heavily tested!!!
+ * write_tags.php.inc - This file was written in order to give the ability
+ * to write tags changed through the interface back out to the file. This can
+ * be especially important when trying to keep a clean file structure.
+ */
+
+$no_session = '1';
+require ("../lib/init.php");
+
+
+if (!$GLOBALS['argv']['1'] || $GLOBALS['argv']['1'] == '-h') { usage(); }
+else {
+ $dirname = $GLOBALS['argv']['1'];
+ $type = $GLOBALS['argv']['2'];
+}
+
+
+// Make sure the output dir is valid and writeable
+if (!is_writeable($dirname)) {
+ echo "Error: Directory $dirname not writeable\n";
+}
+
+// Switch on the type of playlist dump we want to do
+// here
+switch ($type) {
+ case 'playlists':
+
+
+ break;
+ case 'artist':
+
+ break;
+ default:
+
+
+
+ break;
+} // end type switch
+
+/* FUNCTIONS */
+function usage() {
+
+$string = "write_playlists.php.inc [-h] <DIRNAME> <TYPE>
+
+ This will dump a collection of m3u playlists based on type
+ Types:
+ default Dumps all Albums as individual playlists
+ playlists Dumps all of your Playlists as m3u's
+ artist Dumps all Artists as individual playlists\n\n";
+
+ exit($string);
+
+} // useage
+
+?>
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index f72b6fea..1f8ee4c4 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,13 @@
--------------------------------------------------------------------------
v.3.3.3
+ - Fixed some minor catalog cleaning issues that could arrise due
+ to the order of the clean functions
+ - Added missing functions to the HttpQ controller, should now have
+ all capabilities that MPD has.
+ - Fixed minor ajax issue with localplay buttons
+ - Fixed issue with Add to Catalogs always searching for all
+ album art making it really slow
- Fixed typo in session management that prevented setting of
secure_cookie option (used default value)
- Added ability to e-mail flagged/disabled reports in mail
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php
index 9131aac5..30ea758c 100644
--- a/lib/class/catalog.class.php
+++ b/lib/class/catalog.class.php
@@ -970,7 +970,10 @@ class Catalog {
/* Do a little stats mojo here */
$current_time = time();
-
+
+ /* Disabling for now need to re-work the logic on this
+ * but I don't want to do that right before a stable, does not
+ * search at all, this is less then perfect, but hey :(
if ($type != 'fast_add') {
if ($verbose) {
echo "\n<b>" . _('Starting Album Art Search') . ". . .</b><br />\n";
@@ -979,6 +982,7 @@ class Catalog {
}
$this->get_album_art();
}
+ */
/* Update the Catalog last_update */
$this->update_last_add();
@@ -1167,10 +1171,11 @@ class Catalog {
// now delete invalid entries
$this->clean_albums();
- $this->clean_stats();
$this->clean_artists();
$this->clean_genres();
$this->clean_flagged();
+ $this->clean_stats();
+ $this->clean_ext_info();
} // update_remote_catalog
@@ -1552,8 +1557,10 @@ class Catalog {
/* After we have updated all the songs with the new information clear any empty albums/artists */
$this->clean_albums();
$this->clean_artists();
- $this->clean_stats();
+ $this->clean_genres();
$this->clean_flagged();
+ $this->clean_stats();
+ $this->clean_ext_info();
// Update the last_update
$this->update_last_update();
@@ -2139,10 +2146,11 @@ class Catalog {
// Run the Aritst/Album Cleaners...
$this->clean_albums();
$this->clean_artists();
- $this->clean_stats();
$this->clean_playlists();
$this->clean_flagged();
$this->clean_genres();
+ $this->clean_stats();
+ $this->clean_ext_info();
} // delete_catalog
diff --git a/modules/httpq/httpqplayer.class.php b/modules/httpq/httpqplayer.class.php
index 82685a51..094626bc 100644
--- a/modules/httpq/httpqplayer.class.php
+++ b/modules/httpq/httpqplayer.class.php
@@ -97,23 +97,50 @@ class HttpQPlayer {
} // clear
- /*!
- @function next
- @discussion go to next song
+ /**
+ * next
+ * go to next song
*/
function next() {
+
$args = array();
- $this->sendCommand("next", $args);
- }
+ $results = $this->sendCommand("next", $args);
+
+ if ($results == '0') { return null; }
- /*!
- @function prev
- @discussion go to previous song
+ return true;
+
+ } // next
+
+ /**
+ * prev
+ * go to previous song
*/
function prev() {
+
$args = array();
- $this->sendCommand("prev", $args);
- }
+ $results = $this->sendCommand("prev", $args);
+
+ if ($results == '0') { return null; }
+
+ return true;
+
+ } // prev
+
+ /**
+ * skip
+ * This skips to POS in the playlist
+ */
+ function skip($pos) {
+
+ $args = array('index'=>$pos);
+ $results = $this->sendCommand('sendplaylistpos',$args);
+
+ if ($results == '0') { return null; }
+
+ return true;
+
+ } // skip
/**
* play
@@ -241,6 +268,69 @@ class HttpQPlayer {
} // get_volume
+ /**
+ * volume_up
+ * This increases the volume by Wimamp's defined amount
+ */
+ function volume_up() {
+
+ $args = array();
+ $results = $this->sendCommand('volumeup',$args);
+
+ if ($results == '0') { return null; }
+
+ return true;
+
+ } // volume_up
+
+ /**
+ * volume_down
+ * This decreases the volume by Winamp's defined amount
+ */
+ function volume_down() {
+
+ $args = array();
+ $results = $this->sendCommand('volumedown',$args);
+
+ if ($results == '0') { return null; }
+
+ return true;
+
+ } // volume_down
+
+ /**
+ * set_volume
+ * This sets the volume as best it can, we go from a resolution
+ * of 100 --> 255 so it's a little fuzzy
+ */
+ function set_volume($value) {
+
+ // Convert it to base 255
+ $value = $value*2.55;
+ $args = array('level'=>$value);
+ $results = $this->sendCommand('setvolume',$args);
+
+ if ($results == '0') { return null; }
+
+ return true;
+
+ } // set_volume
+
+ /**
+ * clear_playlist
+ * this flushes the playlist cache (I hope this means clear)
+ */
+ function clear_playlist() {
+
+ $args = array();
+ $results = $this->sendcommand('flushplaylist',$args);
+
+ if ($results == '0') { return null; }
+
+ return true;
+
+ } // clear_playlist
+
/**
* get_repeat
* This returns the current state of the repeat
diff --git a/modules/localplay/httpq.controller.php b/modules/localplay/httpq.controller.php
index a3f69665..9c391bc6 100644
--- a/modules/localplay/httpq.controller.php
+++ b/modules/localplay/httpq.controller.php
@@ -65,18 +65,17 @@ class AmpacheHttpq {
$map['connect'] = 'connect';
/* Recommended Functions */
- //$map['skip'] = 'skip';
- //$map['next'] = 'next';
- //$map['prev'] = 'prev';
+ $map['skip'] = 'skip';
+ $map['next'] = 'next';
+ $map['prev'] = 'prev';
$map['pause'] = 'pause';
- //$map['volume_up'] = 'volume_up';
- //$map['volume_down'] = 'volume_down';
+ $map['volume_up'] = 'volume_up';
+ $map['volume_down'] = 'volume_down';
$map['random'] = 'random';
$map['repeat'] = 'loop';
/* Optional Functions */
- //$map['move'] = 'move';
- //$map['delete_all'] = 'clear_playlist';
+ $map['delete_all'] = 'clear_playlist';
$map['add_url'] = 'add_url';
return $map;
@@ -205,31 +204,31 @@ class AmpacheHttpq {
/**
* skip
- * This tells MPD to skip to the specified song
+ * This tells HttpQ to skip to the specified song
*/
function skip($song) {
- if (is_null($this->_mpd->SkipTo($song))) { return false; }
+ if (is_null($this->_httpq->skip($song))) { return false; }
return true;
} // skip
/**
- * This tells MPD to increase the volume by 5
+ * This tells Httpq to increase the volume by WinAmps default amount
*/
function volume_up() {
- if (is_null($this->_mpd->AdjustVolume('5'))) { return false; }
+ if (is_null($this->_httpq->volume_up())) { return false; }
return true;
} // volume_up
/**
- * This tells MPD to decrese the volume by 5
+ * This tells HttpQ to decrease the volume by Winamps default amount
*/
function volume_down() {
- if (is_null($this->_mpd->AdjustVolume('-5'))) { return false; }
+ if (is_null($this->_httpq->volume_down())) { return false; }
return true;
} // volume_down
@@ -240,7 +239,8 @@ class AmpacheHttpq {
*/
function next() {
- if (is_null($this->_mpd->Next())) { return false; }
+ if (is_null($this->_httpq->next())) { return false; }
+
return true;
} // next
@@ -251,7 +251,8 @@ class AmpacheHttpq {
*/
function prev() {
- if (is_null($this->_mpd->Previous())) { return false; }
+ if (is_null($this->_httpq->prev())) { return false; }
+
return true;
} // prev
@@ -269,18 +270,19 @@ class AmpacheHttpq {
/**
* volume
- * This tells MPD to set the volume to the parameter
+ * This tells HttpQ to set the volume to the specified amount this
+ * is 0-100
*/
function volume($volume) {
- if (is_null($this->_mpd->SetVolume($volume))) { return false; }
+ if (is_null($this->_httpq->set_volume($volume))) { return false; }
return true;
} // volume
/**
* loop
- * This tells MPD to set the repeating the playlist (i.e. loop) to either on or off
+ * This tells HttpQ to set the repeating the playlist (i.e. loop) to either on or off
*/
function loop($state) {
@@ -289,10 +291,9 @@ class AmpacheHttpq {
} // loop
-
/**
* random
- * This tells MPD to turn on or off the playing of songs from the playlist in random order
+ * This tells HttpQ to turn on or off the playing of songs from the playlist in random order
*/
function random($onoff) {
@@ -301,21 +302,10 @@ class AmpacheHttpq {
} // random
- /**
- * move
- * This tells MPD to move song from SrcPos to DestPos
- */
- function move($SrcPos, $DestPos) {
-
- if (is_null($this->_mpd->PLMoveTrack($SrcPos, $DestPos))) { return false; }
-
- return true;
- } // move
-
/**
* get_songs
* This functions returns an array containing information about
- * The songs that MPD currently has in it's playlist. This must be
+ * The songs that HttpQ currently has in it's playlist. This must be
* done in a standardized fashion
*/
function get_songs() {
diff --git a/server/ajax.server.php b/server/ajax.server.php
index d0f19e99..3bd2fe11 100644
--- a/server/ajax.server.php
+++ b/server/ajax.server.php
@@ -52,13 +52,8 @@ switch ($action) {
case 'play':
case 'stop':
case 'pause':
- $results['lp_state'] = $localplay->get_user_state($function);
- $results['lp_playing'] = $localplay->get_user_playing();
- break;
case 'next':
case 'prev':
- $results['lp_state'] = $localplay->get_user_state('play');
- $results['lp_playing'] = $localplay->get_user_playing();
break;
case 'skip':
ob_start();