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
2edad38c
Commit
2edad38c
authored
Mar 18, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/DatabaseListener: pass URI to OnDatabaseSongRemoved()
There's no point in passing a LightSong reference here; the callee is interested only in the URI.
parent
296ee496
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
11 deletions
+8
-11
Instance.cxx
src/Instance.cxx
+3
-5
Instance.hxx
src/Instance.hxx
+1
-1
DatabaseListener.hxx
src/db/DatabaseListener.hxx
+1
-1
Remove.cxx
src/db/update/Remove.cxx
+1
-2
DumpDatabase.cxx
test/DumpDatabase.cxx
+2
-2
No files found.
src/Instance.cxx
View file @
2edad38c
...
...
@@ -26,7 +26,6 @@
#ifdef ENABLE_DATABASE
#include "db/DatabaseError.hxx"
#include "db/LightSong.hxx"
#ifdef ENABLE_SQLITE
#include "sticker/StickerDatabase.hxx"
...
...
@@ -57,18 +56,17 @@ Instance::OnDatabaseModified()
}
void
Instance
::
OnDatabaseSongRemoved
(
const
LightSong
&
song
)
Instance
::
OnDatabaseSongRemoved
(
const
char
*
uri
)
{
assert
(
database
!=
nullptr
);
#ifdef ENABLE_SQLITE
/* if the song has a sticker, remove it */
if
(
sticker_enabled
())
sticker_song_delete
(
song
,
IgnoreError
());
sticker_song_delete
(
uri
,
IgnoreError
());
#endif
const
auto
uri
=
song
.
GetURI
();
partition
->
DeleteSong
(
uri
.
c_str
());
partition
->
DeleteSong
(
uri
);
}
#endif
...
...
src/Instance.hxx
View file @
2edad38c
...
...
@@ -115,7 +115,7 @@ struct Instance final
private
:
#ifdef ENABLE_DATABASE
void
OnDatabaseModified
()
override
;
void
OnDatabaseSongRemoved
(
const
LightSong
&
song
)
override
;
void
OnDatabaseSongRemoved
(
const
char
*
uri
)
override
;
#endif
#ifdef ENABLE_NEIGHBOR_PLUGINS
...
...
src/db/DatabaseListener.hxx
View file @
2edad38c
...
...
@@ -40,7 +40,7 @@ public:
* During database update, a song is about to be removed from
* the database because the file has disappeared.
*/
virtual
void
OnDatabaseSongRemoved
(
const
LightSong
&
song
)
=
0
;
virtual
void
OnDatabaseSongRemoved
(
const
char
*
uri
)
=
0
;
};
#endif
src/db/update/Remove.cxx
View file @
2edad38c
...
...
@@ -39,10 +39,9 @@ UpdateRemoveService::RunDeferred()
{
const
auto
uri
=
removed_song
->
GetURI
();
FormatDefault
(
update_domain
,
"removing %s"
,
uri
.
c_str
());
listener
.
OnDatabaseSongRemoved
(
uri
.
c_str
());
}
listener
.
OnDatabaseSongRemoved
(
removed_song
->
Export
());
/* clear "removed_song" and send signal to update thread */
remove_mutex
.
lock
();
removed_song
=
nullptr
;
...
...
test/DumpDatabase.cxx
View file @
2edad38c
...
...
@@ -57,8 +57,8 @@ public:
cout
<<
"DatabaseModified"
<<
endl
;
}
virtual
void
OnDatabaseSongRemoved
(
const
LightSong
&
song
)
override
{
cout
<<
"SongRemoved "
<<
song
.
GetURI
()
<<
endl
;
virtual
void
OnDatabaseSongRemoved
(
const
char
*
uri
)
override
{
cout
<<
"SongRemoved "
<<
uri
<<
endl
;
}
};
...
...
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