-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added album artwork to rss reviews feed
- Loading branch information
Showing
5 changed files
with
71 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* Zookeeper Online | ||
* | ||
* @author Jim Mason <[email protected]> | ||
* @copyright Copyright (C) 1997-2023 Jim Mason <[email protected]> | ||
* @copyright Copyright (C) 1997-2025 Jim Mason <[email protected]> | ||
* @link https://zookeeper.ibinx.com/ | ||
* @license GPL-3.0 | ||
* | ||
|
@@ -25,6 +25,7 @@ | |
namespace ZK\Controllers; | ||
|
||
use ZK\Engine\Engine; | ||
use ZK\Engine\IArtwork; | ||
use ZK\Engine\IChart; | ||
use ZK\Engine\ILibrary; | ||
use ZK\Engine\IReview; | ||
|
@@ -102,12 +103,19 @@ public function recentReviews() { | |
|
||
$limit = $_REQUEST['limit'] ?? 50; | ||
$results = Engine::api(IReview::class)->getRecentReviews('', 0, $limit); | ||
// coalesce albums into one array for artwork injection | ||
// use foreach, as reference passing does not work with array_map | ||
$albums = []; | ||
foreach($results as &$review) | ||
$albums[] = &$review["album"]; | ||
Engine::api(IArtwork::class)->injectAlbumArt($albums); | ||
foreach($results as &$row) { | ||
$reviews = Engine::api(IReview::class)->getReviews($row['album']['tag'], 0, $row['user']); | ||
if(count($reviews)) | ||
$row['review'] = $reviews[0]['review']; | ||
} | ||
|
||
$this->params['GENRES'] = ILibrary::GENRES; | ||
$this->params['reviews'] = $results; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- Zookeeper Online (C) 1997-2021 Jim Mason <[email protected]> | @source: https://zookeeper.ibinx.com/ | @license: magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3.0 --> | ||
<!-- Zookeeper Online (C) 1997-2025 Jim Mason <[email protected]> | @source: https://zookeeper.ibinx.com/ | @license: magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3.0 --> | ||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
xmlns:dc="http://purl.org/dc/elements/1.1/" | ||
xmlns:zk="http://zookeeper.ibinx.com/zkns" | ||
|
@@ -20,6 +20,12 @@ h2 { | |
.rss-channel > .rss-item { | ||
padding: 2px 0px; | ||
} | ||
.rss-item:has(.album-thumb) { | ||
min-height: 180px; | ||
} | ||
.rss-item .album-thumb img { | ||
border-radius: 5px; | ||
} | ||
]]> | ||
</xsl:text> | ||
</style> | ||
|
@@ -67,6 +73,8 @@ function fixup() { | |
</xsl:template> | ||
<xsl:template match="item"> | ||
<div class="rss-item"> | ||
<div> | ||
<xsl:apply-templates select="zk:albumart"/> | ||
<h3> | ||
<a class="nav" href="{link}"> | ||
<xsl:value-of select="title"/> | ||
|
@@ -75,7 +83,13 @@ function fixup() { | |
<xsl:value-of select="zk:subtitle"/> | ||
</span> | ||
</h3> | ||
</div> | ||
<p class="description" data-description="{description}"/> | ||
</div> | ||
</xsl:template> | ||
<xsl:template match="zk:albumart"> | ||
<div class='album-thumb pull-right'> | ||
<img src="{.}"/> | ||
</div> | ||
</xsl:template> | ||
</xsl:stylesheet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* Zookeeper Online | ||
* | ||
* @author Jim Mason <[email protected]> | ||
* @copyright Copyright (C) 1997-2023 Jim Mason <[email protected]> | ||
* @copyright Copyright (C) 1997-2025 Jim Mason <[email protected]> | ||
* @link https://zookeeper.ibinx.com/ | ||
* @license GPL-3.0 | ||
* | ||
|
@@ -37,4 +37,10 @@ function deleteAlbumArt($tag); | |
function deleteArtistArt($artist); | ||
function expireCache($days=10, $expireAlbums=false); | ||
function expireEmpty($days=1); | ||
/** | ||
* Add `image_url` and/or `info_url` properties for each album with artwork | ||
* | ||
* @param $albums target album array (in/out) | ||
*/ | ||
function injectAlbumArt(array &$albums): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters