Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
bbfa6fe6
Commit
bbfa6fe6
authored
Oct 28, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/simple: purge songs for unavailable decoder plugins on update
parent
bf97d13d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
2 deletions
+34
-2
NEWS
NEWS
+2
-1
SongUpdate.cxx
src/SongUpdate.cxx
+9
-0
Song.cxx
src/db/plugins/simple/Song.cxx
+8
-0
Song.hxx
src/db/plugins/simple/Song.hxx
+10
-0
Walk.cxx
src/db/update/Walk.cxx
+5
-1
No files found.
NEWS
View file @
bbfa6fe6
ver 0.22.2 (not yet released)
* database
- simple: purge virtual directories for unavailable plugins on update
- simple: purge songs and virtual directories for unavailable plugins
on update
ver 0.22.1 (2020/10/17)
* decoder
...
...
src/SongUpdate.cxx
View file @
bbfa6fe6
...
...
@@ -23,6 +23,7 @@
#include "db/plugins/simple/Directory.hxx"
#include "storage/StorageInterface.hxx"
#include "storage/FileInfo.hxx"
#include "decoder/DecoderList.hxx"
#include "fs/AllocatedPath.hxx"
#include "fs/FileInfo.hxx"
#include "tag/Builder.hxx"
...
...
@@ -40,6 +41,14 @@
#ifdef ENABLE_DATABASE
bool
Song
::
IsPluginAvailable
()
const
noexcept
{
const
char
*
suffix
=
GetFilenameSuffix
();
return
suffix
!=
nullptr
&&
decoder_plugins_supports_suffix
(
suffix
);
}
SongPtr
Song
::
LoadFile
(
Storage
&
storage
,
const
char
*
path_utf8
,
Directory
&
parent
)
{
...
...
src/db/plugins/simple/Song.cxx
View file @
bbfa6fe6
...
...
@@ -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
{
...
...
src/db/plugins/simple/Song.hxx
View file @
bbfa6fe6
...
...
@@ -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
...
...
src/db/update/Walk.cxx
View file @
bbfa6fe6
...
...
@@ -111,7 +111,11 @@ UpdateWalk::PurgeDeletedFromDirectory(Directory &directory) noexcept
directory
.
ForEachSongSafe
([
&
](
Song
&
song
){
if
(
!
directory_child_is_regular
(
storage
,
directory
,
song
.
filename
))
{
song
.
filename
)
||
!
song
.
IsPluginAvailable
())
{
/* the song file was deleted (or the decoder
plugin is unavailable) */
editor
.
LockDeleteSong
(
directory
,
&
song
);
modified
=
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment