Make the bottom bar always link to current song and only make the righthand cube do it if there actually is a cover image.
This commit is contained in:
parent
ab0968ed35
commit
4b8a3ab588
1 changed files with 6 additions and 7 deletions
|
@ -3,8 +3,9 @@ require __DIR__ . '/../sig.php';
|
|||
|
||||
if(is_file(NP_INFO)) {
|
||||
$nowPlaying = true;
|
||||
$nowPlayingHasCover = is_file(NP_COVER_IMG);
|
||||
$npInfo = unserialize(file_get_contents(NP_INFO));
|
||||
} else $nowPlaying = false;
|
||||
} else $nowPlaying = $nowPlayingHasCover = false;
|
||||
|
||||
$reqMethod = $_SERVER['REQUEST_METHOD'];
|
||||
$reqPath = '/' . trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/');
|
||||
|
@ -44,9 +45,7 @@ if($reqPath === '/signature.png') {
|
|||
$imagickDraw->setFont(FW_FONT_FAM);
|
||||
$imagickDraw->setFontSize(FW_FONT_SIZE);
|
||||
|
||||
$hasCover = $nowPlaying && is_file(NP_COVER_IMG);
|
||||
|
||||
if($hasCover) {
|
||||
if($nowPlayingHasCover) {
|
||||
try {
|
||||
$imagickDraw->rectangle(
|
||||
SIG_WIDTH - (NP_COVER_RES + NP_COVER_PAD) - NP_COVER_FRAME,
|
||||
|
@ -63,7 +62,7 @@ if($reqPath === '/signature.png') {
|
|||
|
||||
$npCover->destroy();
|
||||
} catch(ImagickException $ex) {
|
||||
$hasCover = false;
|
||||
$nowPlayingHasCover = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,7 +72,7 @@ if($reqPath === '/signature.png') {
|
|||
$imagickLogo->newImage($imagick->getImageWidth(), $imagick->getImageHeight(), new ImagickPixel('none'), 'png');
|
||||
$imagickLogo->annotateImage(
|
||||
$imagickDraw,
|
||||
SIG_WIDTH - (4.8 * FW_FONT_SIZE) - ($hasCover ? (NP_COVER_RES + NP_COVER_PAD + NP_COVER_FRAME) : 0),
|
||||
SIG_WIDTH - (4.8 * FW_FONT_SIZE) - ($nowPlayingHasCover ? (NP_COVER_RES + NP_COVER_PAD + NP_COVER_FRAME) : 0),
|
||||
SIG_HEIGHT - ($nowPlaying ? 37 : 27),
|
||||
0,
|
||||
FW_TEXT
|
||||
|
@ -124,7 +123,7 @@ if($reqPath === '/') {
|
|||
|
||||
http_response_code(302);
|
||||
|
||||
if($x >= (SIG_WIDTH - SIG_HEIGHT) && $nowPlaying) {
|
||||
if($nowPlaying && (($y >= (SIG_HEIGHT - 33)) || ($nowPlayingHasCover && $x >= (SIG_WIDTH - SIG_HEIGHT)))) {
|
||||
header('Location: ' . $npInfo->url);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue