mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-04 10:19:25 +02:00
* 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)
This commit is contained in:
parent
29420520e9
commit
c19f512180
6 changed files with 219 additions and 52 deletions
77
bin/write_playlists.php.inc
Normal file
77
bin/write_playlists.php.inc
Normal file
|
@ -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
|
||||
|
||||
?>
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/*!
|
||||
@function prev
|
||||
@discussion go to previous song
|
||||
$args = array();
|
||||
$results = $this->sendCommand("next", $args);
|
||||
|
||||
if ($results == '0') { return null; }
|
||||
|
||||
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
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue