summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-10-29 19:16:56 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-10-29 19:16:56 +0000
commitc63317e869d1da28ab3a429bf4116446f9bcbc64 (patch)
tree6b717f2dae35ddd22bcd7755c3c0f9d453a3acd0
parent98c4a922621fd2df37a1204c09b06594f20536ea (diff)
downloadampache-c63317e869d1da28ab3a429bf4116446f9bcbc64.tar.gz
ampache-c63317e869d1da28ab3a429bf4116446f9bcbc64.tar.bz2
ampache-c63317e869d1da28ab3a429bf4116446f9bcbc64.zip
some initial flash player integration from forums and some bug fixes on most popular
-rwxr-xr-xdocs/CHANGELOG3
-rw-r--r--lib/class/stream.class.php108
-rw-r--r--lib/general.lib.php10
-rw-r--r--modules/lib.php37
-rw-r--r--song.php19
-rw-r--r--templates/show_xspf_player.inc.php34
6 files changed, 70 insertions, 141 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index a5af4c9e..b18767a7 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,7 +4,8 @@
--------------------------------------------------------------------------
v.3.3.3-Alpha2
-
+ - Fixed bug with most popular where links weren't being generated
+ correctly
--------------------------------------------------------------------------
diff --git a/lib/class/stream.class.php b/lib/class/stream.class.php
index 5c9a54fa..cda7a1d3 100644
--- a/lib/class/stream.class.php
+++ b/lib/class/stream.class.php
@@ -176,10 +176,10 @@ class Stream {
} // create_asx
- /*!
- @function create_xspf
- @discussion creates an XSPF playlist (Thx PB1DFT)
- */
+ /**
+ * create_xspf
+ * creates an XSPF playlist (Thx PB1DFT)
+ */
function create_xspf() {
$playlist = "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>
@@ -216,53 +216,23 @@ class Stream {
} // create_xspf
- /*!
- @function create_icecast2
- @discussion pushes an icecast stream
- */
- function create_icecast2() {
-
- echo "ICECAST2<br>\n";
-
- // Play the song locally using local play configuration
- if (count($this->songs) > 0) {
- echo "ICECAST2<br>\n";
- exec("killall ices");
- $filename = conf('icecast_tracklist');
- echo "$filename " . _("Opened for writing") . "<br>\n";
-
- /* Open the file for writing */
- if (!$handle = @fopen($filename, "w")) {
- debug_event("icecast","Fopen: $filename Failed",'3');
- echo _("Error, cannot write") . " $filename<br>\n";
- exit;
- }
-
- /* Foreach through songs */
- foreach($this->songs as $song_id) {
- $song = new Song($song_id);
- echo "$song->file<br>\n";
- $line = "$song->file\n";
- if (!fwrite($handle, $line)) {
- debug_event("icecast","Fwrite: Unabled to write $line into $filename",'3');
- echo _("Error, cannot write song in file") . " $song->file --&gt; $filename";
- exit;
- } // if write fails
-
- } // foreach songs
+ /**
+ * create_xspf_player
+ * due to the fact that this is an integrated player (flash) we actually
+ * have to do a little 'cheating' to make this work, we are going to take
+ * advantage of tmp_playlists to do all of this hotness
+ */
+ function create_xspf_player() {
- echo $filename . " " . _("Closed after write") . "<br>\n";
- fclose($handle);
- $cmd = conf('icecast_command');
- $cmd = str_replace("%FILE%", $filename, $cmd);
- debug_event("icecast","Exec: $cmd",'3');
- exec($cmd);
- exit;
-
- } // if songs
+ /* First insert the songs we've got into
+ * a tmp_playlist
+ */
+ /* Echo some ugly javascript to make it pop-open the player */
- } // create_icecast2
+
+ } // create_xspf_player
+
/**
* create_localplay
@@ -294,44 +264,10 @@ class Stream {
} // create_democratic
- /*!
- @function create_mpd
- @discussion function that passes information to
- MPD
- */
- function create_mpd() {
-
- /* Create the MPD object */
- $myMpd = @new mpd(conf('mpd_host'),conf('mpd_port'),conf('mpd_pass'));
-
- /* Add the files to the MPD playlist */
- addToPlaylist($myMpd,$this->songs);
-
- /* If we've added songs we should start playing */
- $myMpd->Play();
-
- header ("Location: " . conf('web_path') . "/index.php");
-
- } // create_mpd
-
-
- /*!
- @function create_slim
- @discussion this function passes the correct mojo to the slim
- class which is in turn passed to the slimserver
- */
- function create_slim() {
-
-
-
-
-
- } // create_slim
-
- /*!
- @function create_ram
- @discussion this functions creates a RAM file for use by Real Player
- */
+ /**
+ * create_ram
+ *this functions creates a RAM file for use by Real Player
+ */
function create_ram() {
header("Cache-control: public");
diff --git a/lib/general.lib.php b/lib/general.lib.php
index d9823a40..fc60db3e 100644
--- a/lib/general.lib.php
+++ b/lib/general.lib.php
@@ -627,21 +627,23 @@ function get_global_popular($type) {
/* If Artist */
elseif ( $type == 'artist' ) {
- $artist = get_artist_name($r['object_id']);
- $items[] = "<li> <a href=\"$web_path/artists.php?action=show&amp;artist=$r->object_id\" title=\"". scrub_out($artist) ."\">" .
+ $artist_obj = new Artist($r['object_id']);
+ $artist_obj->format_artist();
+ $artist = $artist_obj->full_name;
+ $items[] = "<li> <a href=\"$web_path/artists.php?action=show&amp;artist=" . $r['object_id'] . "\" title=\"". scrub_out($artist) ."\">" .
scrub_out(truncate_with_ellipse($artist, conf('ellipse_threshold_artist')+3)) . "&nbsp;(" . $r['count'] . ")</a> </li>";
} // if type isn't artist
/* If Album */
elseif ( $type == 'album' ) {
$album = new Album($r['object_id']);
- $items[] = "<li> <a href=\"$web_path/albums.php?action=show&amp;album=$r->object_id\" title=\"". scrub_out($album->name) ."\">" .
+ $items[] = "<li> <a href=\"$web_path/albums.php?action=show&amp;album=" . $r['object_id'] . "\" title=\"". scrub_out($album->name) ."\">" .
scrub_out(truncate_with_ellipse($album->name,conf('ellipse_threshold_album')+3)) . "&nbsp;(" . $r['count'] . ")</a> </li>";
} // else not album
elseif ($type == 'genre') {
$genre = new Genre($r['object_id']);
- $items[] = "<li> <a href=\"$web_path/browse.php?action=genre&amp;genre=$r->object_id\" title=\"" . scrub_out($genre->name) . "\">" .
+ $items[] = "<li> <a href=\"$web_path/browse.php?action=genre&amp;genre=" . $r['object_id'] . "\" title=\"" . scrub_out($genre->name) . "\">" .
scrub_out(truncate_with_ellipse($genre->name,conf('ellipse_threshold_title')+3)) . "&nbsp;(" . $r['count'] . ")</a> </li>";
} // end if genre
} // end foreach
diff --git a/modules/lib.php b/modules/lib.php
index 6023dbf6..b90a6c4f 100644
--- a/modules/lib.php
+++ b/modules/lib.php
@@ -200,25 +200,6 @@ ECHO;
}
-function get_artist_name ($artist, $dbh=0) {
-
- global $settings;
- if (!is_resource($dbh)) {
- $dbh = dbh();
- }
-
- $query = "SELECT name FROM artist WHERE id = '$artist'";
- $db_result = mysql_query($query, $dbh);
-
- if ($r = mysql_fetch_object($db_result)) {
- return $r->name;
- }
- else {
- return FALSE;
- }
-}
-
-
function get_artist_info ($artist_id) {
$dbh = dbh();
@@ -264,24 +245,6 @@ function get_artist_from_album ($album_id) {
}
-function get_artist_name_from_song ($song_id) {
-
- $dbh = dbh();
-
- $sql = "SELECT artist.name AS name FROM artist, song" .
- " WHERE artist.id = song.artist" .
- " AND song.id = '$song_id'";
- $db_result = mysql_query($sql, $dbh);
-
- if ($r = mysql_fetch_object($db_result)) {
- return $r->name;
- }
- else {
- return FALSE;
- }
-}
-
-
function get_album_name ($album, $dbh = 0) {
$album = new Album($album);
diff --git a/song.php b/song.php
index a8362961..ef3d447a 100644
--- a/song.php
+++ b/song.php
@@ -5,9 +5,8 @@
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.
+ 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
@@ -19,16 +18,6 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-
-/*!
- @header Song Document
- @discussion Actually play files from albums, artists or just given
- a bunch of id's.
- Special thanx goes to Mike Payson and Jon Disnard for the means
- to do this.
- FIXME: don't get me started... :(
-*/
-
require('lib/init.php');
/* If we are running a demo, quick while you still can! */
@@ -59,6 +48,10 @@ switch ($action) {
$song_ids = $_POST['song'];
}
break;
+ /* This is run if we need to gather info based on a tmp playlist */
+ case 'tmp_playlist':
+
+ break;
case 'single_song':
$song_ids[] = scrub_in($_REQUEST['song_id']);
break;
diff --git a/templates/show_xspf_player.inc.php b/templates/show_xspf_player.inc.php
new file mode 100644
index 00000000..f0494cb2
--- /dev/null
+++ b/templates/show_xspf_player.inc.php
@@ -0,0 +1,34 @@
+<?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 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.
+
+*/
+?>
+
+<html>
+<head><title>Ampache XSPF Player</title></head>
+<body style="margin:0px; padding:0px; border:0px;">
+<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="400" height="168">
+<param name="allowScriptAccess" value="sameDomain"/>
+<param name="movie" value="<?php echo conf('web_path'); ?>/modules/flash/xspf_player.swf?playlist_url=<?php echo conf('web_path'); ?>/song.php<?php echo $play_info; ?>&autoplay=true&autoload=true"/>
+<param name="quality" value="high"/>
+<param name="bgcolor" value="#E6E6E6"/>
+<embed src="<?php echo conf('web_path'); ?>/modules/flash/xspf_player.swf?playlist_url=<?php echo conf('web_path'); ?>/song.php<?php echo $play_info; ?>&autoplay=true&autoload=true" quality="high" bgcolor="#E6E6E6" name="xspf_player" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" align="center" height="168" width="400"></embed>
+</object>
+</body>
+</html>