summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/class/flag.class.php4
-rw-r--r--modules/httpq/httpqplayer.class.php126
-rw-r--r--playlist.php1
-rw-r--r--ratings.php2
-rw-r--r--templates/show_flagged.inc.php2
-rw-r--r--templates/show_playlist_box.inc.php6
6 files changed, 134 insertions, 7 deletions
diff --git a/lib/class/flag.class.php b/lib/class/flag.class.php
index a95e73c8..59a07aaa 100644
--- a/lib/class/flag.class.php
+++ b/lib/class/flag.class.php
@@ -96,8 +96,8 @@ class Flag {
while ($r = mysql_fetch_assoc($db_results)) {
$results[] = $r;
}
-
- return $results;
+
+ return $results['id'];
} // get_recent
diff --git a/modules/httpq/httpqplayer.class.php b/modules/httpq/httpqplayer.class.php
new file mode 100644
index 00000000..8efaf6e4
--- /dev/null
+++ b/modules/httpq/httpqplayer.class.php
@@ -0,0 +1,126 @@
+<?php
+/*
+
+ Copyright (c) 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
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ 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.
+
+ * Written by snuffels *
+
+*/
+
+
+class HttpQPlayer {
+
+ var $host;
+ var $port;
+ var $password;
+
+ function HttpQPlayer($h = "localhost", $pw = "", $p = 4800) {
+ $this->host = $h;
+ $this->port = $p;
+ $this->password = $pw;
+ } // HttpQPlayer
+
+ /*!
+ @function add
+ @discussion append a song to the playlist
+ @param $name Name to be shown in the playlist
+ @param $url URL of the song
+ */
+ function add($name, $url) {
+ $args["name"] = $name;
+ $args["url"] = str_replace("&","%26",$url);;
+ $this->sendCommand("playurl", $args);
+ }
+
+ /*!
+ @function clear
+ @discussion clear the playlist
+ */
+ function clear() {
+ $args = array();
+ $this->sendCommand("delete", $args);
+ }
+
+ /*!
+ @function next
+ @discussion go to next song
+ */
+ function next() {
+ $args = array();
+ $this->sendCommand("next", $args);
+ }
+
+ /*!
+ @function prev
+ @discussion go to previous song
+ */
+ function prev() {
+ $args = array();
+ $this->sendCommand("prev", $args);
+ }
+
+ /*!
+ @function play
+ @discussion play the current song
+ */
+ function play() {
+ $args = array();
+ $this->sendCommand("play", $args);
+ }
+
+ /*!
+ @function pause
+ @discussion toggle pause mode on current song
+ */
+ function pause() {
+ $args = array();
+ $this->sendCommand("pause", $args);
+ }
+
+ /*!
+ @function stop
+ @discussion stop the current song
+ */
+ function stop() {
+ $args = array();
+ $this->sendCommand("stop", $args);
+ }
+
+ function sendCommand($cmd, $args) {
+ $fp = fsockopen($this->host, $this->port, &$errno, &$errstr);
+ if(!$fp) {
+ debug_event('httpq',"HttpQPlayer: $errstr ($errno)",'1');
+ }
+ else {
+ $msg = "GET /$cmd?p=$this->password";
+ foreach ($args AS $key => $val) {
+ $msg = $msg . "&$key=$val";
+ }
+ $msg = $msg . " HTTP/1.0\r\n\r\n";
+ fputs($fp, $msg);
+ while(!feof($fp)) {
+ fgets($fp);
+ }
+ fclose($fp);
+ }
+ }
+
+} // End HttpQPlayer Class
+
+
+?>
diff --git a/playlist.php b/playlist.php
index 1f802202..2e90a4f5 100644
--- a/playlist.php
+++ b/playlist.php
@@ -85,6 +85,7 @@ switch ($action) {
$playlist->add_songs($song_ids);
/* Show the Playlist */
+ $_REQUEST['playlist_id'] = $playlist->id;
show_playlist($playlist);
break;
case 'add_dyn_song':
diff --git a/ratings.php b/ratings.php
index 09154fe2..5253b1dd 100644
--- a/ratings.php
+++ b/ratings.php
@@ -30,7 +30,7 @@ switch ($action) {
case 'set_rating':
$rating = new Rating($_REQUEST['object_id'],$_REQUEST['rating_type']);
$rating->set_rating($_REQUEST['rating']);
- show_confirmation(_("Rating Updated"),_("Your rating for this object has been updated"),return_referer());
+ show_confirmation(_('Rating Updated'),_('Your rating for this object has been updated'),return_referer());
break;
default:
diff --git a/templates/show_flagged.inc.php b/templates/show_flagged.inc.php
index b078a2da..660b3772 100644
--- a/templates/show_flagged.inc.php
+++ b/templates/show_flagged.inc.php
@@ -30,7 +30,7 @@ $web_path = conf('web_path');
<th><?php echo _('Status'); ?></th>
<th><?php echo _('Action'); ?></th>
</tr>
-<?php foreach ($flagged as $flag_id) { $flag = new Flag($flag_id); ?>
+<?php foreach ($flagged as $data) { $flag = new Flag($data); ?>
<tr class="<?php echo flip_class(); ?>">
<td><?php $flag->print_name(); ?></td>
<td><?php $flag->print_flag(); ?></td>
diff --git a/templates/show_playlist_box.inc.php b/templates/show_playlist_box.inc.php
index 98f5b680..168e76e2 100644
--- a/templates/show_playlist_box.inc.php
+++ b/templates/show_playlist_box.inc.php
@@ -39,10 +39,10 @@ $playlist_id = scrub_out($_REQUEST['playlist_id']);
<li><a href="<?php echo $web_path; ?>/playlist.php?action=normalize_tracks&amp;playlist_id=<?php echo $playlist_id; ?>"><?php echo _('Normalize Tracks'); ?></a></li>
<li><a href="<?php echo $web_path; ?>/song.php?action=play_selected&amp;playlist_id=<?php echo $playlist_id; ?>"><?php echo _('Play This Playlist'); ?></a></li>
<li><a href="<?php echo $web_path; ?>/playlist.php?action=show_delete_playlist&amp;playlist_id=<?php echo $playlist_id; ?>"><?php echo _('Delete This Playlist'); ?></a></li>
- <?php } ?>
- <li><a href="<?php echo $web_path; ?>/playlist.php?action=new"><?php echo _('Create New Playlist'); ?></a></li>
- <li><a href="<?php echo $web_path; ?>/playlist.php"><?php echo _('View All Playlists'); ?></a></li>
+ <?php } else { ?>
<li><a href="<?php echo $web_path; ?>/playlist.php?action=show_import_playlist"><?php echo _('Import From File'); ?></a></li>
+ <li><a href="<?php echo $web_path; ?>/playlist.php?action=new"><?php echo _('Create New Playlist'); ?></a></li>
+ <?php } ?>
</ul>
</td>
</tr>