1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 01:39:28 +02:00

Add cover art to live streams

This commit is contained in:
Afterster 2016-03-03 21:44:06 +01:00
parent 5bbe3c7ad1
commit 5b75e70979
11 changed files with 84 additions and 20 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Before After
Before After

View file

@ -880,7 +880,7 @@ class Art extends database_object
*/
public static function gc($object_type = null, $object_id = null)
{
$types = array('album', 'artist','tvshow','tvshow_season','video','user');
$types = array('album', 'artist','tvshow','tvshow_season','video','user','live_stream');
if ($object_type != null) {
if (in_array($object_type, $types)) {

View file

@ -228,7 +228,6 @@ class Browse extends Query
$box_req = AmpConfig::get('prefix') . UI::find_template('show_artists.inc.php');
break;
case 'live_stream':
require_once AmpConfig::get('prefix') . UI::find_template('show_live_stream.inc.php');
$box_title = T_('Radio Stations') . $match;
$box_req = AmpConfig::get('prefix') . UI::find_template('show_live_streams.inc.php');
break;

View file

@ -56,6 +56,11 @@ class Live_Stream extends database_object implements media, library_item
*/
public $catalog;
/**
* @var string $f_name
*/
public $f_name;
/**
* @var string $f_link
*/
@ -95,8 +100,10 @@ class Live_Stream extends database_object implements media, library_item
public function format($details = true)
{
// 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_name = scrub_out($this->name);
$this->link = AmpConfig::get('web_path') . '/radio.php?action=show&radio=' . scrub_out($this->id);
$this->f_link = "<a href=\"" . $this->link . "\">" . $this->f_name . "</a>";
$this->f_name_link = "<a target=\"_blank\" href=\"" . $this->site_url . "\">" . $this->f_name . "</a>";
$this->f_url_link = "<a target=\"_blank\" href=\"" . $this->url . "\">" . $this->url . "</a>";
return true;

View file

@ -196,6 +196,7 @@ class Stream_Playlist
$url['title'] .= ' (' . $object->site_url . ')';
}
$url['codec'] = $object->codec;
$url['image_url'] = Art::url($object->id, 'live_stream', $api_session, (AmpConfig::get('ajax_load') ? 3 : 4));
break;
case 'song_preview':
$url['title'] = $object->title;

View file

@ -291,7 +291,7 @@ class WebPlayer
$js['filetype'] = $types['player'];
$js['url'] = $url;
if ($urlinfo['type'] == 'song' || $urlinfo['type'] == 'podcast_episode') {
if ($item->image_url) {
$js['poster'] = $item->image_url;
}

View file

@ -62,6 +62,12 @@ switch ($_REQUEST['action']) {
show_confirmation($title,$body,AmpConfig::get('web_path') . '/browse.php?action=live_stream');
}
break;
case 'show':
default:
$radio = new Live_Stream($_REQUEST['radio']);
$radio->format();
require AmpConfig::get('prefix') . UI::find_template('show_live_stream.inc.php');
break;
} // end data collection
UI::show_footer();

View file

@ -19,22 +19,47 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
?>
<?php if (Access::check('interface', '50')) {
<?php UI::show_box_top($radio->f_name . ' ' . T_('Details'), 'box box_live_stream_details'); ?>
<div class="item_right_info">
<?php
$thumb = UI::is_grid_view('live_stream') ? 2 : 11;
Art::display('live_stream', $radio->id, $radio->f_name, $thumb);
?>
<?php UI::show_box_top(T_('Manage Radio Stations'),'info-box');
?>
<div id="information_actions">
<ul>
<li>
<a href="<?php echo AmpConfig::get('web_path');
?>/radio.php?action=show_create"><?php echo UI::get_icon('add', T_('Add'));
?> <?php echo T_('Add Radio Station');
?></a>
</li>
</ul>
</div>
<?php UI::show_box_bottom();
<dl class="media_details">
<?php $rowparity = UI::flip_class(); ?>
<dt class="<?php echo $rowparity; ?>"><?php echo T_('Action'); ?></dt>
<dd class="<?php echo $rowparity; ?>">
<?php if (AmpConfig::get('directplay')) {
?>
<?php
<?php echo Ajax::button('?page=stream&action=directplay&object_type=live_stream&object_id=' . $radio->id, 'play', T_('Play'),'play_live_stream_' . $radio->id);
?>
<?php if (Stream_Playlist::check_autoplay_append()) {
?>
<?php echo Ajax::button('?page=stream&action=directplay&object_type=live_stream&object_id=' . $radio->id . '&append=true','play_add', T_('Play last'),'addplay_live_stream_' . $radio->id);
?>
<?php
}
?>
<?php
} ?>
<?php echo Ajax::button('?action=basket&type=live_stream&id=' . $radio->id,'add', T_('Add to temporary playlist'),'add_live_stream_' . $radio->id); ?>
</dd>
<?php
$itemprops[gettext_noop('Name')] = $radio->f_name;
$itemprops[gettext_noop('Website')] = $radio->f_link;
$itemprops[gettext_noop('Stream')] = $radio->f_url_link;
$itemprops[gettext_noop('Codec')] = scrub_out($video->codec);
foreach ($itemprops as $key => $value) {
if (trim($value)) {
$rowparity = UI::flip_class();
echo "<dt class=\"" . $rowparity . "\">" . T_($key) . "</dt><dd class=\"" . $rowparity . "\">" . $value . "</dd>";
}
}
?>
</dl>
<?php UI::show_box_bottom(); ?>

View file

@ -30,6 +30,12 @@
?>
</div>
</td>
<td class="cel_cover">
<?php
$thumb = (isset($browse) && !$browse->get_grid_view()) ? 11 : 1;
$libitem->display_art($thumb);
?>
</td>
<td class="cel_streamname"><?php echo $libitem->f_link; ?></td>
<td class="cel_streamurl"><?php echo $libitem->f_url_link; ?></td>
<td class="cel_codec"><?php echo $libitem->codec; ?></td>

View file

@ -20,6 +20,24 @@
*
*/
?>
<?php if (Access::check('interface', '50')) {
?>
<?php UI::show_box_top(T_('Manage Radio Stations'),'info-box');
?>
<div id="information_actions">
<ul>
<li>
<a href="<?php echo AmpConfig::get('web_path');
?>/radio.php?action=show_create"><?php echo UI::get_icon('add', T_('Add'));
?> <?php echo T_('Add Radio Station');
?></a>
</li>
</ul>
</div>
<?php UI::show_box_bottom();
?>
<?php
} ?>
<?php if ($browse->get_show_header()) {
require AmpConfig::get('prefix') . UI::find_template('list_header.inc.php');
} ?>
@ -27,6 +45,7 @@
<thead>
<tr class="th-top">
<th class="cel_play essential"></th>
<th class="cel_cover optional"><?php echo T_('Art') ?></th>
<th class="cel_streamname essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=name', T_('Name'),'live_stream_sort_name'); ?></th>
<th class="cel_streamurl optional"><?php echo T_('Stream URL'); ?></th>
<th class="cel_codec optional"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=codec', T_('Codec'),'live_stream_codec'); ?></th>
@ -59,6 +78,7 @@
<tfoot>
<tr class="th-bottom">
<th class="cel_play"></th>
<th class="cel_cover"><?php echo T_('Art') ?></th>
<th class="cel_streamname"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=name', T_('Name'),'live_stream_sort_name'); ?></th>
<th class="cel_streamurl"><?php echo T_('Stream URL'); ?></th>
<th class="cel_codec"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=codec', T_('Codec'),'live_stream_codec_bottom'); ?></th>

View file

@ -24,8 +24,8 @@ $web_path = AmpConfig::get('web_path');
?>
<ul id="sidebar-light">
<li><a href="<?php echo $web_path ?>/mashup.php?action=album"><img src="<?php echo $web_path ?>/images/topmenu-album.png" title="<?php echo T_('Albums') ?>" /><br /><?php echo T_('Albums') ?></a></li>
<li><a href="<?php echo $web_path ?>/mashup.php?action=artist"><img src="<?php echo $web_path ?>/images/topmenu-artist.png" title="<?php echo T_('Artists') ?>" /><br /><?php echo T_('Artists') ?></a></li>
<li><a href="<?php echo $web_path ?>/mashup.php?action=album"><img src="<?php echo $web_path ?>/images/topmenu-album.png" title="<?php echo T_('Albums') ?>" /><br /><?php echo T_('Albums') ?></a></li>
<li><a href="<?php echo $web_path ?>/browse.php?action=playlist"><img src="<?php echo $web_path ?>/images/topmenu-playlist.png" title="<?php echo T_('Playlists') ?>" /><br /><?php echo T_('Playlists') ?></a></li>
<li><a href="<?php echo $web_path ?>/browse.php?action=tag"><img src="<?php echo $web_path ?>/images/topmenu-tagcloud.png" title="<?php echo T_('Tag Cloud') ?>" /><br /><?php echo T_('Tag Cloud') ?></a></li>
<?php if (AmpConfig::get('live_stream')) {