update_walk: move code to update_song_file()
This commit is contained in:
parent
1735284a2a
commit
2ba3401238
@ -567,18 +567,9 @@ directory_child_access(const struct directory *directory,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_regular_file(struct directory *directory,
|
update_song_file(struct directory *directory,
|
||||||
const char *name, const struct stat *st)
|
const char *name, const struct stat *st,
|
||||||
{
|
const struct decoder_plugin *plugin)
|
||||||
const char *suffix = uri_get_suffix(name);
|
|
||||||
const struct decoder_plugin* plugin;
|
|
||||||
#ifdef ENABLE_ARCHIVE
|
|
||||||
const struct archive_plugin *archive;
|
|
||||||
#endif
|
|
||||||
if (suffix == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ((plugin = decoder_plugin_from_suffix(suffix, false)) != NULL)
|
|
||||||
{
|
{
|
||||||
db_lock();
|
db_lock();
|
||||||
struct song *song = directory_get_song(directory, name);
|
struct song *song = directory_get_song(directory, name);
|
||||||
@ -598,10 +589,8 @@ update_regular_file(struct directory *directory,
|
|||||||
|
|
||||||
if (!(song != NULL && st->st_mtime == song->mtime &&
|
if (!(song != NULL && st->st_mtime == song->mtime &&
|
||||||
!walk_discard) &&
|
!walk_discard) &&
|
||||||
plugin->container_scan != NULL)
|
plugin->container_scan != NULL &&
|
||||||
{
|
update_container_file(directory, name, st, plugin)) {
|
||||||
if (update_container_file(directory, name, st, plugin))
|
|
||||||
{
|
|
||||||
if (song != NULL) {
|
if (song != NULL) {
|
||||||
db_lock();
|
db_lock();
|
||||||
delete_song(directory, song);
|
delete_song(directory, song);
|
||||||
@ -610,7 +599,6 @@ update_regular_file(struct directory *directory,
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (song == NULL) {
|
if (song == NULL) {
|
||||||
g_debug("reading %s/%s",
|
g_debug("reading %s/%s",
|
||||||
@ -639,6 +627,23 @@ update_regular_file(struct directory *directory,
|
|||||||
|
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
update_regular_file(struct directory *directory,
|
||||||
|
const char *name, const struct stat *st)
|
||||||
|
{
|
||||||
|
const char *suffix = uri_get_suffix(name);
|
||||||
|
const struct decoder_plugin* plugin;
|
||||||
|
#ifdef ENABLE_ARCHIVE
|
||||||
|
const struct archive_plugin *archive;
|
||||||
|
#endif
|
||||||
|
if (suffix == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ((plugin = decoder_plugin_from_suffix(suffix, false)) != NULL)
|
||||||
|
{
|
||||||
|
update_song_file(directory, name, st, plugin);
|
||||||
#ifdef ENABLE_ARCHIVE
|
#ifdef ENABLE_ARCHIVE
|
||||||
} else if ((archive = archive_plugin_from_suffix(suffix))) {
|
} else if ((archive = archive_plugin_from_suffix(suffix))) {
|
||||||
update_archive_file(directory, name, st, archive);
|
update_archive_file(directory, name, st, archive);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user