diff options
author | Max Kellermann <max@musicpd.org> | 2020-10-28 14:24:44 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2020-10-28 14:36:20 +0100 |
commit | bbfa6fe632747c7243b60ccf5d9652de793594a3 (patch) | |
tree | b7ff41db47ec6f5c8f7ad4f8b59fff8668d70d40 /src/db/plugins/simple | |
parent | bf97d13d0b571429b8ba4baf10d3b1a92b27a9ec (diff) |
db/simple: purge songs for unavailable decoder plugins on update
Diffstat (limited to 'src/db/plugins/simple')
-rw-r--r-- | src/db/plugins/simple/Song.cxx | 8 | ||||
-rw-r--r-- | src/db/plugins/simple/Song.hxx | 10 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/db/plugins/simple/Song.cxx b/src/db/plugins/simple/Song.cxx index 3da13b9ea..eecf00277 100644 --- a/src/db/plugins/simple/Song.cxx +++ b/src/db/plugins/simple/Song.cxx @@ -34,6 +34,14 @@ Song::Song(DetachedSong &&other, Directory &_parent) noexcept { } +const char * +Song::GetFilenameSuffix() const noexcept +{ + return target.empty() + ? PathTraitsUTF8::GetFilenameSuffix(filename.c_str()) + : PathTraitsUTF8::GetPathSuffix(target.c_str()); +} + std::string Song::GetURI() const noexcept { diff --git a/src/db/plugins/simple/Song.hxx b/src/db/plugins/simple/Song.hxx index 04be80845..90334b031 100644 --- a/src/db/plugins/simple/Song.hxx +++ b/src/db/plugins/simple/Song.hxx @@ -108,6 +108,16 @@ struct Song { Song(DetachedSong &&other, Directory &_parent) noexcept; + gcc_pure + const char *GetFilenameSuffix() const noexcept; + + /** + * Checks whether the decoder plugin for this song is + * available. + */ + gcc_pure + bool IsPluginAvailable() const noexcept; + /** * allocate a new song structure with a local file name and attempt to * load its metadata. If all decoder plugin fail to read its meta |