1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 17:59:21 +02:00

- Added Live Stream (Internet Radio) support

- New Database Update corrects some issues and makes internet radio possible
- Fixed ratings
- Added new Transcode preference, doesn't do anything yet
- New "Radio Stations" browse type
This commit is contained in:
Karl 'vollmerk' Vollmer 2007-07-23 06:08:14 +00:00
parent 84eca6a3d5
commit 216e691dfa
22 changed files with 563 additions and 59 deletions

View file

@ -61,6 +61,11 @@ switch($_REQUEST['action']) {
$song_ids = Browse::get_objects();
Browse::show_objects($song_ids);
break;
case 'live_stream':
Browse::set_type('live_stream');
$live_stream_ids = Browse::get_objects();
Browse::show_objects($live_stream_ids);
break;
case 'catalog':
break;

View file

@ -89,6 +89,7 @@ class Browse {
case 'album':
case 'artist':
case 'genre':
case 'live_stream':
$_SESSION['browse']['type'] = $type;
break;
default:
@ -170,6 +171,9 @@ class Browse {
case 'user':
$sql = "SELECT `user`.`id` FROM `user` ";
break;
case 'live_stream':
$sql = "SELECT `live_stream`.`id` FROM `live_stream` ";
break;
case 'song':
default:
$sql = "SELECT `song`.`id` FROM `song` ";
@ -233,8 +237,7 @@ class Browse {
break;
} // end list of sqlable filters
} // if it is a song
if ($_SESSION['browse']['type'] == 'album') {
elseif ($_SESSION['browse']['type'] == 'album') {
switch($filter) {
case 'alpha_match':
$filter_sql = " `album`.`name` LIKE '" . Dba::escape($value) . "%' AND ";
@ -247,7 +250,7 @@ class Browse {
break;
}
} // end album
if ($_SESSION['browse']['type'] == 'artist') {
elseif ($_SESSION['browse']['type'] == 'artist') {
switch($filter) {
case 'alpha_match':
$filter_sql = " `artist`.`name` LIKE '" . Dba::escape($value) . "%' AND ";
@ -257,6 +260,16 @@ class Browse {
break;
} // end filter
} // end artist
elseif ($_SESSION['browse']['type'] == 'live_stream') {
switch ($filter) {
case 'alpha_match':
$filter_sql = " `live_stream`.`name` LIKE '" . Dba::escape($value) . "%' AND ";
break;
default:
// Rien a faire
break;
} // end filter
} // end live_stream
return $filter_sql;
@ -339,6 +352,11 @@ class Browse {
require_once Config::get('prefix') . '/templates/show_artists.inc.php';
show_box_bottom();
break;
case 'live_stream':
show_box_top(_('Radion Stations'));
require_once Config::get('prefix') . '/templates/show_live_streams.inc.php';
show_box_bottom();
break;
default:
// Rien a faire
break;

View file

@ -1288,7 +1288,9 @@ class Catalog {
echo "update_txt('" . $count ."','clean_count_" . $this->id . "');";
echo "</script>\n";
show_box_top();
echo "<b>" . _('Catalog Clean Done') . " [" . count($dead_files) . "] " . _('files removed') . "</b><br />\n";
echo "<strong>" . _('Catalog Clean Done') . " [" . count($dead_files) . "] " . _('files removed') . "</strong><br />\n";
echo "<strong>" . _('Optimizing Tables') . "...</strong><br />\n";
self::optimize_tables();
show_box_bottom();
flush();
@ -1419,7 +1421,8 @@ class Catalog {
*/
public static function clean_ext_info($catalog_id) {
$sql = "DELETE FROM song_ext_data USING song_ext_data LEFT JOIN song ON song.id = song_ext_data.song_id WHERE song.id IS NULL";
$sql = "DELETE FROM `song_data` USING `song_data` LEFT JOIN `song` ON `song`.`id` = `song_data`.`song_id` " .
"WHERE `song`.`id` IS NULL";
$db_results = Dba::query($sql);
} // clean_ext_info
@ -1451,19 +1454,19 @@ class Catalog {
$db_results = Dba::query($sql);
// Delete Song Ratings information
$sql = "DELETE FROM ratings USING ratings LEFT JOIN song ON song.id=ratings.object_id WHERE object_type='song' AND song.id IS NULL";
$sql = "DELETE FROM rating USING rating LEFT JOIN song ON song.id=rating.object_id WHERE object_type='song' AND song.id IS NULL";
$db_results = Dba::query($sql);
// Delete Genre Ratings Information
$sql = "DELETE FROM ratings USING ratings LEFT JOIN genre ON genre.id=ratings.object_id WHERE object_type='genre' AND genre.id IS NULL";
$sql = "DELETE FROM rating USING rating LEFT JOIN genre ON genre.id=rating.object_id WHERE object_type='genre' AND genre.id IS NULL";
$db_results = Dba::query($sql);
// Delete Album Rating Information
$sql = "DELETE FROM ratings USING ratings LEFT JOIN album ON album.id=ratings.object_id WHERE object_type='album' AND album.id IS NULL";
$sql = "DELETE FROM rating USING rating LEFT JOIN album ON album.id=rating.object_id WHERE object_type='album' AND album.id IS NULL";
$db_results = Dba::query($sql);
// Delete Artist Rating Information
$sql = "DELETE FROM ratings USING ratings LEFT JOIN artist ON artist.id=ratings.object_id WHERE object_type='artist' AND artist.id IS NULL";
$sql = "DELETE FROM rating USING rating LEFT JOIN artist ON artist.id=rating.object_id WHERE object_type='artist' AND artist.id IS NULL";
$db_results = Dba::query($sql);
} // clean_stats
@ -1596,6 +1599,26 @@ class Catalog {
} // clean
/**
* optimize_tables
* This runs an optomize on the tables and updates the stats to improve join speed
* this can be slow, but is a good idea to do from time to time. This is incase the dba
* isn't doing it... which we're going to assume they aren't
*/
public static function optimize_tables() {
$sql = "OPTIMIZE TABLE `song_data`,`song`,`rating`,`catalog`,`session`,`object_count`,`album`,`album_data`" .
",`artist`,`ip_history`,`genre`,`flagged`,`now_playing`,`user_preference`,`tags`,`tag_map`,`tmp_playlist`" .
",`tmp_playlist_data`,`playlist`,`playlist_data`";
$db_results = Dba::query($sql);
$sql = "ANALYZE TABLE `song_data`,`song`,`rating`,`catalog`,`session`,`object_count`,`album`,`album_data`" .
",`artist`,`ip_history`,`genre`,`flagged`,`now_playing`,`user_preference`,`tags`,`tag_map`,`tmp_playlist`" .
",`tmp_playlist_data`,`playlist`,`playlist_data`";
$db_results = Dba::query($sql);
} // optimize_tables;
/**
* check_artist
* $artist checks if there then return id else insert and return id

View file

@ -65,7 +65,7 @@ class Genre {
*/
public function format() {
$this->link = "<a href=\"" . Config::get('web_path') . "/genre.php?action=show_genre&amp;genre_id=" . $this->id . "\">" . scrub_out($this->name) . "</a>";
$this->f_link = "<a href=\"" . Config::get('web_path') . "/genre.php?action=show_genre&amp;genre_id=" . $this->id . "\">" . scrub_out($this->name) . "</a>";
$this->play_link = Config::get('web_path') . '/song.php?action=genre&amp;genre=' . $this->id;
$this->random_link = Config::get('web_path') . '/song.php?action=random_genre&amp;genre=' . $this->id;

148
lib/class/radio.class.php Normal file
View file

@ -0,0 +1,148 @@
<?php
/*
Copyright 2001 - 2007 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; version 2
of the License.
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.
*/
/**
* Radio Class
* This handles the internet radio stuff, that is inserted into live_stream
* this can include podcasts or what-have-you
*/
class Radio {
/* DB based variables */
public $id;
public $name;
public $site_url;
public $url;
public $frequency;
public $call_sign;
public $genre;
public $catalog;
/**
* Constructor
* This takes a flagged.id and then pulls in the information for said flag entry
*/
public function __construct($id) {
$this->id = intval($id);
if (!$this->id) { return false; }
$info = $this->_get_info();
// Set the vars
foreach ($info as $key=>$value) {
$this->$key = $value;
}
} // constructor
/**
* _get_info
* Private function for getting the information for this object from the database
*/
private function _get_info() {
$id = Dba::escape($this->id);
$sql = "SELECT * FROM `live_stream` WHERE `id`='$id'";
$db_results = Dba::query($sql);
$results = Dba::fetch_assoc($db_results);
return $results;
} // _get_info
/**
* format
* This takes the normal data from the database and makes it pretty
* for the users, the new variables are put in f_??? and f_???_link
*/
public function format() {
// Default link used on the rightbar
$this->f_link = "<a href=\"$this->url\">$this->name</a>";
$this->f_name_link = "<a target=\"_blank\" href=\"$this->site_url\">$this->name</a>";
$this->f_callsign = scrub_out($this->call_sign);
$this->f_frequency = scrub_out($this->frequency);
$genre = new Genre($this->genre);
$genre->format();
$this->f_genre = $genre->f_link;
return true;
} // format
/**
* create
* This is a static function that takes a key'd array for input
* and if everything is good creates the object.
*/
public static function create($data) {
// Make sure we've got a name
if (!strlen($data['name'])) {
Error::add('name','Name Required');
}
if (!preg_match("/^https?:\/\/.+/",$data['url'])) {
Error::add('url','Invalid URL must be http:// or https://');
}
// Make sure it's a real genre
$genre = new Genre($data['genre']);
if (!$genre->name) {
Error::add('genre','Invalid Genre');
}
// Make sure it's a real catalog
$catalog = new Catalog($data['catalog']);
if (!$catalog->name) {
Error::add('catalog','Invalid Catalog');
}
if (Error::$state) { return false; }
// Clean up the input
$name = Dba::escape($data['name']);
$site_url = Dba::escape($data['site_url']);
$url = Dba::escape($data['url']);
$genre = $genre->id;
$catalog = $catalog->id;
$frequency = Dba::escape($data['frequency']);
$call_sign = Dba::escape($data['call_sign']);
// If we've made it this far everything must be ok... I hope
$sql = "INSERT INTO `live_stream` (`name`,`site_url`,`url`,`genre`,`catalog`,`frequency`,`call_sign`) " .
"VALUES ('$name','$site_url','$url','$genre','$catalog','$frequency','$call_sign')";
$db_results = Dba::query($sql);
return $db_results;
} // create
} //end of radio class
?>

View file

@ -64,12 +64,12 @@ class Rating {
$user_id = Dba::escape($user_id);
$sql = "SELECT `rating` FROM `rating` WHERE `user`='$user_id' AND `object_id`='$this->id' AND `object_type`='$this->type'";
$sql = "SELECT `score` FROM `rating` WHERE `user`='$user_id' AND `object_id`='$this->id' AND `object_type`='$this->type'";
$db_results = Dba::query($sql);
$results = Dba::fetch_assoc($db_results);
return $results['rating'];
return $results['score'];
} // get_user
@ -82,14 +82,14 @@ class Rating {
*/
public function get_average() {
$sql = "SELECT `rating` FROM `rating` WHERE `object_id`='$this->id' AND `object_type`='$this->type'";
$sql = "SELECT `score` FROM `rating` WHERE `object_id`='$this->id' AND `object_type`='$this->type'";
$db_results = Dba::query($sql);
$i = 0;
while ($r = Dba::fetch_assoc($db_results)) {
$i++;
$total += $r['rating'];
$total += $r['score'];
} // while we're pulling results
if ($total > 0) {
@ -123,11 +123,11 @@ class Rating {
$db_results = Dba::query($sql);
if ($existing = Dba::fetch_assoc($db_results)) {
$sql = "UPDATE `rating` SET `rating`='$score' WHERE `id`='" . $existing['id'] . "'";
$sql = "UPDATE `rating` SET `score`='$score' WHERE `id`='" . $existing['id'] . "'";
$db_results = Dba::query($sql);
}
else {
$sql = "INSERT INTO `rating` (`object_id`,`object_type`,`rating`,`user`) VALUES " .
$sql = "INSERT INTO `rating` (`object_id`,`object_type`,`score`,`user`) VALUES " .
" ('$this->id','$this->type','$score','" . $GLOBALS['user']->id . "')";
$db_results = Dba::query($sql);
}
@ -157,7 +157,12 @@ class Rating {
*/
public static function show_static ($object_id,$type) {
// If there aren't ratings don't return anything
if (!Config::get('ratings')) { return false; }
$rating = new Rating($object_id,$type);
require Config::get('prefix') . '/templates/show_static_object_rating.inc.php';
} // show_static

View file

@ -121,7 +121,9 @@ class tmpPlaylist {
/**
* get_items
* This returns an array of all object_ids currently in this tmpPlaylist
* This returns an array of all object_ids currently in this tmpPlaylist. This
* has gotten a little more complicated because of type, the values are an array
* 0 being ID 1 being TYPE
*/
public function get_items() {
@ -134,7 +136,8 @@ class tmpPlaylist {
}
/* Select all objects from this playlist */
$sql = "SELECT tmp_playlist_data.id, tmp_playlist_data.object_id $vote_select FROM tmp_playlist_data $vote_join " .
$sql = "SELECT tmp_playlist_data.object_type, tmp_playlist_data.id, tmp_playlist_data.object_id $vote_select " .
"FROM tmp_playlist_data $vote_join " .
"WHERE tmp_playlist_data.tmp_playlist='" . Dba::escape($this->id) . "' $order";
$db_results = Dba::query($sql);
@ -143,7 +146,7 @@ class tmpPlaylist {
while ($results = Dba::fetch_assoc($db_results)) {
$key = $results['id'];
$items[$key] = $results['object_id'];
$items[$key] = array($results['object_id'],$results['object_type']);
}
return $items;
@ -343,14 +346,16 @@ class tmpPlaylist {
/**
* add_object
* This adds the object of $this->object_type to this tmp playlist
* it takes an optional type, default is song
*/
public function add_object($object_id) {
public function add_object($object_id,$object_type) {
$object_id = Dba::escape($object_id);
$playlist_id = Dba::escape($this->id);
$object_type = $object_type ? Dba::escape($object_type) : 'song';
$sql = "INSERT INTO `tmp_playlist_data` (`object_id`,`tmp_playlist`) " .
" VALUES ('$object_id','$playlist_id')";
$sql = "INSERT INTO `tmp_playlist_data` (`object_id`,`tmp_playlist`,`object_type`) " .
" VALUES ('$object_id','$playlist_id','$object_type')";
$db_results = Dba::query($sql);
return true;
@ -495,11 +500,10 @@ class tmpPlaylist {
public function delete_track($id) {
$id = Dba::escape($id);
$tmp_id = Dba::escape($this->id);
/* delete the track its self */
$sql = "DELETE FROM tmp_playlist_data " .
" WHERE tmp_playlist='$tmp_id' AND object_id='$id'";
$sql = "DELETE FROM `tmp_playlist_data` " .
" WHERE `id`='$id'";
$db_results = Dba::query($sql);
/* If this is a voting playlit prune votes */

View file

@ -204,6 +204,12 @@ class Update {
$version[] = array('version' => '340004','description' => $update_string);
$update_string = '- Altered Ratings table so the fields make more sense.<br />' .
'- Moved Random Method to Playlist catagory.<br />' .
'- Added Transcode Method to Streaming.<br />';
$version[] = array('version' => '340005','description' => $update_string);
return $version;
} // populate_version
@ -710,14 +716,49 @@ class Update {
} // update_340004
/**
* update_340005
* This update fixes the preferences types
*/
public static function update_340005() {
// Turn user_rating into a tinyint and call it score
$sql = "ALTER TABLE `rating` CHANGE `user_rating` `score` TINYINT( 4 ) UNSIGNED NOT NULL DEFAULT '0'";
$db_results = Dba::query($sql);
$sql = "UPDATE `preference` SET `catagory`='playlist' WHERE `name`='random_method'";
$db_results = Dba::query($sql);
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
"VALUES ('transcode','default','Transcoding','25','string','streaming')";
$db_results = Dba::query($sql);
/* We need to check for playlist_method here because I fubar'd an earlier update */
$sql = "SELECT * FROM `preference` WHERE `name`='playlist_method'";
$db_results = Dba::query($sql);
if (!Dba::num_rows($db_results)) {
/* Add the playlist_method preference and remove it from the user table */
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
"VALUES ('playlist_method','default','Playlist Method','5','string','playlist')";
$db_results = Dba::query($sql);
}
// Add in the object_type to the tmpplaylist data table so that we can have non-songs in there
$sql = "ALTER TABLE `tmp_playlist_data` ADD `object_type` VARCHAR( 32 ) NULL AFTER `tmp_playlist`";
$db_results = Dba::query($sql);
$sql = "SELECT `id` FROM `user`";
$db_results = Dba::query($sql);
User::fix_preferences('-1');
while ($r = Dba::fetch_assoc($db_results)) {
User::fix_preferences($r['id']);
}
self::set_version('db_version','340005');
return true;
} // update_340005

View file

@ -453,7 +453,7 @@ function get_global_popular($type) {
$text = "$song->f_artist_full - $song->title";
/* Add to array */
$song->link = "<a href=\"$web_path/song.php?action=single_song&amp;song_id=$song->id\" title=\"". scrub_out($text) ."\">" .
scrub_out(truncate_with_ellipse($text, Config::get('ellipse_threshold_title')+3)) . "&nbsp;(" . $r['count'] . ")</a>";
scrub_out(truncate_with_ellipsis($text, Config::get('ellipsis_threshold_title')+3)) . "&nbsp;(" . $r['count'] . ")</a>";
$items[] = $song;
} // if it's a song
@ -462,7 +462,7 @@ function get_global_popular($type) {
$artist = new Artist($r['object_id']);
$artist->format();
$artist->link = "<a href=\"$web_path/artists.php?action=show&amp;artist=" . $r['object_id'] . "\" title=\"". scrub_out($artist->full_name) ."\">" .
truncate_with_ellipse($artist->full_name, Config::get('ellipse_threshold_artist')+3) . "&nbsp;(" . $r['count'] . ")</a>";
truncate_with_ellipsis($artist->full_name, Config::get('ellipsis_threshold_artist')+3) . "&nbsp;(" . $r['count'] . ")</a>";
$items[] = $artist;
} // if type isn't artist
@ -471,7 +471,7 @@ function get_global_popular($type) {
$album = new Album($r['object_id']);
$album->format();
$album->link = "<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,Config::get('ellipse_threshold_album')+3)) . "&nbsp;(" . $r['count'] . ")</a>";
scrub_out(truncate_with_ellipsis($album->name,Config::get('ellipsis_threshold_album')+3)) . "&nbsp;(" . $r['count'] . ")</a>";
$items[] = $album;
} // else not album
@ -479,7 +479,7 @@ function get_global_popular($type) {
$genre = new Genre($r['object_id']);
$genre->format();
$genre->link = "<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,Config::get('ellipse_threshold_title')+3)) . "&nbsp;(" . $r['count'] . ")</a>";
scrub_out(truncate_with_ellipsis($genre->name,Config::get('ellipsis_threshold_title')+3)) . "&nbsp;(" . $r['count'] . ")</a>";
$items[] = $genre;
} // end if genre
} // end foreach

View file

@ -344,6 +344,13 @@ function create_preference_input($name,$value) {
echo "\t<option value=\"default\">" . _('Default') . "</option>\n";
echo "</select>\n";
break;
case 'transcode':
echo "<select name=\"$name\">\n";
echo "\t<option value=\"default\">" . _('Default') . "</option>\n";
echo "\t<option value=\"acl\">" . _('Follow ACL Rules') . "</option>\n";
echo "\t<option value=\"always\">" . _('Always') . "</option>\n";
echo "</select>\n";
break;
default:
echo "<input type=\"text\" size=\"$len\" name=\"$name\" value=\"$value\" />";
break;

View file

@ -954,10 +954,10 @@ function show_catalog_select($name='catalog',$catalog_id=0,$style='') {
echo "<select name=\"$name\" style=\"$style\">\n";
$sql = "SELECT id, name FROM catalog ORDER BY name";
$db_results = mysql_query($sql, dbh());
$sql = "SELECT `id`, `name` FROM `catalog` ORDER BY `name`";
$db_results = Dba::query($sql);
while ($r = mysql_fetch_assoc($db_results)) {
while ($r = Dba::fetch_assoc($db_results)) {
$selected = '';
if ($r['id'] == $catalog_id) {
$selected = "selected=\"selected\"";

56
radio.php Normal file
View file

@ -0,0 +1,56 @@
<?php
/*
Copyright (c) 2001 - 2007 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; version 2
of the License.
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.
*/
require 'lib/init.php';
show_header();
// Switch on Action
switch ($_REQUEST['action']) {
case 'show_create':
if (!$GLOBALS['user']->has_access('25')) {
access_denied();
exit;
}
require_once Config::get('prefix') . '/templates/show_add_live_stream.inc.php';
break;
case 'create':
if (!$GLOBALS['user']->has_access('25')) {
access_denied();
exit;
}
// Try to create the sucker
$results = Radio::create($_POST);
if (!$results) {
require_once Config::get('prefix') . '/templates/show_add_live_stream.inc.php';
}
break;
} // end data collection
show_footer();
?>

View file

@ -176,15 +176,19 @@ switch ($action) {
case 'clear_all':
$GLOBALS['user']->playlist->clear();
break;
case 'live_stream':
$object = new Radio($_REQUEST['id']);
// Confirm its a valid ID
if ($object->name) {
$GLOBALS['user']->playlist->add_object($object->id,'radio');
}
break;
default:
case 'song':
$GLOBALS['user']->playlist->add_object($_REQUEST['id']);
break;
} // end switch
$results['topbar-playlist'] = ajax_include('show_playlist_bar.inc.php');
$results['rightbar'] = ajax_include('rightbar.inc.php');
echo xml_from_array($results);

View file

@ -50,7 +50,24 @@ switch ($_REQUEST['action']) {
if (!count($song_ids)) { header("Location:" . return_referer()); exit; }
break;
case 'basket':
$song_ids = $GLOBALS['user']->playlist->get_items();
// Pull in our items (multiple types)
$objects = $GLOBALS['user']->playlist->get_items();
//Recurse through the objects
foreach ($objects as $object_data) {
// Switch on the type of object we've got in here
switch ($object_data['1']) {
case 'radio':
$radio = new Radio($object_data['0']);
$urls[] = $radio->url;
break;
case 'song':
default:
$song_ids[] = $object_data['0'];
break;
} // end switch on type
} // end foreach
break;
/* This is run if we need to gather info based on a tmp playlist */
case 'tmp_playlist':
@ -163,6 +180,11 @@ switch ($_REQUEST['method']) {
/* Start the Stream */
$stream = new Stream($stream_type,$song_ids);
if (is_array($urls)) {
foreach ($urls as $url) {
$stream->manual_url_add($url);
}
}
$stream->start();
break;
} // end method switch

View file

@ -37,18 +37,16 @@
<table cellpadding="0" cellspacing="0">
<?php
$objects = $GLOBALS['user']->playlist->get_items();
foreach ($objects as $song_id) {
$song = new Song($song_id);
$song->format();
foreach ($objects as $uid=>$object_data) {
$object = new $object_data['1']($object_data['0']);
$object->format();
?>
<tr class="<?php echo flip_class(); ?>">
<td>
<?php echo $song->f_link; ?>
<?php echo $object->f_link; ?>
</td>
<td>
<span onclick="ajaxPut('<?php echo Config::get('ajax_url'); ?>?action=current_playlist&amp;type=delete&amp;id=<?php echo $song_id; ?>');return true;">
<?php echo get_user_icon('delete','',_('Delete')); ?>
</span>
<?php echo Ajax::button('?action=current_playlist&type=delete&id=' . $uid,'delete',_('Delete'),'rightbar_delete_' . $uid); ?>
</td>
</tr>
<?php } if (!count($objects)) { ?>

View file

@ -0,0 +1,79 @@
<?php
/*
Copyright (c) 2001 - 2007 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; version 2
of the License.
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.
*/
?>
<?php show_box_top(_('Add Radio Station')); ?>
<form name="radio" method="post" action="<?php echo Config::get('web_path'); ?>/radio.php?action=create">
<table>
<tr>
<td><?php echo _('Name'); ?></td>
<td>
<input type="text" name="name" size="20" value="<?php echo scrub_out($_REQUEST['name']); ?>" />
<?php Error::display('name'); ?>
</td>
</tr>
<tr>
<td><?php echo _('Station Homepage'); ?></td>
<td>
<input type="text" name="site_url" value="<?php echo scrub_out($_REQUEST['site_url']); ?>" />
<?php Error::display('site_url'); ?>
</td>
</tr>
<tr>
<td><?php echo _('Station URL'); ?></td>
<td>
<input type="text" name="url" value="<?php echo scrub_out($_REQUEST['url']); ?>" />
<?php Error::display('url'); ?>
</td>
</tr>
<tr>
<td><?php echo _('Station Frequency'); ?></td>
<td>
<input type="text" name="frequency" value="<?php echo scrub_out($_REQUEST['frequency']); ?>" />
</td>
</tr>
<tr>
<td><?php echo _('Station call-sign'); ?></td>
<td>
<input type="text" name="call_sign" value="<?Php echo scrub_out($_REQUEST['call_sign']); ?>" />
</td>
</tr>
<tr>
<td><?php echo _('Genre'); ?></td>
<td>
<?php echo show_genre_select('genre',intval($_REQUEST['genre'])); ?>
</td>
</tr>
<tr>
<td><?php echo _('Catalog'); ?></td>
<td>
<?php echo show_catalog_select('catalog',intval($_REQUEST['catalog'])); ?>
</td>
</tr>
<tr>
<td colspan="2">
<input class="button" type="submit" value="<?php echo _('Add'); ?>" />
</td>
</tr>
</table>
</form>
<?php show_box_bottom(); ?>

View file

@ -50,7 +50,7 @@ foreach ($object_ids as $genre_id) {
<?php echo get_user_icon('random'); ?>
</span>
</td>
<td><?php echo $genre->link; ?></td>
<td><?php echo $genre->f_link; ?></td>
<td><?php echo $genre->get_song_count(); ?></td>
<td>
<?php if (Access::check_function('batch_download')) { ?>

View file

@ -0,0 +1,33 @@
<?php
/*
Copyright (c) 2001 - 2007 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.
*/
?>
<td>
<?php echo Ajax::button('?action=basket&type=live_stream&id=' . $radio->id,'add',_('Add'),'add_radio_' . $radio->id); ?>
</td>
<td><?php echo $radio->f_name_link; ?></td>
<td><?php echo $radio->f_callsign; ?></td>
<td><?php echo $radio->f_frequency; ?></td>
<td><?php echo $radio->f_genre; ?></td>
<td>
<?php if ($GLOBALS['user']->has_access('50')) { ?>
<?php echo Ajax::button('?action=show_edit_object&type=live_stream&id=' . $radio->id,'edit',_('Edit'),'edit_radio_' . $radio->id); ?>
<?php } ?>
</td>

View file

@ -0,0 +1,52 @@
<?php
/*
Copyright (c) 2001 - 2007 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.
*/
$web_path = Config::get('web_path');
?>
<table class="tabledata" cellspacing="0" cellpadding="0" border="0">
<tr class="table-header" align="center">
<td colspan="5">
<?php if ($GLOBALS['view']->offset_limit) { require Config::get('prefix') . '/templates/list_header.inc'; } ?>
</td>
</tr>
<tr class="table-header">
<th><?php echo _('Add'); ?></th>
<th><?php echo _('Name'); ?></th>
<th><?php echo _('Callsign'); ?></th>
<th><?php echo _('Frequency'); ?></th>
<th><?php echo _('Genre'); ?></th>
<th><?php echo _('Action'); ?> </th>
</tr>
<?php
foreach ($object_ids as $radio_id) {
$radio = new Radio($radio_id);
$radio->format();
?>
<tr id="radio_<?php echo $radio->id; ?>" class="<?php echo flip_class(); ?>">
<?php require Config::get('prefix') . '/templates/show_live_stream_row.inc.php'; ?>
</tr>
<?php } //end foreach ($artists as $artist) ?>
<tr class="even" align="center">
<td colspan="4">
<?php if ($view->offset_limit) { require (conf('prefix') . "/templates/list_header.inc"); } ?>
</td>
</tr>
</table>

View file

@ -20,24 +20,31 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* Prepare the variables */
$title = scrub_out(truncate_with_ellipse($song->title,'25'));
$album = scrub_out(truncate_with_ellipse($song->f_album_full,'25'));
$artist = scrub_out(truncate_with_ellipse($song->f_artist_full,'25'));
$title = scrub_out(truncate_with_ellipsis($song->title,'25'));
$album = scrub_out(truncate_with_ellipsis($song->f_album_full,'25'));
$artist = scrub_out(truncate_with_ellipsis($song->f_artist_full,'25'));
?>
<td class="np_cell_left"><b><?php echo _('Username'); ?></b>:<br /><?php echo scrub_out($np_user->fullname); ?><br /><br /><!-- ## modified ##-->
<b><?php echo _('Song'); ?></b><br /><a title="<?php echo scrub_out($song->title); ?>" href="<?php echo $web_path; ?>/song.php?action=single_song&amp;song_id=<?php echo $song->id; ?>">
<td class="np_cell_left"><b><?php echo _('Username'); ?></b>:<br />
<a href="<?php echo $web_path; ?>/stats.php?action=show_user&amp;user_id=<?php echo $np_user->id; ?>"><?php echo scrub_out($np_user->fullname); ?></a><br /><br />
<!-- ## modified ##-->
<strong><?php echo _('Song'); ?></strong><br />
<a title="<?php echo scrub_out($song->title); ?>" href="<?php echo $web_path; ?>/song.php?action=single_song&amp;song_id=<?php echo $song->id; ?>">
<?php echo $title; ?>
</a>
<?php if(Config::get('ratings')) { ?>
<br /><?php show_rating($song->id,'song'); ?>
<?php } ?>
<div id="rating_<?php echo $song->id; ?>_song">
<?php Rating::show($song->id,'song'); ?>
</div>
</td>
<td class="np_cell_m">
<b><?php echo _('Artist'); ?></b><br /><a title="<?php echo scrub_out($song->f_artist_full); ?>" href="<?php echo $web_path; ?>/artists.php?action=show&amp;artist=<?php echo $song->artist; ?>">
<strong><?php echo _('Artist'); ?></strong><br />
<a title="<?php echo scrub_out($song->f_artist_full); ?>" href="<?php echo $web_path; ?>/artists.php?action=show&amp;artist=<?php echo $song->artist; ?>">
<?php echo $artist; ?>
</a><br /><br />
<b><?php echo _('Album'); ?></b><br /><a title="<?php echo scrub_out($song->f_album_full); ?>" href="<?php echo $web_path; ?>/albums.php?action=show&amp;album=<?php echo $song->album; ?>">
<?php echo $album; ?></a>
</a>
<br /><br />
<strong><?php echo _('Album'); ?></strong><br />
<a title="<?php echo scrub_out($song->f_album_full); ?>" href="<?php echo $web_path; ?>/albums.php?action=show&amp;album=<?php echo $song->album; ?>">
<?php echo $album; ?>
</a>
</td>
<?php if (Config::get('show_album_art')) { ?>
<td class="np_cell_right">

View file

@ -9,6 +9,7 @@
<span><a href="<?php echo $web_path; ?>/browse.php?action=album"><?php echo _('Albums'); ?></a></span>
<span><a href="<?php echo $web_path; ?>/browse.php?action=artist"><?php echo _('Artist'); ?></a></span>
<span><a href="<?php echo $web_path; ?>/browse.php?action=genre"><?php echo _('Genre'); ?></a></span>
<span><a href="<?php echo $web_path; ?>/browse.php?action=live_stream"><?php echo _('Radio Stations'); ?></a></span>
<hr />
<h4><?php echo _('Filters'); ?></h4>
<?php show_alphabet_list($_REQUEST['alpha_match'],$_REQUEST['action']); ?>

View file

@ -1,6 +1,7 @@
<h4><?php echo _('Information'); ?></h4>
<span><a href="<?php echo $web_path; ?>/index.php"><?php echo _('Currently Playing'); ?></a></span>
<span><a href="<?php echo $web_path; ?>/stats.php"><?php echo _('Statistics'); ?></a></span>
<span><a href="<?php echo $web_path; ?>/radio.php?action=show_create"><?php echo _('Add Radio Station'); ?></a></span>
<hr />
<!-- RANDOM, Hidden for now cause its broken
<h4><?php echo _('Search'); ?></h4>