mirror of
https://github.com/danbee/neompc
synced 2025-03-04 08:39:10 +00:00
+ Cover image filenames can now consist of variables.
+ Shuffle button added to playlist screen.
This commit is contained in:
parent
12370286d8
commit
548670fd42
@ -12,7 +12,7 @@
|
|||||||
/* Config relating to the display of CD covers */
|
/* Config relating to the display of CD covers */
|
||||||
/* music_directory must match you MPD music_directory config */
|
/* music_directory must match you MPD music_directory config */
|
||||||
$_CONFIG['music_directory'] = '/var/lib/mpd/music';
|
$_CONFIG['music_directory'] = '/var/lib/mpd/music';
|
||||||
$_CONFIG['album_cover_name'] = '{:artist:} - {:album:}.jpg';
|
$_CONFIG['album_cover_name'] = '{Artist} - {Album}.jpg';
|
||||||
|
|
||||||
/* Template to use for displaying the pages */
|
/* Template to use for displaying the pages */
|
||||||
$_CONFIG['template'] = 'default';
|
$_CONFIG['template'] = 'default';
|
||||||
|
|||||||
@ -53,7 +53,7 @@ function mpd_info() {
|
|||||||
|
|
||||||
$cover_link = $_CONFIG['music_directory'] . '/'
|
$cover_link = $_CONFIG['music_directory'] . '/'
|
||||||
. substr($current_track['file'], 0, strrpos($current_track['file'], '/') + 1)
|
. substr($current_track['file'], 0, strrpos($current_track['file'], '/') + 1)
|
||||||
. $_CONFIG['album_cover_name'];
|
. var_filter($current_track, $_CONFIG['album_cover_name']);
|
||||||
|
|
||||||
if (file_exists($cover_link)) {
|
if (file_exists($cover_link)) {
|
||||||
$info['coverimage'] = 'lib/image.php?file=' . $cover_link . '&size=' . $_CONFIG['album_cover_size'];
|
$info['coverimage'] = 'lib/image.php?file=' . $cover_link . '&size=' . $_CONFIG['album_cover_size'];
|
||||||
|
|||||||
@ -9,7 +9,6 @@
|
|||||||
require("lib/global.php");
|
require("lib/global.php");
|
||||||
require("lib/actions.php");
|
require("lib/actions.php");
|
||||||
require("lib/page.php");
|
require("lib/page.php");
|
||||||
|
|
||||||
/* output the template */
|
/* output the template */
|
||||||
$smarty->display($_CONFIG['template'] . '/index.html');
|
$smarty->display($_CONFIG['template'] . '/index.html');
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch($_GET['action']) {
|
switch($_GET['action']) {
|
||||||
|
case "shuffle":
|
||||||
|
$mympd->PLShuffle();
|
||||||
|
break;
|
||||||
|
|
||||||
case "clear":
|
case "clear":
|
||||||
$mympd->PLClear();
|
$mympd->PLClear();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -89,6 +89,7 @@
|
|||||||
$smarty->assign('control_link', 'index.php?page=control');
|
$smarty->assign('control_link', 'index.php?page=control');
|
||||||
$smarty->assign('playlist_play_link', 'index.php?page=control&action=play&skipto=');
|
$smarty->assign('playlist_play_link', 'index.php?page=control&action=play&skipto=');
|
||||||
$smarty->assign('playlist_clear_link', 'index.php?action=clear');
|
$smarty->assign('playlist_clear_link', 'index.php?action=clear');
|
||||||
|
$smarty->assign('playlist_shuffle_link', 'index.php?action=shuffle');
|
||||||
$smarty->assign('mpd_state', $mympd->state);
|
$smarty->assign('mpd_state', $mympd->state);
|
||||||
|
|
||||||
/* first check for a page cookie, and default to displaying the playlist */
|
/* first check for a page cookie, and default to displaying the playlist */
|
||||||
@ -106,6 +107,17 @@
|
|||||||
|
|
||||||
//echo $mympd->current_track_length, ' - ', $mympd->current_track_position;
|
//echo $mympd->current_track_length, ' - ', $mympd->current_track_position;
|
||||||
|
|
||||||
$smarty->assign('page', $page);
|
$smarty->assign('page', $page);
|
||||||
|
|
||||||
|
// --------------------------------------
|
||||||
|
|
||||||
|
function var_filter($vars, $string) {
|
||||||
|
if (is_array($vars)){
|
||||||
|
foreach ($vars as $key => $value) {
|
||||||
|
$string = str_replace('{' . $key . '}', $value, $string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $string;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -134,6 +134,10 @@ $(document).ready(function(){
|
|||||||
return confirm('Are you sure you want to clear the whole playlist?');
|
return confirm('Are you sure you want to clear the whole playlist?');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#shuffle').click(function() {
|
||||||
|
return confirm('Are you sure you want shuffle the playlist?');
|
||||||
|
});
|
||||||
|
|
||||||
if (page = 'control') {
|
if (page = 'control') {
|
||||||
ajax_control();
|
ajax_control();
|
||||||
ajax_int = setInterval('ajax_control()', 1000);
|
ajax_int = setInterval('ajax_control()', 1000);
|
||||||
|
|||||||
@ -40,12 +40,13 @@
|
|||||||
$smarty->assign('song_position', $mympd->current_track_position);
|
$smarty->assign('song_position', $mympd->current_track_position);
|
||||||
$smarty->assign('mpd_state', $mympd->state);
|
$smarty->assign('mpd_state', $mympd->state);
|
||||||
|
|
||||||
$cover_link = $_CONFIG['music_directory'] . '/'
|
$cover_path = $_CONFIG['music_directory'] . '/'
|
||||||
. substr($current_track['file'], 0, strrpos($current_track['file'], '/') + 1)
|
. substr($current_track['file'], 0, strrpos($current_track['file'], '/') + 1);
|
||||||
. $_CONFIG['album_cover_name'];
|
$cover_file = $_CONFIG['album_cover_name'];
|
||||||
|
|
||||||
if (file_exists($cover_link)) {
|
if (file_exists($cover_link)) {
|
||||||
$smarty->assign('coverimage', $cover_link);
|
$smarty->assign('coverpath', $cover_link);
|
||||||
|
$smarty->assign('coverfile', $cover_file);
|
||||||
$smarty->assign('coversize', $_CONFIG['album_cover_size']);
|
$smarty->assign('coversize', $_CONFIG['album_cover_size']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 614 B |
@ -1,5 +1,10 @@
|
|||||||
<div id="list_header">
|
<div id="list_header">
|
||||||
<div id="buttons"><a id="removeall" href="{:$playlist_clear_link:}"><img src="templates/{:$template:}/images/delall.png" /></a></div>
|
<div id="buttons">
|
||||||
|
<a id="removeall" href="{:$playlist_clear_link:}"><img src="templates/{:$template:}/images/delall.png" /></a>
|
||||||
|
</div>
|
||||||
|
<div id="buttons_left">
|
||||||
|
<a id="shuffle" href="{:$playlist_shuffle_link:}"><img src="templates/{:$template:}/images/shuffle.png" /></a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{:if $playlist:}
|
{:if $playlist:}
|
||||||
|
|||||||
@ -186,6 +186,11 @@ li .title {
|
|||||||
margin: 5px 5px 0px 0px;
|
margin: 5px 5px 0px 0px;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
#buttons_left {
|
||||||
|
float: left;
|
||||||
|
margin: 5px 5px 0px 5px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
img.icon {
|
img.icon {
|
||||||
margin: 2px 2px -1px 2px;
|
margin: 2px 2px -1px 2px;
|
||||||
@ -269,10 +274,10 @@ img.button {
|
|||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
#volume_repeat #volume_button {
|
#volume_repeat #volume_button {
|
||||||
background-image: url(templates/{:$template:}/images/volume.png);
|
background-image: url(templates/{:$template:}/images/volume_button.png);
|
||||||
}
|
}
|
||||||
#volume_repeat #repeat_button {
|
#volume_repeat #repeat_button {
|
||||||
background-image: url(templates/{:$template:}/images/repeat.png);
|
background-image: url(templates/{:$template:}/images/repeat_button.png);
|
||||||
}
|
}
|
||||||
#volume_repeat #volume_button:hover {
|
#volume_repeat #volume_button:hover {
|
||||||
background-position: 0px -20px;
|
background-position: 0px -20px;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user