mirror of
https://github.com/danbee/neompc
synced 2025-03-04 08:39:10 +00:00
+ Added metadata browse mode. Unfinished. Still need to add the crumb trail across the top and make the play/play all buttons work.
This commit is contained in:
parent
380e95b06e
commit
9d8cf6704d
@ -4,10 +4,18 @@
|
|||||||
** NeoMPC Config File
|
** NeoMPC Config File
|
||||||
**************************************/
|
**************************************/
|
||||||
|
|
||||||
|
/* Config relating to the display of CD covers */
|
||||||
|
/******** THIS IS NOT YET IMPLEMENTED! *********/
|
||||||
$_CONFIG['music_directory'] = '/var/lib/mpd/music';
|
$_CONFIG['music_directory'] = '/var/lib/mpd/music';
|
||||||
|
$_CONFIG['album_cover_name'] = 'folder.jpg';
|
||||||
|
/***********************************************/
|
||||||
|
|
||||||
|
/* Template to use for displaying the pages */
|
||||||
$_CONFIG['template'] = 'default';
|
$_CONFIG['template'] = 'default';
|
||||||
|
|
||||||
|
/* Browse mode can be 'filesystem' or 'metadata' */
|
||||||
|
$_CONFIG['browse_mode'] = 'metadata';
|
||||||
|
|
||||||
$_CONFIG['sort_by_tracknumber'] = true;
|
$_CONFIG['sort_by_tracknumber'] = true;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
BIN
images/album.gif
Normal file
BIN
images/album.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 58 B |
BIN
images/artist.gif
Normal file
BIN
images/artist.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 58 B |
@ -67,15 +67,4 @@
|
|||||||
$page = 'playlist';
|
$page = 'playlist';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* do the same with the current browse position */
|
|
||||||
if ($_GET['browse']) {
|
|
||||||
$browse = $_GET['browse'];
|
|
||||||
setcookie('browse', stripslashes($browse));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$browse = $_COOKIE['browse'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$browse = stripslashes($browse);
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
90
lib/page.php
90
lib/page.php
@ -19,6 +19,93 @@
|
|||||||
break;
|
break;
|
||||||
case "browse":
|
case "browse":
|
||||||
|
|
||||||
|
switch ($_CONFIG['browse_mode']) {
|
||||||
|
|
||||||
|
case 'metadata': /* metadata based browsing. this will list artists->albums->tracks */
|
||||||
|
|
||||||
|
/* split the browse get var if present */
|
||||||
|
if ($_GET['browse']) {
|
||||||
|
if ($_GET['browse'] == '/') {
|
||||||
|
$browse_bits[0] = 'artists';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$browse_bits = split('::', $_GET['browse']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//print_r($browse_bits);
|
||||||
|
|
||||||
|
/* set the meta_level */
|
||||||
|
if ($browse_bits[0]) {
|
||||||
|
$meta_level = $browse_bits[0];
|
||||||
|
}
|
||||||
|
elseif ($_COOKIE['meta_level']) {
|
||||||
|
$meta_level = $_COOKIE['meta_level'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$meta_level = 'artists';
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($meta_level) { /* we need to get the information differently for different meta levels */
|
||||||
|
|
||||||
|
case 'artists':
|
||||||
|
$artists = $mympd->GetArtists();
|
||||||
|
|
||||||
|
foreach ($artists as $artist) {
|
||||||
|
$browselist[]['metaArtist'] = $artist;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'albums':
|
||||||
|
$albums = $mympd->GetAlbums($browse_bits[1]);
|
||||||
|
|
||||||
|
foreach ($albums as $album) {
|
||||||
|
$browselist[]['metaAlbum'] = $album;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'tracks':
|
||||||
|
|
||||||
|
$tracks = $mympd->Find(MPD_SEARCH_ALBUM, $browse_bits[1]);
|
||||||
|
|
||||||
|
/*
|
||||||
|
echo '<pre>';
|
||||||
|
print_r($tracks);
|
||||||
|
echo '</pre>';
|
||||||
|
//*/
|
||||||
|
|
||||||
|
/* foreach ($albums as $album) {
|
||||||
|
$browselist[]['metaAlbum'] = $album;
|
||||||
|
} */
|
||||||
|
|
||||||
|
$browselist = $tracks;
|
||||||
|
|
||||||
|
if ($_CONFIG['sort_by_tracknumber']) {
|
||||||
|
usort($browselist, "track_sort");
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$smarty->assign('browselist', $browselist);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'filesystem': /* filesystem based browsing. this will follow the filesystem tree */
|
||||||
|
|
||||||
|
/* get the browse position from the cookie or from get */
|
||||||
|
if ($_GET['browse']) {
|
||||||
|
$browse = $_GET['browse'];
|
||||||
|
setcookie('browse', stripslashes($browse));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$browse = $_COOKIE['browse'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$browse = stripslashes($browse);
|
||||||
|
|
||||||
/* make the path array */
|
/* make the path array */
|
||||||
|
|
||||||
if ($browse == '/') {
|
if ($browse == '/') {
|
||||||
@ -79,6 +166,9 @@
|
|||||||
|
|
||||||
$smarty->assign('browselist', $browselist);
|
$smarty->assign('browselist', $browselist);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
//echo '<pre style="text-align: left;">';
|
//echo '<pre style="text-align: left;">';
|
||||||
//print_r($mympd->GetDir($browse));
|
//print_r($mympd->GetDir($browse));
|
||||||
//echo '</pre>';
|
//echo '</pre>';
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
<ul id="crumb_trail">
|
<ul id="crumb_trail">
|
||||||
<li>• <a href="index.php?browse=/"><img src="images/home.gif" alt="Home" /></a></li>
|
<li><a href="index.php?browse=/"><img src="images/home.gif" alt="Home" /></a></li>
|
||||||
|
|
||||||
{foreach from=$dir_list item=dir_list_item}
|
{foreach from=$dir_list item=dir_list_item}
|
||||||
<li>• <a href="index.php?browse={$dir_list_item.path|escape:'url'}">{$dir_list_item.name|escape:'html'}</a></li>
|
<li>• <a href="index.php?browse={$dir_list_item.path|escape:'url'}">{$dir_list_item.name|escape:'html'}</a></li>
|
||||||
|
|||||||
@ -3,7 +3,15 @@
|
|||||||
|
|
||||||
<li><a href="index.php?browse={$browselist_item.directory|escape:'url'}"><img src="images/dir.gif" class="icon" /> {$browselist_item.directory_name|escape:'html'}</a></li>
|
<li><a href="index.php?browse={$browselist_item.directory|escape:'url'}"><img src="images/dir.gif" class="icon" /> {$browselist_item.directory_name|escape:'html'}</a></li>
|
||||||
|
|
||||||
{else}
|
{elseif $browselist_item.metaArtist}
|
||||||
|
|
||||||
|
<li><a href="index.php?browse=albums::{$browselist_item.metaArtist|escape:'url'}"><img src="images/artist.gif" class="icon" /> {$browselist_item.metaArtist|escape:'html'}</a></li>
|
||||||
|
|
||||||
|
{elseif $browselist_item.metaAlbum}
|
||||||
|
|
||||||
|
<li><a href="index.php?browse=tracks::{$browselist_item.metaAlbum|escape:'url'}"><img src="images/album.gif" class="icon" /> {$browselist_item.metaAlbum|escape:'html'}</a></li>
|
||||||
|
|
||||||
|
{elseif $browselist_item.Title}
|
||||||
|
|
||||||
{if $browselist_item.in_playlist}<li style="background: #555;">{else}<li>{/if}<a href="{$browselist_add_link}{$browselist_item.file|escape:'url'}"><img src="images/add.gif" alt="Add" class="button" /></a><a href="{$browselist_play_link}{$browselist_item.file|escape:'url'}"><img src="images/play.gif" alt="Play" class="button" /></a><img src="images/note.gif" class="icon" /> {if $browselist_item.Title|escape:'html'}<span class="title">{$browselist_item.Title|escape:'html'}</span><br /><span class="artist">{$browselist_item.Artist|escape:'html'}</span> <span class="album">({$browselist_item.Album|escape:'html'})</span>{else}{$browselist_item.file|escape:'html'}{/if}</li>
|
{if $browselist_item.in_playlist}<li style="background: #555;">{else}<li>{/if}<a href="{$browselist_add_link}{$browselist_item.file|escape:'url'}"><img src="images/add.gif" alt="Add" class="button" /></a><a href="{$browselist_play_link}{$browselist_item.file|escape:'url'}"><img src="images/play.gif" alt="Play" class="button" /></a><img src="images/note.gif" class="icon" /> {if $browselist_item.Title|escape:'html'}<span class="title">{$browselist_item.Title|escape:'html'}</span><br /><span class="artist">{$browselist_item.Artist|escape:'html'}</span> <span class="album">({$browselist_item.Album|escape:'html'})</span>{else}{$browselist_item.file|escape:'html'}{/if}</li>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user