db/update/Walk: move UpdatePlaylistFile() to Playlist.cxx
This commit is contained in:
parent
0fd6235a66
commit
d5681b678c
@ -27,6 +27,7 @@ db_glue_sources = [
|
|||||||
'update/Walk.cxx',
|
'update/Walk.cxx',
|
||||||
'update/UpdateSong.cxx',
|
'update/UpdateSong.cxx',
|
||||||
'update/Container.cxx',
|
'update/Container.cxx',
|
||||||
|
'update/Playlist.cxx',
|
||||||
'update/Remove.cxx',
|
'update/Remove.cxx',
|
||||||
'update/ExcludeList.cxx',
|
'update/ExcludeList.cxx',
|
||||||
'DatabaseGlue.cxx',
|
'DatabaseGlue.cxx',
|
||||||
|
41
src/db/update/Playlist.cxx
Normal file
41
src/db/update/Playlist.cxx
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2003-2019 The Music Player Daemon Project
|
||||||
|
* http://www.musicpd.org
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Walk.hxx"
|
||||||
|
#include "db/DatabaseLock.hxx"
|
||||||
|
#include "db/PlaylistVector.hxx"
|
||||||
|
#include "db/plugins/simple/Directory.hxx"
|
||||||
|
#include "playlist/PlaylistRegistry.hxx"
|
||||||
|
#include "storage/FileInfo.hxx"
|
||||||
|
|
||||||
|
bool
|
||||||
|
UpdateWalk::UpdatePlaylistFile(Directory &directory,
|
||||||
|
const char *name, const char *suffix,
|
||||||
|
const StorageFileInfo &info) noexcept
|
||||||
|
{
|
||||||
|
if (!playlist_suffix_supported(suffix))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
PlaylistInfo pi(name, info.mtime);
|
||||||
|
|
||||||
|
const ScopeDatabaseLock protect;
|
||||||
|
if (directory.playlists.UpdateOrInsert(std::move(pi)))
|
||||||
|
modified = true;
|
||||||
|
return true;
|
||||||
|
}
|
@ -22,12 +22,10 @@
|
|||||||
#include "Editor.hxx"
|
#include "Editor.hxx"
|
||||||
#include "UpdateDomain.hxx"
|
#include "UpdateDomain.hxx"
|
||||||
#include "db/DatabaseLock.hxx"
|
#include "db/DatabaseLock.hxx"
|
||||||
#include "db/PlaylistVector.hxx"
|
|
||||||
#include "db/Uri.hxx"
|
#include "db/Uri.hxx"
|
||||||
#include "db/plugins/simple/Directory.hxx"
|
#include "db/plugins/simple/Directory.hxx"
|
||||||
#include "db/plugins/simple/Song.hxx"
|
#include "db/plugins/simple/Song.hxx"
|
||||||
#include "storage/StorageInterface.hxx"
|
#include "storage/StorageInterface.hxx"
|
||||||
#include "playlist/PlaylistRegistry.hxx"
|
|
||||||
#include "ExcludeList.hxx"
|
#include "ExcludeList.hxx"
|
||||||
#include "fs/AllocatedPath.hxx"
|
#include "fs/AllocatedPath.hxx"
|
||||||
#include "fs/Traits.hxx"
|
#include "fs/Traits.hxx"
|
||||||
@ -175,22 +173,6 @@ FindAncestorLoop(Storage &storage, Directory *parent,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
|
||||||
UpdateWalk::UpdatePlaylistFile(Directory &directory,
|
|
||||||
const char *name, const char *suffix,
|
|
||||||
const StorageFileInfo &info) noexcept
|
|
||||||
{
|
|
||||||
if (!playlist_suffix_supported(suffix))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
PlaylistInfo pi(name, info.mtime);
|
|
||||||
|
|
||||||
const ScopeDatabaseLock protect;
|
|
||||||
if (directory.playlists.UpdateOrInsert(std::move(pi)))
|
|
||||||
modified = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
UpdateWalk::UpdateRegularFile(Directory &directory,
|
UpdateWalk::UpdateRegularFile(Directory &directory,
|
||||||
const char *name,
|
const char *name,
|
||||||
|
Loading…
Reference in New Issue
Block a user