Skip to content

Commit

Permalink
If the file for the cover doesn't exist, fetch again
Browse files Browse the repository at this point in the history
Recovers from the issue highlighted in the previous commit.

May need debounce...
  • Loading branch information
NattyNarwhal committed Jan 21, 2025
1 parent 279b04b commit 9c1e0f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Doing so isn't fatal (it's not a secret), but it is annoying for other contribut
* Top tracks for an artist can now be displayed
* Similar tracks for an artist (sometimes called "radio") can now be displayed
* Directories can be starred.
* Recover from situations where the cover file was deleted from the filesystem.
* Fix covers being deleted by the system on macOS 15.
* Fix searches being ran twice.
* Fix albums with the same ID across multiple servers being mixed.
Expand Down
6 changes: 4 additions & 2 deletions Submariner/SBSubsonicParsingOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@ class SBSubsonicParsingOperation: SBOperation, XMLParserDelegate {
album!.cover = cover
}

if album?.cover?.imagePath == nil {
let imagePath = album?.cover?.imagePath
if imagePath == nil || !FileManager.default.fileExists(atPath: imagePath! as String) {
server.getCover(id: coverArt, for: album!.itemId)
}
}
Expand Down Expand Up @@ -970,7 +971,8 @@ class SBSubsonicParsingOperation: SBOperation, XMLParserDelegate {
attachedAlbum.cover = cover
}

if attachedAlbum.cover?.imagePath == nil {
let imagePath = attachedAlbum.cover?.imagePath
if imagePath == nil || !FileManager.default.fileExists(atPath: imagePath! as String) {
server.getCover(id: coverArt, for: attributeDict["albumId"])
}
}
Expand Down

0 comments on commit 9c1e0f4

Please sign in to comment.