Fix feed order (DESC) and cover art in RSS
- Change feed SQL ORDER BY to DESC (newest releases first) - Remove broken img tag from RSS description (JS onerror not supported in RSS readers) - Replace with link to Cover Art Archive
This commit is contained in:
@@ -221,7 +221,7 @@ public class DatabaseService {
|
||||
var typePlaceholders = String.join(",", primaryTypes.stream().map(t -> "?").toList());
|
||||
sql += " AND primary_type IN (" + typePlaceholders + ")";
|
||||
}
|
||||
sql += " ORDER BY first_release_date ASC";
|
||||
sql += " ORDER BY first_release_date DESC";
|
||||
|
||||
try (Connection conn = getConnection();
|
||||
PreparedStatement ps = conn.prepareStatement(sql)) {
|
||||
|
||||
@@ -79,8 +79,6 @@ public class RSSFeedBuilder {
|
||||
|
||||
private String buildDescription(ReleaseGroup rg) {
|
||||
var sb = new StringBuilder();
|
||||
sb.append("<img src=\"https://coverartarchive.org/release-group/")
|
||||
.append(rg.mbid()).append("/front\" alt=\"Cover\" onerror=\"this.style.display='none'\">");
|
||||
sb.append("<p><b>").append(escHtml(rg.artistName())).append("</b>")
|
||||
.append(" <i>").append(escHtml(rg.title())).append("</i><br>");
|
||||
sb.append("Type: ").append(escHtml(rg.primaryType()));
|
||||
@@ -88,6 +86,8 @@ public class RSSFeedBuilder {
|
||||
sb.append(" | Secondary: ").append(escHtml(rg.secondaryTypes()));
|
||||
}
|
||||
sb.append("<br>First Release Date: ").append(rg.firstReleaseDate());
|
||||
sb.append("<br><a href=\"https://coverartarchive.org/release-group/")
|
||||
.append(rg.mbid()).append("/front\">Cover Art</a>");
|
||||
sb.append("</p>");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user