1
0
mirror of https://github.com/danbee/neompc synced 2025-03-04 08:39:10 +00:00

+ Control page now auto refreshes for next track. Still needs full testing.

~ Few changes to the layout.
This commit is contained in:
Dan Barber 2007-05-14 21:34:24 +00:00
parent 57e537d177
commit a672dca6f1
8 changed files with 35 additions and 21 deletions

View File

@ -6,7 +6,7 @@
/* Config relating to the display of CD covers */
/* music_directory must match you MPD music_directory config */
$_CONFIG['music_directory'] = '/home/danbee/Music';
$_CONFIG['music_directory'] = '/home/media/data/audio';
$_CONFIG['album_cover_name'] = 'folder.jpg';
$_CONFIG['album_cover_size'] = 130;

View File

@ -1,14 +1,14 @@
<?php
/* Smarty stuff */
$version = 0.5;
if (get_magic_quotes_gpc()) {
/* Deal with Magic quotes. We can safely strip these off as we're not using a database. */
$_REQUEST = array_map('stripslashes', $_REQUEST);
$_GET = array_map('stripslashes', $_GET);
$_POST = array_map('stripslashes', $_POST);
$_COOKIE = array_map('stripslashes', $_COOKIE);
$version = 0.5;
if (get_magic_quotes_gpc()) {
/* Deal with Magic quotes. We can safely strip these off as we're not using a database. */
$_REQUEST = array_map('stripslashes', $_REQUEST);
$_GET = array_map('stripslashes', $_GET);
$_POST = array_map('stripslashes', $_POST);
$_COOKIE = array_map('stripslashes', $_COOKIE);
}
require('config/config.inc.php');
@ -78,6 +78,8 @@
if (!$page) {
$page = 'playlist';
}
//echo $mympd->current_track_length, ' - ', $mympd->current_track_position;
$smarty->assign('page', $page);

View File

@ -8,11 +8,11 @@
// Content type
header('Content-type: image/jpeg');
$script_root = substr($_SERVER["SCRIPT_FILENAME"], 0, strrpos(substr($_SERVER["SCRIPT_FILENAME"], 0, strrpos($_SERVER["SCRIPT_FILENAME"], '/')), '/'));
$cache_file_name = "$script_root/imagecache/" . md5($filename . $width) . ".jpg";
if (!file_exists($cache_file_name)) {
// Get new dimensions
@ -30,10 +30,10 @@
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
// Output
imagejpeg($image_p, $cache_file_name, 95);
}
echo file_get_contents($cache_file_name);

View File

@ -35,6 +35,16 @@
$smarty->assign('coversize', $_CONFIG['album_cover_size']);
}
$time_left = (($mympd->current_track_length - $mympd->current_track_position) + 2) * 1000;
//echo $time_left / 1000;
if ($mympd->state == MPD_STATE_PLAYING) {
$smarty->assign('refresh',
"<script>setTimeout('window.location.replace(unescape(window.location.pathname));', "
. $time_left . ");</script>");
}
break;
case "browse":

View File

@ -1,5 +1,5 @@
<div id="song_display">{if $current_title}<span class="pos">{$current_track_no+1|string_format:"%02d"}.</span> <span class="title">{$current_title}</span><br /><span class="artist">{$current_artist}</span> {if $current_album}<span class="album">({$current_album})</span>{/if}{elseif $current_file}{$current_file}{else}<br />[Nothing playing]{/if}</div>
<div id="song_display">{if $current_title}<span class="pos">{$current_track_no+1|string_format:"%02d"}.</span> <span class="title">{$current_title}</span><br /><span class="artist">{$current_artist}</span> {if $current_album}<!--<span class="album">({$current_album})</span>-->{/if}{elseif $current_file}{$current_file}{else}<br />[Nothing playing]{/if}</div>
{if $coverimage}<div id="cover_image"><img id="cover" src="lib/image.php?file={$coverimage}&size={$coversize}"></div>{/if}
<div id="controls"><a href="index.php?action=prev"><img src="images/prev_button.gif" Alt="Previous" /></a><a href="index.php?action=play"><img src="images/play_button.gif" Alt="Play" /></a><a href="index.php?action=pause"><img src="images/pause_button.gif" Alt="Pause" /></a><a href="index.php?action=stop"><img src="images/stop_button.gif" Alt="Stop" /></a><a href="index.php?action=next"><img src="images/next_button.gif" Alt="Next" /></a></div>

View File

@ -9,9 +9,13 @@
<style>
{include file="default/styles.css"}
</style>
</head>
<body>
{$refresh}
{include file="default/menu.html"}
<div id="page">

View File

@ -1,6 +1,4 @@
<div id="menu">
<a {if $page == 'browse'}class="selected" {/if}href="{$browse_link}">Browse</a>
<a {if $page == 'playlist'}class="selected" {/if}href="{$playlist_link}">Playlist</a>
<a {if $page == 'control'}class="selected" {/if}href="{$control_link}">Control</a>
<a {if $page == 'browse'}class="selected" {/if}href="{$browse_link}">Browse</a><a {if $page == 'playlist'}class="selected" {/if}href="{$playlist_link}">Playlist</a><a {if $page == 'control'}class="selected" {/if}href="{$control_link}">Control</a>
</div>

View File

@ -107,8 +107,8 @@ img.button {
}
#song_display {
width: 215px;
margin: 0px auto;
height: 55px;
margin: 0px auto 5px;
/* height: 55px; */
text-align: center;
font-size: 12px;
}