2023-03-06 14:42:04 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
// Copyright The Music Player Daemon Project
|
2015-03-01 00:48:44 +01:00
|
|
|
|
|
|
|
#include "TagArchive.hxx"
|
|
|
|
#include "TagStream.hxx"
|
2016-02-26 14:46:01 +01:00
|
|
|
#include "archive/ArchiveFile.hxx"
|
2015-03-01 00:48:44 +01:00
|
|
|
#include "input/InputStream.hxx"
|
|
|
|
|
|
|
|
bool
|
2016-02-26 15:07:30 +01:00
|
|
|
tag_archive_scan(ArchiveFile &archive, const char *path_utf8,
|
2018-07-05 19:07:05 +02:00
|
|
|
TagHandler &handler) noexcept
|
2016-09-09 15:37:06 +02:00
|
|
|
try {
|
2015-03-01 00:48:44 +01:00
|
|
|
Mutex mutex;
|
2016-02-26 15:07:30 +01:00
|
|
|
|
2018-06-22 19:37:18 +02:00
|
|
|
auto is = archive.OpenStream(path_utf8, mutex);
|
2016-02-26 13:21:27 +01:00
|
|
|
if (!is)
|
2015-03-01 00:48:44 +01:00
|
|
|
return false;
|
|
|
|
|
2018-07-05 19:07:05 +02:00
|
|
|
return tag_stream_scan(*is, handler);
|
2019-09-01 12:57:24 +02:00
|
|
|
} catch (...) {
|
2016-09-09 15:37:06 +02:00
|
|
|
return false;
|
2015-03-01 00:48:44 +01:00
|
|
|
}
|
2016-02-26 13:20:30 +01:00
|
|
|
|
2016-02-26 14:46:01 +01:00
|
|
|
bool
|
|
|
|
tag_archive_scan(ArchiveFile &archive, const char *path_utf8,
|
2018-01-21 11:41:13 +01:00
|
|
|
TagBuilder &builder) noexcept
|
2016-09-09 15:37:06 +02:00
|
|
|
try {
|
2016-02-26 14:46:01 +01:00
|
|
|
Mutex mutex;
|
|
|
|
|
2018-06-22 19:37:18 +02:00
|
|
|
auto is = archive.OpenStream(path_utf8, mutex);
|
2016-02-26 14:46:01 +01:00
|
|
|
return is && tag_stream_scan(*is, builder);
|
2019-09-01 12:57:24 +02:00
|
|
|
} catch (...) {
|
2016-09-09 15:37:06 +02:00
|
|
|
return false;
|
2016-02-26 14:46:01 +01:00
|
|
|
}
|