SongUpdate: move tag_scan_fallback() to tag/Generic.cxx
This commit is contained in:
parent
de568c84c2
commit
7623c1c5cb
@ -862,6 +862,7 @@ libtag_a_SOURCES =\
|
|||||||
src/tag/VorbisComment.cxx src/tag/VorbisComment.hxx \
|
src/tag/VorbisComment.cxx src/tag/VorbisComment.hxx \
|
||||||
src/tag/ReplayGain.cxx src/tag/ReplayGain.hxx \
|
src/tag/ReplayGain.cxx src/tag/ReplayGain.hxx \
|
||||||
src/tag/MixRamp.cxx src/tag/MixRamp.hxx \
|
src/tag/MixRamp.cxx src/tag/MixRamp.hxx \
|
||||||
|
src/tag/Generic.cxx src/tag/Generic.hxx \
|
||||||
src/tag/ApeLoader.cxx src/tag/ApeLoader.hxx \
|
src/tag/ApeLoader.cxx src/tag/ApeLoader.hxx \
|
||||||
src/tag/ApeReplayGain.cxx src/tag/ApeReplayGain.hxx \
|
src/tag/ApeReplayGain.cxx src/tag/ApeReplayGain.hxx \
|
||||||
src/tag/ApeTag.cxx src/tag/ApeTag.hxx
|
src/tag/ApeTag.cxx src/tag/ApeTag.hxx
|
||||||
|
@ -32,8 +32,7 @@
|
|||||||
#include "tag/Tag.hxx"
|
#include "tag/Tag.hxx"
|
||||||
#include "tag/TagBuilder.hxx"
|
#include "tag/TagBuilder.hxx"
|
||||||
#include "tag/TagHandler.hxx"
|
#include "tag/TagHandler.hxx"
|
||||||
#include "tag/TagId3.hxx"
|
#include "tag/Generic.hxx"
|
||||||
#include "tag/ApeTag.hxx"
|
|
||||||
#include "TagFile.hxx"
|
#include "TagFile.hxx"
|
||||||
#include "TagStream.hxx"
|
#include "TagStream.hxx"
|
||||||
|
|
||||||
@ -73,17 +72,6 @@ Song::LoadFile(Storage &storage, const char *path_utf8, Directory &parent)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempts to load APE or ID3 tags from the specified file.
|
|
||||||
*/
|
|
||||||
static bool
|
|
||||||
tag_scan_fallback(Path path,
|
|
||||||
const TagHandler *handler, void *handler_ctx)
|
|
||||||
{
|
|
||||||
return tag_ape_scan2(path, handler, handler_ctx) ||
|
|
||||||
tag_id3_scan(path, handler, handler_ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ENABLE_DATABASE
|
#ifdef ENABLE_DATABASE
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -112,7 +100,7 @@ Song::UpdateFile(Storage &storage)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (tag_builder.IsEmpty())
|
if (tag_builder.IsEmpty())
|
||||||
tag_scan_fallback(path_fs, &full_tag_handler,
|
ScanGenericTags(path_fs, full_tag_handler,
|
||||||
&tag_builder);
|
&tag_builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,8 +153,7 @@ DetachedSong::LoadFile(Path path)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (tag_builder.IsEmpty())
|
if (tag_builder.IsEmpty())
|
||||||
tag_scan_fallback(path, &full_tag_handler,
|
ScanGenericTags(path, full_tag_handler, &tag_builder);
|
||||||
&tag_builder);
|
|
||||||
|
|
||||||
mtime = fi.GetModificationTime();
|
mtime = fi.GetModificationTime();
|
||||||
tag_builder.Commit(tag);
|
tag_builder.Commit(tag);
|
||||||
|
@ -31,8 +31,7 @@
|
|||||||
#include "util/UriUtil.hxx"
|
#include "util/UriUtil.hxx"
|
||||||
#include "util/Error.hxx"
|
#include "util/Error.hxx"
|
||||||
#include "tag/TagHandler.hxx"
|
#include "tag/TagHandler.hxx"
|
||||||
#include "tag/ApeTag.hxx"
|
#include "tag/Generic.hxx"
|
||||||
#include "tag/TagId3.hxx"
|
|
||||||
#include "TagStream.hxx"
|
#include "TagStream.hxx"
|
||||||
#include "TagFile.hxx"
|
#include "TagFile.hxx"
|
||||||
#include "storage/StorageInterface.hxx"
|
#include "storage/StorageInterface.hxx"
|
||||||
@ -174,8 +173,7 @@ read_file_comments(Response &r, const Path path_fs)
|
|||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
tag_ape_scan2(path_fs, &print_comment_handler, &r);
|
ScanGenericTags(path_fs, print_comment_handler, &r);
|
||||||
tag_id3_scan(path_fs, &print_comment_handler, &r);
|
|
||||||
|
|
||||||
return CommandResult::OK;
|
return CommandResult::OK;
|
||||||
|
|
||||||
|
@ -29,8 +29,7 @@
|
|||||||
#include "../SongEnumerator.hxx"
|
#include "../SongEnumerator.hxx"
|
||||||
#include "../cue/CueParser.hxx"
|
#include "../cue/CueParser.hxx"
|
||||||
#include "tag/TagHandler.hxx"
|
#include "tag/TagHandler.hxx"
|
||||||
#include "tag/TagId3.hxx"
|
#include "tag/Generic.hxx"
|
||||||
#include "tag/ApeTag.hxx"
|
|
||||||
#include "DetachedSong.hxx"
|
#include "DetachedSong.hxx"
|
||||||
#include "TagFile.hxx"
|
#include "TagFile.hxx"
|
||||||
#include "fs/Traits.hxx"
|
#include "fs/Traits.hxx"
|
||||||
@ -104,11 +103,8 @@ embcue_playlist_open_uri(const char *uri,
|
|||||||
const auto playlist = new EmbeddedCuePlaylist();
|
const auto playlist = new EmbeddedCuePlaylist();
|
||||||
|
|
||||||
tag_file_scan(path_fs, embcue_tag_handler, playlist);
|
tag_file_scan(path_fs, embcue_tag_handler, playlist);
|
||||||
if (playlist->cuesheet.empty()) {
|
|
||||||
tag_ape_scan2(path_fs, &embcue_tag_handler, playlist);
|
|
||||||
if (playlist->cuesheet.empty())
|
if (playlist->cuesheet.empty())
|
||||||
tag_id3_scan(path_fs, &embcue_tag_handler, playlist);
|
ScanGenericTags(path_fs, embcue_tag_handler, playlist);
|
||||||
}
|
|
||||||
|
|
||||||
if (playlist->cuesheet.empty()) {
|
if (playlist->cuesheet.empty()) {
|
||||||
/* no "CUESHEET" tag found */
|
/* no "CUESHEET" tag found */
|
||||||
|
34
src/tag/Generic.cxx
Normal file
34
src/tag/Generic.cxx
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2003-2015 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 "config.h"
|
||||||
|
#include "Generic.hxx"
|
||||||
|
#include "TagId3.hxx"
|
||||||
|
#include "ApeTag.hxx"
|
||||||
|
#include "fs/Path.hxx"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to scan APE or ID3 tags from the specified file.
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
ScanGenericTags(Path path, const TagHandler &handler, void *ctx)
|
||||||
|
{
|
||||||
|
return tag_ape_scan2(path, &handler, ctx) ||
|
||||||
|
tag_id3_scan(path, &handler, ctx);
|
||||||
|
}
|
34
src/tag/Generic.hxx
Normal file
34
src/tag/Generic.hxx
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2003-2015 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MPD_TAG_GENERIC_HXX
|
||||||
|
#define MPD_TAG_GENERIC_HXX
|
||||||
|
|
||||||
|
#include "check.h"
|
||||||
|
|
||||||
|
struct TagHandler;
|
||||||
|
class Path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to scan APE or ID3 tags from the specified file.
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
ScanGenericTags(Path path, const TagHandler &handler, void *ctx);
|
||||||
|
|
||||||
|
#endif
|
@ -25,8 +25,7 @@
|
|||||||
#include "input/InputStream.hxx"
|
#include "input/InputStream.hxx"
|
||||||
#include "AudioFormat.hxx"
|
#include "AudioFormat.hxx"
|
||||||
#include "tag/TagHandler.hxx"
|
#include "tag/TagHandler.hxx"
|
||||||
#include "tag/TagId3.hxx"
|
#include "tag/Generic.hxx"
|
||||||
#include "tag/ApeTag.hxx"
|
|
||||||
#include "util/Error.hxx"
|
#include "util/Error.hxx"
|
||||||
#include "fs/Path.hxx"
|
#include "fs/Path.hxx"
|
||||||
#include "thread/Cond.hxx"
|
#include "thread/Cond.hxx"
|
||||||
@ -126,11 +125,8 @@ int main(int argc, char **argv)
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty) {
|
|
||||||
tag_ape_scan2(path, &print_handler, NULL);
|
|
||||||
if (empty)
|
if (empty)
|
||||||
tag_id3_scan(path, &print_handler, NULL);
|
ScanGenericTags(path, print_handler, nullptr);
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user