2016-02-22 18:00:49 +01:00
|
|
|
/*
|
2018-10-31 17:54:59 +01:00
|
|
|
* Copyright 2003-2018 The Music Player Daemon Project
|
2016-02-22 18:00:49 +01:00
|
|
|
* 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 "Generic.hxx"
|
2017-02-08 08:26:58 +01:00
|
|
|
#include "Id3Scan.hxx"
|
2016-02-22 18:00:49 +01:00
|
|
|
#include "ApeTag.hxx"
|
|
|
|
#include "fs/Path.hxx"
|
2016-02-23 10:24:10 +01:00
|
|
|
#include "thread/Mutex.hxx"
|
2016-02-23 10:07:47 +01:00
|
|
|
#include "input/InputStream.hxx"
|
2016-02-23 10:24:10 +01:00
|
|
|
#include "input/LocalOpen.hxx"
|
2018-11-19 12:49:45 +01:00
|
|
|
#include "config.h"
|
2016-02-23 10:07:47 +01:00
|
|
|
|
2017-12-19 10:56:23 +01:00
|
|
|
#include <exception>
|
2016-02-23 10:24:10 +01:00
|
|
|
|
2016-02-23 10:07:47 +01:00
|
|
|
bool
|
2019-05-21 23:26:29 +02:00
|
|
|
ScanGenericTags(InputStream &is, TagHandler &handler)
|
2016-02-23 10:07:47 +01:00
|
|
|
{
|
2018-07-05 19:07:05 +02:00
|
|
|
if (tag_ape_scan2(is, handler))
|
2016-02-23 10:07:47 +01:00
|
|
|
return true;
|
|
|
|
|
2016-02-23 11:16:19 +01:00
|
|
|
#ifdef ENABLE_ID3TAG
|
2019-05-21 23:26:29 +02:00
|
|
|
is.LockRewind();
|
2016-02-23 10:07:47 +01:00
|
|
|
|
2018-07-05 19:07:05 +02:00
|
|
|
return tag_id3_scan(is, handler);
|
2016-02-23 11:16:19 +01:00
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
2016-02-23 10:07:47 +01:00
|
|
|
}
|
2016-02-22 18:00:49 +01:00
|
|
|
|
|
|
|
bool
|
2019-05-21 23:26:29 +02:00
|
|
|
ScanGenericTags(Path path, TagHandler &handler)
|
|
|
|
{
|
2016-02-23 10:24:10 +01:00
|
|
|
Mutex mutex;
|
|
|
|
|
2018-06-22 19:37:18 +02:00
|
|
|
auto is = OpenLocalInputStream(path, mutex);
|
2018-07-05 19:07:05 +02:00
|
|
|
return ScanGenericTags(*is, handler);
|
2016-02-22 18:00:49 +01:00
|
|
|
}
|