1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 09:49:30 +02:00

Add video support to playlist (fix #675)

This commit is contained in:
Afterster 2015-12-27 21:25:30 +01:00
parent 9d9f7a2711
commit aa19993358
23 changed files with 284 additions and 135 deletions

View file

@ -70,6 +70,7 @@ function convertMediaToJPMedia(media)
jpmedia['artist_id'] = media['artist_id'];
jpmedia['album_id'] = media['album_id'];
jpmedia['media_id'] = media['media_id'];
jpmedia['media_type'] = media['media_type'];
jpmedia['replaygain_track_gain'] = media['replaygain_track_gain'];
jpmedia['replaygain_track_peak'] = media['replaygain_track_peak'];
jpmedia['replaygain_album_gain'] = media['replaygain_album_gain'];
@ -246,21 +247,24 @@ function ShowEqualizer()
function SavePlaylist()
{
var url = "<?php echo AmpConfig::get('ajax_url');
?>?page=playlist&action=append_item&item_type=song&item_id=";
for (var i = 0; i < jplaylist['playlist'].length; i++) {
url += "," + jplaylist['playlist'][i]["media_id"];
if (jplaylist['playlist'].length > 0) {
var url = "<?php echo AmpConfig::get('ajax_url') ?>?page=playlist&action=append_item&item_type=" + jplaylist['playlist'][0]["media_type"] + "&item_id=";
for (var i = 0; i < jplaylist['playlist'].length; i++) {
url += "," + jplaylist['playlist'][i]["media_id"];
}
handlePlaylistAction(url, 'rb_append_dplaylist_new');
}
handlePlaylistAction(url, 'rb_append_dplaylist_new');
}
function SaveToExistingPlaylist(event)
{
var item_ids = "";
for (var i = 0; i < jplaylist['playlist'].length; i++) {
item_ids += "," + jplaylist['playlist'][i]["media_id"];
if (jplaylist['playlist'].length > 0) {
var item_ids = "";
for (var i = 0; i < jplaylist['playlist'].length; i++) {
item_ids += "," + jplaylist['playlist'][i]["media_id"];
}
showPlaylistDialog(event, jplaylist['playlist'][0]["media_type"], item_ids);
}
showPlaylistDialog(event, 'song', item_ids);
}
var audioContext = null;

View file

@ -66,7 +66,7 @@ UI::show_box_top('<div id="playlist_row_' . $playlist->id . '">' . $title . '</d
?>', 'reorder_playlist_table', 'track_',
'<?php echo AmpConfig::get('web_path');
?>/playlist.php?action=set_track_numbers&playlist_id=<?php echo $playlist->id;
?>', 'refresh_playlist_songs')">
?>', 'refresh_playlist_medias')">
<?php echo UI::get_icon('save', T_('Save Tracks Order'));
?>
&nbsp;&nbsp;<?php echo T_('Save Tracks Order');
@ -168,7 +168,7 @@ UI::show_box_top('<div id="playlist_row_' . $playlist->id . '">' . $title . '</d
<div id='reordered_list_<?php echo $playlist->id; ?>'>
<?php
$browse = new Browse();
$browse->set_type('playlist_song');
$browse->set_type('playlist_media');
$browse->add_supplemental_object('playlist', $playlist->id);
$browse->set_static_content(true);
$browse->show_objects($object_ids, true);

View file

@ -20,29 +20,29 @@
*
*/
// Don't show disabled songs to normal users
if ($libitem->enabled || Access::check('interface','50')) {
// Don't show disabled medias to normal users
if (!isset($libitem->enabled) || $libitem->enabled || Access::check('interface','50')) {
?>
<td class="cel_play">
<span class="cel_play_content"><?php echo '<b>' . $playlist_track . '</b>' ?></span>
<div class="cel_play_hover">
<?php
if (AmpConfig::get('directplay')) {
echo Ajax::button('?page=stream&action=directplay&object_type=song&object_id=' . $libitem->id, 'play', T_('Play'),'play_playlist_song_' . $libitem->id);
echo Ajax::button('?page=stream&action=directplay&object_type=' . $object_type . '&object_id=' . $libitem->id, 'play', T_('Play'),'play_playlist_' . $object_type . '_' . $libitem->id);
if (Stream_Playlist::check_autoplay_append()) {
echo Ajax::button('?page=stream&action=directplay&object_type=song&object_id=' . $libitem->id . '&append=true','play_add', T_('Play last'),'addplay_song_' . $libitem->id);
echo Ajax::button('?page=stream&action=directplay&object_type=' . $object_type . '&object_id=' . $libitem->id . '&append=true','play_add', T_('Play last'),'addplay_' . $object_type . '_' . $libitem->id);
}
}
?>
</div>
</td>
<td class="cel_song"><?php echo $libitem->f_link ?></td>
<td class="cel_title"><?php echo $libitem->f_link ?></td>
<td class="cel_add">
<span class="cel_item_add">
<?php echo Ajax::button('?action=basket&type=song&id=' . $libitem->id,'add', T_('Add to temporary playlist'),'playlist_add_' . $libitem->id);
<?php echo Ajax::button('?action=basket&type=' . $object_type . '&id=' . $libitem->id,'add', T_('Add to temporary playlist'),'playlist_add_' . $libitem->id);
if (Access::check('interface', '25')) {
?>
<a id="<?php echo 'add_playlist_' . $libitem->id ?>" onclick="showPlaylistDialog(event, 'song', '<?php echo $libitem->id ?>')">
<a id="<?php echo 'add_playlist_' . $libitem->id ?>" onclick="showPlaylistDialog(event, '<?php echo $object_type ?>', '<?php echo $libitem->id ?>')">
<?php echo UI::get_icon('playlist_add', T_('Add to existing playlist')) ?>
</a>
<?php
@ -50,19 +50,16 @@ if ($libitem->enabled || Access::check('interface','50')) {
?>
</span>
</td>
<td class="cel_artist"><?php echo $libitem->f_artist_link ?></td>
<td class="cel_album"><?php echo $libitem->f_album_link ?></td>
<td class="cel_tags"><?php echo $libitem->f_tags ?></td>
<td class="cel_time"><?php echo $libitem->f_time ?></td>
<?php if (User::is_registered()) {
if (AmpConfig::get('ratings')) {
?>
<td class="cel_rating" id="rating_<?php echo $libitem->id ?>_song"><?php Rating::show($libitem->id,'song') ?></td>
<td class="cel_rating" id="rating_<?php echo $libitem->id ?>_<?php echo $object_type ?>"><?php Rating::show($libitem->id,$object_type) ?></td>
<?php
}
if (AmpConfig::get('userflags')) {
?>
<td class="cel_userflag" id="userflag_<?php echo $libitem->id ?>_song"><?php Userflag::show($libitem->id,'song') ?></td>
<td class="cel_userflag" id="userflag_<?php echo $libitem->id ?>_<?php echo $object_type ?>"><?php Userflag::show($libitem->id,$object_type) ?></td>
<?php
}
}
@ -70,14 +67,14 @@ if ($libitem->enabled || Access::check('interface','50')) {
<td class="cel_action">
<?php if (AmpConfig::get('download')) {
?>
<a rel="nohtml" href="<?php echo AmpConfig::get('web_path') ?>/stream.php?action=download&amp;song_id=<?php echo $libitem->id ?>">
<a rel="nohtml" href="<?php echo AmpConfig::get('web_path') ?>/stream.php?action=download&amp;<?php echo $object_type ?>_id=<?php echo $libitem->id ?>">
<?php echo UI::get_icon('download', T_('Download')) ?>
</a>
<?php
}
if (Access::check('interface', '25')) {
if (AmpConfig::get('share')) {
Share::display_ui('song', $libitem->id, false);
Share::display_ui($object_type, $libitem->id, false);
}
}
if (get_class($playlist) == "Playlist" && $playlist->has_access()) {

View file

@ -30,16 +30,13 @@ $web_path = AmpConfig::get('web_path');
<thead>
<tr class="th-top">
<th class="cel_play essential"></th>
<th class="cel_song essential persist"><?php echo T_('Song Title'); ?></th>
<th class="cel_title essential persist"><?php echo T_('Title'); ?></th>
<th class="cel_add essential"></th>
<th class="cel_artist essential"><?php echo T_('Artist'); ?></th>
<th class="cel_album optional"><?php echo T_('Album'); ?></th>
<th class="cel_tags optional"><?php echo T_('Tags'); ?></th>
<th class="cel_time optional"><?php echo T_('Time'); ?></th>
<?php if (User::is_registered()) {
?>
<?php if (AmpConfig::get('ratings')) {
Rating::build_cache('song', array_map(create_function('$i', '$i=(array) $i; return $i[\'object_id\'];'), $object_ids));
;
?>
<th class="cel_rating"><?php echo T_('Rating');
?></th>
@ -47,7 +44,6 @@ $web_path = AmpConfig::get('web_path');
}
?>
<?php if (AmpConfig::get('userflags')) {
Userflag::build_cache('song', array_map(create_function('$i', '$i=(array) $i; return $i[\'object_id\'];'), $object_ids));
?>
<?php
}
@ -65,27 +61,26 @@ $web_path = AmpConfig::get('web_path');
if (!is_array($object)) {
$object = (array) $object;
}
$libitem = new Song($object['object_id']);
$libitem->format();
$playlist_track = $object['track'];
?>
<tr class="<?php echo UI::flip_class();
?>" id="track_<?php echo $object['track_id'];
?>">
<?php require AmpConfig::get('prefix') . UI::find_template('show_playlist_song_row.inc.php');
?>
</tr>
<?php
$object_type = $object['object_type'];
if (Core::is_library_item($object_type)) {
$libitem = new $object_type($object['object_id']);
$libitem->format();
$playlist_track = $object['track'];
?>
<tr class="<?php echo UI::flip_class() ?>" id="track_<?php echo $object['track_id'] ?>">
<?php require AmpConfig::get('prefix') . UI::find_template('show_playlist_media_row.inc.php');
?>
</tr>
<?php
}
} ?>
</tbody>
<tfoot>
<tr class="th-bottom">
<th class="cel_play"><?php echo T_('Play'); ?></th>
<th class="cel_song"><?php echo T_('Song Title'); ?></th>
<th class="cel_title"><?php echo T_('Title'); ?></th>
<th class="cel_add"></th>
<th class="cel_artist"><?php echo T_('Artist'); ?></th>
<th class="cel_album"><?php echo T_('Album'); ?></th>
<th class="cel_tags"><?php echo T_('Tags'); ?></th>
<th class="cel_time"><?php echo T_('Time'); ?></th>
<?php if (User::is_registered()) {
?>

View file

@ -54,7 +54,7 @@
</span>
</td>
<td class="cel_type"><?php echo $libitem->f_type; ?></td>
<td class="cel_songs"><?php echo $libitem->get_song_count(); ?></td>
<td class="cel_medias"><?php echo $libitem->get_media_count(); ?></td>
<td class="cel_owner"><?php echo scrub_out($libitem->f_user); ?></td>
<?php
if (User::is_registered()) {

View file

@ -30,7 +30,7 @@
<th class="cel_playlist essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=playlist&sort=name', T_('Playlist Name'),'playlist_sort_name'); ?></th>
<th class="cel_add essential"></th>
<th class="cel_type optional"><?php echo T_('Type'); ?></th>
<th class="cel_songs optional"><?php echo T_('# Songs'); ?></th>
<th class="cel_medias optional"><?php echo T_('# Medias'); ?></th>
<th class="cel_owner optional"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=playlist&sort=user', T_('Owner'),'playlist_sort_owner'); ?></th>
<?php if (User::is_registered()) {
?>
@ -83,7 +83,7 @@
<th class="cel_playlist essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=playlist&sort=name', T_('Playlist Name'),'playlist_sort_name'); ?></th>
<th class="cel_add essential"></th>
<th class="cel_type optional"><?php echo T_('Type'); ?></th>
<th class="cel_songs optional"><?php echo T_('# Songs'); ?></th>
<th class="cel_medias optional"><?php echo T_('# Medias'); ?></th>
<th class="cel_owner optional"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=playlist&sort=user', T_('Owner'),'playlist_sort_owner_bottom'); ?></th>
<?php if (User::is_registered()) {
?>

View file

@ -93,6 +93,8 @@
<?php
}
?>
<?php echo Ajax::button('?action=basket&type=podcast_episode&id=' . $episode->id,'add', T_('Add to temporary playlist'),'add_podcast_episode_' . $episode->id);
?>
<?php
} ?>

View file

@ -37,6 +37,22 @@
</div>
</td>
<td class="cel_title"><?php echo $libitem->f_link; ?></td>
<td class="cel_add">
<span class="cel_item_add">
<?php
echo Ajax::button('?action=basket&type=podcast_episode&id=' . $libitem->id,'add', T_('Add to temporary playlist'),'add_' . $libitem->id);
if (Access::check('interface', '25')) {
?>
<a id="<?php echo 'add_playlist_' . $libitem->id ?>" onclick="showPlaylistDialog(event, 'podcast_episode', '<?php echo $libitem->id ?>')">
<?php echo UI::get_icon('playlist_add', T_('Add to existing playlist'));
?>
</a>
<?php
}
?>
</span>
</td>
<td class="cel_podcast"><?php echo $libitem->f_podcast_link; ?></td>
<td class="cel_time"><?php echo $libitem->f_time; ?></td>
<td class="cel_pubdate"><?php echo $libitem->f_pubdate; ?></td>

View file

@ -29,6 +29,7 @@ $thcount = 7;
<tr class="th-top">
<th class="cel_play essential"></th>
<th class="cel_title essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=title', T_('Title'),'podcast_episode_sort_title'); ?></th>
<th class="cel_add essential"></th>
<th class="cel_podcast optional"><?php echo T_('Podcast'); ?></th>
<th class="cel_time optional"><?php echo T_('Time'); ?></th>
<th class="cel_pubdate optional"><?php echo T_('Publication Date'); ?></th>
@ -98,6 +99,7 @@ $thcount = 7;
<?php
} ?>
<th class="cel_title"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=title', T_('Title'),'podcast_episode_sort_title_bottom'); ?></th>
<th class="cel_add"></th>
<th class="cel_podcast"><?php echo T_('Podcast'); ?></th>
<th class="cel_time"><?php echo T_('Time'); ?></th>
<th class="cel_pubdate"><?php echo T_('Publication Date'); ?></th>

View file

@ -74,7 +74,7 @@ UI::show_box_top('<div id="smartplaylist_row_' . $playlist->id . '">' . $title .
<div>
<?php
$browse = new Browse();
$browse->set_type('playlist_song');
$browse->set_type('playlist_media');
$browse->add_supplemental_object('search', $playlist->id);
$browse->set_static_content(false);
$browse->show_objects($object_ids);

View file

@ -112,6 +112,7 @@ $subtitles = $video->get_subtitles();
?>
<?php
} ?>
<?php echo Ajax::button('?action=basket&type=video&id=' . $video->id,'add', T_('Add to temporary playlist'),'add_video_' . $video->id); ?>
<?php if (!AmpConfig::get('use_auth') || Access::check('interface','25')) {
?>
<?php if (AmpConfig::get('sociable')) {

View file

@ -59,6 +59,22 @@ if (Art::is_enabled()) {
<?php
} ?>
<td class="cel_title"><?php echo $libitem->f_link; ?></td>
<td class="cel_add">
<span class="cel_item_add">
<?php
echo Ajax::button('?action=basket&type=video&id=' . $libitem->id,'add', T_('Add to temporary playlist'),'add_' . $libitem->id);
if (Access::check('interface', '25')) {
?>
<a id="<?php echo 'add_playlist_' . $libitem->id ?>" onclick="showPlaylistDialog(event, 'video', '<?php echo $libitem->id ?>')">
<?php echo UI::get_icon('playlist_add', T_('Add to existing playlist'));
?>
</a>
<?php
}
?>
</span>
</td>
<?php
if ($video_type != 'video') {
require AmpConfig::get('prefix') . UI::find_template('show_partial_' . $video_type . '_row.inc.php');

View file

@ -36,6 +36,7 @@ if ($browse->get_show_header()) {
<?php
} ?>
<th class="cel_title essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=video&sort=title', T_('Title'),'sort_video_title'); ?></th>
<th class="cel_add essential"></th>
<?php
if (isset($video_type) && $video_type != 'video') {
require AmpConfig::get('prefix') . UI::find_template('show_partial_' . $video_type . 's.inc.php');
@ -112,6 +113,7 @@ if (isset($video_type) && $video_type != 'video') {
<?php
} ?>
<th class="cel_title"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=video&sort=title', T_('Title'),'sort_video_title'); ?></th>
<th class="cel_add"></th>
<?php
if (isset($video_type) && $video_type != 'video') {
require AmpConfig::get('prefix') . UI::find_template('show_partial_' . $video_type . 's.inc.php');