summaryrefslogtreecommitdiffstats
path: root/lib
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 /lib
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
Diffstat (limited to 'lib')
-rw-r--r--lib/class/stream.class.php108
-rw-r--r--lib/general.lib.php10
2 files changed, 28 insertions, 90 deletions
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