diff --git a/src/libs/services/podcast/impl/steps/RefreshPodcastsStep.cpp b/src/libs/services/podcast/impl/steps/RefreshPodcastsStep.cpp index ba718688..aa87b131 100644 --- a/src/libs/services/podcast/impl/steps/RefreshPodcastsStep.cpp +++ b/src/libs/services/podcast/impl/steps/RefreshPodcastsStep.cpp @@ -36,18 +36,18 @@ namespace lms::podcast { namespace { - void removeArtwork(db::Session& session, const db::Artwork::pointer& artwork) + void removeArtwork(const db::Artwork::pointer& artwork) { const auto underlyingImageId{ artwork->getUnderlyingId() }; - const auto* imageId{ std::get_if(&underlyingImageId) }; - assert(imageId); // these artworks can only be an image + db::Image::pointer image{ artwork->getImage() }; + assert(image); // these artworks can only be an image std::error_code ec; std::filesystem::remove(artwork->getAbsoluteFilePath(), ec); if (ec) LMS_LOG(PODCAST, WARNING, "Failed to remove old podcast artwork file '" << artwork->getAbsoluteFilePath() << "': " << ec.message()); - session.destroy(*imageId); + image.remove(); } void updatePodcast(db::Session& session, db::PodcastId podcastId, const Podcast& podcast) @@ -83,7 +83,7 @@ namespace lms::podcast { LMS_LOG(PODCAST, INFO, "Podcast '" << podcast.title << "' : image url changed from '" << previousUrl << "' to '" << podcast.imageUrl << "'"); if (db::Artwork::pointer currentArtwork{ dbPodcast->getArtwork() }) - removeArtwork(session, currentArtwork); + removeArtwork(currentArtwork); dbPodcast.modify()->setImageUrl(podcast.imageUrl); }