lib/fmt: remove even more now-broken uses of FMT_STRING
MPD stopped building since fmt 11.1.0; see <https://github.com/fmtlib/fmt/issues/4304>. The first commit fixing this was 9db7144, followed by 5de0909 (both on the unstable branch). This commit removes what the author believes to be the remaining uses in the MPD codebase.
This commit is contained in:
parent
b24b3c1054
commit
194ecd69e0
src
PlaylistDatabase.cxxPlaylistSave.cxxSongSave.cxxTagPrint.cxxTagSave.cxx
client
command
db/plugins/simple
decoder
lib/icu
mixer
output
playlist
queue
song
storage
@ -19,9 +19,9 @@ void
|
|||||||
playlist_vector_save(BufferedOutputStream &os, const PlaylistVector &pv)
|
playlist_vector_save(BufferedOutputStream &os, const PlaylistVector &pv)
|
||||||
{
|
{
|
||||||
for (const PlaylistInfo &pi : pv) {
|
for (const PlaylistInfo &pi : pv) {
|
||||||
os.Fmt(FMT_STRING(PLAYLIST_META_BEGIN "{}\n"), pi.name);
|
os.Fmt(PLAYLIST_META_BEGIN "{}\n", pi.name);
|
||||||
if (!IsNegative(pi.mtime))
|
if (!IsNegative(pi.mtime))
|
||||||
os.Fmt(FMT_STRING("mtime: {}\n"),
|
os.Fmt("mtime: {}\n",
|
||||||
std::chrono::system_clock::to_time_t(pi.mtime));
|
std::chrono::system_clock::to_time_t(pi.mtime));
|
||||||
os.Write("playlist_end\n");
|
os.Write("playlist_end\n");
|
||||||
}
|
}
|
||||||
|
@ -26,11 +26,11 @@ playlist_print_path(BufferedOutputStream &os, const Path path)
|
|||||||
"narrow" charset (i.e. CP_ACP) is incapable of storing all
|
"narrow" charset (i.e. CP_ACP) is incapable of storing all
|
||||||
Unicode paths */
|
Unicode paths */
|
||||||
try {
|
try {
|
||||||
os.Fmt(FMT_STRING("{}\n"), path.ToUTF8Throw());
|
os.Fmt("{}\n", path.ToUTF8Throw());
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
os.Fmt(FMT_STRING("{}\n"), path.c_str());
|
os.Fmt("{}\n", path.c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,35 +29,35 @@ static void
|
|||||||
range_save(BufferedOutputStream &os, unsigned start_ms, unsigned end_ms)
|
range_save(BufferedOutputStream &os, unsigned start_ms, unsigned end_ms)
|
||||||
{
|
{
|
||||||
if (end_ms > 0)
|
if (end_ms > 0)
|
||||||
os.Fmt(FMT_STRING("Range: {}-{}\n"), start_ms, end_ms);
|
os.Fmt("Range: {}-{}\n", start_ms, end_ms);
|
||||||
else if (start_ms > 0)
|
else if (start_ms > 0)
|
||||||
os.Fmt(FMT_STRING("Range: {}-\n"), start_ms);
|
os.Fmt("Range: {}-\n", start_ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
song_save(BufferedOutputStream &os, const Song &song)
|
song_save(BufferedOutputStream &os, const Song &song)
|
||||||
{
|
{
|
||||||
os.Fmt(FMT_STRING(SONG_BEGIN "{}\n"), song.filename);
|
os.Fmt(SONG_BEGIN "{}\n", song.filename);
|
||||||
|
|
||||||
if (!song.target.empty())
|
if (!song.target.empty())
|
||||||
os.Fmt(FMT_STRING("Target: {}\n"), song.target);
|
os.Fmt("Target: {}\n", song.target);
|
||||||
|
|
||||||
range_save(os, song.start_time.ToMS(), song.end_time.ToMS());
|
range_save(os, song.start_time.ToMS(), song.end_time.ToMS());
|
||||||
|
|
||||||
tag_save(os, song.tag);
|
tag_save(os, song.tag);
|
||||||
|
|
||||||
if (song.audio_format.IsDefined())
|
if (song.audio_format.IsDefined())
|
||||||
os.Fmt(FMT_STRING("Format: {}\n"), song.audio_format);
|
os.Fmt("Format: {}\n", song.audio_format);
|
||||||
|
|
||||||
if (song.in_playlist)
|
if (song.in_playlist)
|
||||||
os.Write("InPlaylist: yes\n");
|
os.Write("InPlaylist: yes\n");
|
||||||
|
|
||||||
if (!IsNegative(song.mtime))
|
if (!IsNegative(song.mtime))
|
||||||
os.Fmt(FMT_STRING(SONG_MTIME ": {}\n"),
|
os.Fmt(SONG_MTIME ": {}\n",
|
||||||
std::chrono::system_clock::to_time_t(song.mtime));
|
std::chrono::system_clock::to_time_t(song.mtime));
|
||||||
|
|
||||||
if (!IsNegative(song.added))
|
if (!IsNegative(song.added))
|
||||||
os.Fmt(FMT_STRING(SONG_ADDED ": {}\n"),
|
os.Fmt(SONG_ADDED ": {}\n",
|
||||||
std::chrono::system_clock::to_time_t(song.added));
|
std::chrono::system_clock::to_time_t(song.added));
|
||||||
os.Write(SONG_END "\n");
|
os.Write(SONG_END "\n");
|
||||||
}
|
}
|
||||||
@ -65,18 +65,18 @@ song_save(BufferedOutputStream &os, const Song &song)
|
|||||||
void
|
void
|
||||||
song_save(BufferedOutputStream &os, const DetachedSong &song)
|
song_save(BufferedOutputStream &os, const DetachedSong &song)
|
||||||
{
|
{
|
||||||
os.Fmt(FMT_STRING(SONG_BEGIN "{}\n"), song.GetURI());
|
os.Fmt(SONG_BEGIN "{}\n", song.GetURI());
|
||||||
|
|
||||||
range_save(os, song.GetStartTime().ToMS(), song.GetEndTime().ToMS());
|
range_save(os, song.GetStartTime().ToMS(), song.GetEndTime().ToMS());
|
||||||
|
|
||||||
tag_save(os, song.GetTag());
|
tag_save(os, song.GetTag());
|
||||||
|
|
||||||
if (!IsNegative(song.GetLastModified()))
|
if (!IsNegative(song.GetLastModified()))
|
||||||
os.Fmt(FMT_STRING(SONG_MTIME ": {}\n"),
|
os.Fmt(SONG_MTIME ": {}\n",
|
||||||
std::chrono::system_clock::to_time_t(song.GetLastModified()));
|
std::chrono::system_clock::to_time_t(song.GetLastModified()));
|
||||||
|
|
||||||
if (!IsNegative(song.GetAdded()))
|
if (!IsNegative(song.GetAdded()))
|
||||||
os.Fmt(FMT_STRING(SONG_ADDED ": {}\n"),
|
os.Fmt(SONG_ADDED ": {}\n",
|
||||||
std::chrono::system_clock::to_time_t(song.GetAdded()));
|
std::chrono::system_clock::to_time_t(song.GetAdded()));
|
||||||
os.Write(SONG_END "\n");
|
os.Write(SONG_END "\n");
|
||||||
}
|
}
|
||||||
|
@ -23,11 +23,11 @@ tag_print_types_available(Response &r) noexcept
|
|||||||
{
|
{
|
||||||
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; i++)
|
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; i++)
|
||||||
if (global_tag_mask.Test(TagType(i)))
|
if (global_tag_mask.Test(TagType(i)))
|
||||||
r.Fmt(FMT_STRING("tagtype: {}\n"), tag_item_names[i]);
|
r.Fmt("tagtype: {}\n", tag_item_names[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tag_print(Response &r, TagType type, std::string_view value) noexcept
|
tag_print(Response &r, TagType type, std::string_view _value) noexcept
|
||||||
{
|
{
|
||||||
const std::string_view value{_value};
|
const std::string_view value{_value};
|
||||||
r.Fmt("{}: {}\n", tag_item_names[type], value);
|
r.Fmt("{}: {}\n", tag_item_names[type], value);
|
||||||
|
@ -14,12 +14,12 @@ void
|
|||||||
tag_save(BufferedOutputStream &os, const Tag &tag)
|
tag_save(BufferedOutputStream &os, const Tag &tag)
|
||||||
{
|
{
|
||||||
if (!tag.duration.IsNegative())
|
if (!tag.duration.IsNegative())
|
||||||
os.Fmt(FMT_STRING(SONG_TIME "{}\n"), tag.duration.ToDoubleS());
|
os.Fmt(SONG_TIME "{}\n", tag.duration.ToDoubleS());
|
||||||
|
|
||||||
if (tag.has_playlist)
|
if (tag.has_playlist)
|
||||||
os.Write("Playlist: yes\n");
|
os.Write("Playlist: yes\n");
|
||||||
|
|
||||||
for (const auto &i : tag)
|
for (const auto &i : tag)
|
||||||
os.Fmt(FMT_STRING("{}: {}\n"),
|
os.Fmt("{}: {}\n",
|
||||||
tag_item_names[i.type], i.value);
|
tag_item_names[i.type], i.value);
|
||||||
}
|
}
|
||||||
|
@ -50,14 +50,14 @@ protocol_features_print(Client &client, Response &r) noexcept
|
|||||||
const auto protocol_feature = client.GetProtocolFeatures();
|
const auto protocol_feature = client.GetProtocolFeatures();
|
||||||
for (unsigned i = 0; i < PF_NUM_OF_ITEM_TYPES; i++)
|
for (unsigned i = 0; i < PF_NUM_OF_ITEM_TYPES; i++)
|
||||||
if (protocol_feature.Test(ProtocolFeatureType(i)))
|
if (protocol_feature.Test(ProtocolFeatureType(i)))
|
||||||
r.Fmt(FMT_STRING("feature: {}\n"), protocol_feature_names[i]);
|
r.Fmt("feature: {}\n", protocol_feature_names[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
protocol_features_print_all(Response &r) noexcept
|
protocol_features_print_all(Response &r) noexcept
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < PF_NUM_OF_ITEM_TYPES; i++)
|
for (unsigned i = 0; i < PF_NUM_OF_ITEM_TYPES; i++)
|
||||||
r.Fmt(FMT_STRING("feature: {}\n"), protocol_feature_names[i]);
|
r.Fmt("feature: {}\n", protocol_feature_names[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProtocolFeatureType
|
ProtocolFeatureType
|
||||||
|
@ -377,7 +377,7 @@ handle_config(Client &client, [[maybe_unused]] Request args, Response &r)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (const auto spl_path = map_spl_path(); !spl_path.IsNull())
|
if (const auto spl_path = map_spl_path(); !spl_path.IsNull())
|
||||||
r.Fmt(FMT_STRING("playlist_directory: {}\n"), spl_path.ToUTF8());
|
r.Fmt("playlist_directory: {}\n", spl_path.ToUTF8());
|
||||||
|
|
||||||
#ifdef HAVE_PCRE
|
#ifdef HAVE_PCRE
|
||||||
r.Write("pcre: 1\n");
|
r.Write("pcre: 1\n");
|
||||||
|
@ -458,7 +458,7 @@ handle_sticker(Client &client, Request args, Response &r)
|
|||||||
/* set */
|
/* set */
|
||||||
if (args.size() == 5 && StringIsEqual(cmd, "set"))
|
if (args.size() == 5 && StringIsEqual(cmd, "set"))
|
||||||
return handler->Set(uri, sticker_name, args[4]);
|
return handler->Set(uri, sticker_name, args[4]);
|
||||||
|
|
||||||
/* inc */
|
/* inc */
|
||||||
if (args.size() == 5 && StringIsEqual(cmd, "inc"))
|
if (args.size() == 5 && StringIsEqual(cmd, "inc"))
|
||||||
return handler->Inc(uri, sticker_name, args[4]);
|
return handler->Inc(uri, sticker_name, args[4]);
|
||||||
@ -550,6 +550,6 @@ handle_sticker_types(Client &client, Request args, Response &r)
|
|||||||
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; i++)
|
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; i++)
|
||||||
if (sticker_allowed_tags.Test(TagType(i)) &&
|
if (sticker_allowed_tags.Test(TagType(i)) &&
|
||||||
tag_mask.Test(TagType(i)))
|
tag_mask.Test(TagType(i)))
|
||||||
r.Fmt(FMT_STRING("stickertype: {}\n"), tag_item_names[i]);
|
r.Fmt("stickertype: {}\n", tag_item_names[i]);
|
||||||
return CommandResult::OK;
|
return CommandResult::OK;
|
||||||
}
|
}
|
||||||
|
@ -37,13 +37,13 @@ void
|
|||||||
db_save_internal(BufferedOutputStream &os, const Directory &music_root)
|
db_save_internal(BufferedOutputStream &os, const Directory &music_root)
|
||||||
{
|
{
|
||||||
os.Write(DIRECTORY_INFO_BEGIN "\n");
|
os.Write(DIRECTORY_INFO_BEGIN "\n");
|
||||||
os.Fmt(FMT_STRING(DB_FORMAT_PREFIX "{}\n"), DB_FORMAT);
|
os.Fmt(DB_FORMAT_PREFIX "{}\n", DB_FORMAT);
|
||||||
os.Write(DIRECTORY_MPD_VERSION VERSION "\n");
|
os.Write(DIRECTORY_MPD_VERSION VERSION "\n");
|
||||||
os.Fmt(FMT_STRING(DIRECTORY_FS_CHARSET "{}\n"), GetFSCharset());
|
os.Fmt(DIRECTORY_FS_CHARSET "{}\n", GetFSCharset());
|
||||||
|
|
||||||
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i)
|
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i)
|
||||||
if (IsTagEnabled(i))
|
if (IsTagEnabled(i))
|
||||||
os.Fmt(FMT_STRING(DB_TAG_PREFIX "{}\n"),
|
os.Fmt(DB_TAG_PREFIX "{}\n",
|
||||||
tag_item_names[i]);
|
tag_item_names[i]);
|
||||||
|
|
||||||
os.Write(DIRECTORY_INFO_END "\n");
|
os.Write(DIRECTORY_INFO_END "\n");
|
||||||
|
@ -67,20 +67,20 @@ directory_save(BufferedOutputStream &os, const Directory &directory)
|
|||||||
if (!directory.IsRoot()) {
|
if (!directory.IsRoot()) {
|
||||||
const char *type = DeviceToTypeString(directory.device);
|
const char *type = DeviceToTypeString(directory.device);
|
||||||
if (type != nullptr)
|
if (type != nullptr)
|
||||||
os.Fmt(FMT_STRING(DIRECTORY_TYPE "{}\n"), type);
|
os.Fmt(DIRECTORY_TYPE "{}\n", type);
|
||||||
|
|
||||||
if (!IsNegative(directory.mtime))
|
if (!IsNegative(directory.mtime))
|
||||||
os.Fmt(FMT_STRING(DIRECTORY_MTIME "{}\n"),
|
os.Fmt(DIRECTORY_MTIME "{}\n",
|
||||||
std::chrono::system_clock::to_time_t(directory.mtime));
|
std::chrono::system_clock::to_time_t(directory.mtime));
|
||||||
|
|
||||||
os.Fmt(FMT_STRING(DIRECTORY_BEGIN "{}\n"), directory.GetPath());
|
os.Fmt(DIRECTORY_BEGIN "{}\n", directory.GetPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto &child : directory.children) {
|
for (const auto &child : directory.children) {
|
||||||
if (child.IsMount())
|
if (child.IsMount())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
os.Fmt(FMT_STRING(DIRECTORY_DIR "{}\n"), child.GetName());
|
os.Fmt(DIRECTORY_DIR "{}\n", child.GetName());
|
||||||
directory_save(os, child);
|
directory_save(os, child);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ directory_save(BufferedOutputStream &os, const Directory &directory)
|
|||||||
playlist_vector_save(os, directory.playlists);
|
playlist_vector_save(os, directory.playlists);
|
||||||
|
|
||||||
if (!directory.IsRoot())
|
if (!directory.IsRoot())
|
||||||
os.Fmt(FMT_STRING(DIRECTORY_END "{}\n"), directory.GetPath());
|
os.Fmt(DIRECTORY_END "{}\n", directory.GetPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
@ -27,7 +27,7 @@ decoder_plugin_print(Response &r,
|
|||||||
|
|
||||||
if (plugin.suffixes_function != nullptr)
|
if (plugin.suffixes_function != nullptr)
|
||||||
for (const auto &i : plugin.suffixes_function())
|
for (const auto &i : plugin.suffixes_function())
|
||||||
r.Fmt(FMT_STRING("suffix: {}\n"), i);
|
r.Fmt("suffix: {}\n", i);
|
||||||
|
|
||||||
if (plugin.mime_types != nullptr)
|
if (plugin.mime_types != nullptr)
|
||||||
for (p = plugin.mime_types; *p != nullptr; ++p)
|
for (p = plugin.mime_types; *p != nullptr; ++p)
|
||||||
|
@ -41,7 +41,7 @@ IcuConverter::Create(const char *charset)
|
|||||||
UConverter *converter = ucnv_open(charset, &code);
|
UConverter *converter = ucnv_open(charset, &code);
|
||||||
if (converter == nullptr)
|
if (converter == nullptr)
|
||||||
throw ICU::MakeError(code,
|
throw ICU::MakeError(code,
|
||||||
FmtBuffer<256>(FMT_STRING("Failed to initialize charset {:?}"),
|
FmtBuffer<256>("Failed to initialize charset {:?}",
|
||||||
charset));
|
charset));
|
||||||
|
|
||||||
return std::unique_ptr<IcuConverter>(new IcuConverter(converter));
|
return std::unique_ptr<IcuConverter>(new IcuConverter(converter));
|
||||||
@ -54,7 +54,7 @@ IcuConverter::Create(const char *charset)
|
|||||||
iconv_close(to);
|
iconv_close(to);
|
||||||
if (from != (iconv_t)-1)
|
if (from != (iconv_t)-1)
|
||||||
iconv_close(from);
|
iconv_close(from);
|
||||||
throw FmtErrno(e, FMT_STRING("Failed to initialize charset {:?}"),
|
throw FmtErrno(e, "Failed to initialize charset {:?}",
|
||||||
charset);
|
charset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,5 +76,5 @@ MixerMemento::LoadSoftwareVolumeState(const char *line, MultipleOutputs &outputs
|
|||||||
void
|
void
|
||||||
MixerMemento::SaveSoftwareVolumeState(BufferedOutputStream &os) const
|
MixerMemento::SaveSoftwareVolumeState(BufferedOutputStream &os) const
|
||||||
{
|
{
|
||||||
os.Fmt(FMT_STRING(SW_VOLUME_STATE "{}\n"), volume_software_set);
|
os.Fmt(SW_VOLUME_STATE "{}\n", volume_software_set);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ audio_output_state_save(BufferedOutputStream &os,
|
|||||||
const auto &ao = outputs.Get(i);
|
const auto &ao = outputs.Get(i);
|
||||||
const std::scoped_lock lock{ao.mutex};
|
const std::scoped_lock lock{ao.mutex};
|
||||||
|
|
||||||
os.Fmt(FMT_STRING(AUDIO_DEVICE_STATE "{}:{}\n"),
|
os.Fmt(AUDIO_DEVICE_STATE "{}:{}\n",
|
||||||
(unsigned)ao.IsEnabled(), ao.GetName());
|
(unsigned)ao.IsEnabled(), ao.GetName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,9 +43,9 @@ playlist_provider_length(Response &r,
|
|||||||
playtime += get_duration(*song);
|
playtime += get_duration(*song);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
r.Fmt(FMT_STRING("songs: {}\n"), i);
|
r.Fmt("songs: {}\n", i);
|
||||||
const auto seconds = std::chrono::round<std::chrono::seconds>(playtime);
|
const auto seconds = std::chrono::round<std::chrono::seconds>(playtime);
|
||||||
r.Fmt(FMT_STRING("playtime: {}\n"), seconds.count());
|
r.Fmt("playtime: {}\n", seconds.count());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -89,7 +89,7 @@ playlist_provider_search_print(Response &r,
|
|||||||
|
|
||||||
if (detail) {
|
if (detail) {
|
||||||
song_print_info(r, *song);
|
song_print_info(r, *song);
|
||||||
r.Fmt(FMT_STRING("Pos: {}\n"), position);
|
r.Fmt("Pos: {}\n", position);
|
||||||
} else
|
} else
|
||||||
/* fallback if no detail was requested or no
|
/* fallback if no detail was requested or no
|
||||||
detail was available */
|
detail was available */
|
||||||
|
@ -60,33 +60,33 @@ playlist_state_save(BufferedOutputStream &os, const struct playlist &playlist,
|
|||||||
default:
|
default:
|
||||||
os.Write(PLAYLIST_STATE_FILE_STATE_PLAY "\n");
|
os.Write(PLAYLIST_STATE_FILE_STATE_PLAY "\n");
|
||||||
}
|
}
|
||||||
os.Fmt(FMT_STRING(PLAYLIST_STATE_FILE_CURRENT "{}\n"),
|
os.Fmt(PLAYLIST_STATE_FILE_CURRENT "{}\n",
|
||||||
playlist.queue.OrderToPosition(playlist.current));
|
playlist.queue.OrderToPosition(playlist.current));
|
||||||
os.Fmt(FMT_STRING(PLAYLIST_STATE_FILE_TIME "{}\n"),
|
os.Fmt(PLAYLIST_STATE_FILE_TIME "{}\n",
|
||||||
player_status.elapsed_time.ToDoubleS());
|
player_status.elapsed_time.ToDoubleS());
|
||||||
} else {
|
} else {
|
||||||
os.Write(PLAYLIST_STATE_FILE_STATE_STOP "\n");
|
os.Write(PLAYLIST_STATE_FILE_STATE_STOP "\n");
|
||||||
|
|
||||||
if (playlist.current >= 0)
|
if (playlist.current >= 0)
|
||||||
os.Fmt(FMT_STRING(PLAYLIST_STATE_FILE_CURRENT "{}\n"),
|
os.Fmt(PLAYLIST_STATE_FILE_CURRENT "{}\n",
|
||||||
playlist.queue.OrderToPosition(playlist.current));
|
playlist.queue.OrderToPosition(playlist.current));
|
||||||
}
|
}
|
||||||
|
|
||||||
os.Fmt(FMT_STRING(PLAYLIST_STATE_FILE_RANDOM "{}\n"),
|
os.Fmt(PLAYLIST_STATE_FILE_RANDOM "{}\n",
|
||||||
(unsigned)playlist.queue.random);
|
(unsigned)playlist.queue.random);
|
||||||
os.Fmt(FMT_STRING(PLAYLIST_STATE_FILE_REPEAT "{}\n"),
|
os.Fmt(PLAYLIST_STATE_FILE_REPEAT "{}\n",
|
||||||
(unsigned)playlist.queue.repeat);
|
(unsigned)playlist.queue.repeat);
|
||||||
os.Fmt(FMT_STRING(PLAYLIST_STATE_FILE_SINGLE "{}\n"),
|
os.Fmt(PLAYLIST_STATE_FILE_SINGLE "{}\n",
|
||||||
SingleToString(playlist.queue.single));
|
SingleToString(playlist.queue.single));
|
||||||
os.Fmt(FMT_STRING(PLAYLIST_STATE_FILE_CONSUME "{}\n"),
|
os.Fmt(PLAYLIST_STATE_FILE_CONSUME "{}\n",
|
||||||
ConsumeToString(playlist.queue.consume));
|
ConsumeToString(playlist.queue.consume));
|
||||||
os.Fmt(FMT_STRING(PLAYLIST_STATE_FILE_CROSSFADE "{}\n"),
|
os.Fmt(PLAYLIST_STATE_FILE_CROSSFADE "{}\n",
|
||||||
pc.GetCrossFade().count());
|
pc.GetCrossFade().count());
|
||||||
os.Fmt(FMT_STRING(PLAYLIST_STATE_FILE_MIXRAMPDB "{}\n"),
|
os.Fmt(PLAYLIST_STATE_FILE_MIXRAMPDB "{}\n",
|
||||||
pc.GetMixRampDb());
|
pc.GetMixRampDb());
|
||||||
os.Fmt(FMT_STRING(PLAYLIST_STATE_FILE_MIXRAMPDELAY "{}\n"),
|
os.Fmt(PLAYLIST_STATE_FILE_MIXRAMPDELAY "{}\n",
|
||||||
pc.GetMixRampDelay().count());
|
pc.GetMixRampDelay().count());
|
||||||
os.Fmt(FMT_STRING(PLAYLIST_STATE_FILE_LOADED_PLAYLIST "{}\n"),
|
os.Fmt(PLAYLIST_STATE_FILE_LOADED_PLAYLIST "{}\n",
|
||||||
playlist.GetLastLoadedPlaylist());
|
playlist.GetLastLoadedPlaylist());
|
||||||
os.Write(PLAYLIST_STATE_FILE_PLAYLIST_BEGIN "\n");
|
os.Write(PLAYLIST_STATE_FILE_PLAYLIST_BEGIN "\n");
|
||||||
queue_save(os, playlist.queue);
|
queue_save(os, playlist.queue);
|
||||||
|
@ -29,12 +29,12 @@ queue_print_song_info(Response &r, const Queue &queue,
|
|||||||
unsigned position)
|
unsigned position)
|
||||||
{
|
{
|
||||||
song_print_info(r, queue.Get(position));
|
song_print_info(r, queue.Get(position));
|
||||||
r.Fmt(FMT_STRING("Pos: {}\nId: {}\n"),
|
r.Fmt("Pos: {}\nId: {}\n",
|
||||||
position, queue.PositionToId(position));
|
position, queue.PositionToId(position));
|
||||||
|
|
||||||
uint8_t priority = queue.GetPriorityAtPosition(position);
|
uint8_t priority = queue.GetPriorityAtPosition(position);
|
||||||
if (priority != 0)
|
if (priority != 0)
|
||||||
r.Fmt(FMT_STRING("Prio: {}\n"), priority);
|
r.Fmt("Prio: {}\n", priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -56,7 +56,7 @@ queue_print_uris(Response &r, const Queue &queue,
|
|||||||
assert(end <= queue.GetLength());
|
assert(end <= queue.GetLength());
|
||||||
|
|
||||||
for (unsigned i = start; i < end; ++i) {
|
for (unsigned i = start; i < end; ++i) {
|
||||||
r.Fmt(FMT_STRING("{}:"), i);
|
r.Fmt("{}:", i);
|
||||||
song_print_uri(r, queue.Get(i));
|
song_print_uri(r, queue.Get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ queue_print_changes_position(Response &r, const Queue &queue,
|
|||||||
|
|
||||||
for (unsigned i = start; i < end; i++)
|
for (unsigned i = start; i < end; i++)
|
||||||
if (queue.IsNewerAtPosition(i, version))
|
if (queue.IsNewerAtPosition(i, version))
|
||||||
r.Fmt(FMT_STRING("cpos: {}\nId: {}\n"),
|
r.Fmt("cpos: {}\nId: {}\n",
|
||||||
i, queue.PositionToId(i));
|
i, queue.PositionToId(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ static void
|
|||||||
queue_save_database_song(BufferedOutputStream &os,
|
queue_save_database_song(BufferedOutputStream &os,
|
||||||
int idx, const DetachedSong &song)
|
int idx, const DetachedSong &song)
|
||||||
{
|
{
|
||||||
os.Fmt(FMT_STRING("{}:{}\n"), idx, song.GetURI());
|
os.Fmt("{}:{}\n", idx, song.GetURI());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -53,7 +53,7 @@ queue_save(BufferedOutputStream &os, const Queue &queue)
|
|||||||
for (unsigned i = 0; i < queue.GetLength(); i++) {
|
for (unsigned i = 0; i < queue.GetLength(); i++) {
|
||||||
uint8_t prio = queue.GetPriorityAtPosition(i);
|
uint8_t prio = queue.GetPriorityAtPosition(i);
|
||||||
if (prio != 0)
|
if (prio != 0)
|
||||||
os.Fmt(FMT_STRING(PRIO_LABEL "{}\n"), prio);
|
os.Fmt(PRIO_LABEL "{}\n", prio);
|
||||||
|
|
||||||
queue_save_song(os, i, queue.Get(i));
|
queue_save_song(os, i, queue.Get(i));
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
std::string
|
std::string
|
||||||
PrioritySongFilter::ToExpression() const noexcept
|
PrioritySongFilter::ToExpression() const noexcept
|
||||||
{
|
{
|
||||||
return fmt::format(FMT_STRING("(prio >= {})"), value);
|
return fmt::format("(prio >= {})", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -38,10 +38,10 @@ storage_state_save(BufferedOutputStream &os, const Instance &instance)
|
|||||||
if (uri.empty() || StringIsEmpty(mount_uri))
|
if (uri.empty() || StringIsEmpty(mount_uri))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
os.Fmt(FMT_STRING(MOUNT_STATE_BEGIN "\n"
|
os.Fmt(MOUNT_STATE_BEGIN "\n"
|
||||||
MOUNT_STATE_STORAGE_URI "{}\n"
|
MOUNT_STATE_STORAGE_URI "{}\n"
|
||||||
MOUNT_STATE_MOUNTED_URL "{}\n"
|
MOUNT_STATE_MOUNTED_URL "{}\n"
|
||||||
MOUNT_STATE_END "\n"),
|
MOUNT_STATE_END "\n",
|
||||||
mount_uri, uri);
|
mount_uri, uri);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ storage_state_restore(const char *line, LineReader &file,
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (url.empty() || uri.empty()) {
|
if (url.empty() || uri.empty()) {
|
||||||
LogError(storage_domain, "Missing value in mountpoint state.");
|
LogError(storage_domain, "Missing value in mountpoint state.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user