2023-11-04 17:25:24 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
// Copyright The Music Player Daemon Project
|
|
|
|
|
|
|
|
#include "AddedSinceSongFilter.hxx"
|
|
|
|
#include "LightSong.hxx"
|
|
|
|
#include "time/ISO8601.hxx"
|
|
|
|
#include "util/StringBuffer.hxx"
|
|
|
|
|
2023-11-25 20:39:05 +01:00
|
|
|
#include <fmt/core.h>
|
|
|
|
|
|
|
|
using std::string_view_literals::operator""sv;
|
|
|
|
|
2023-11-04 17:25:24 +01:00
|
|
|
std::string
|
|
|
|
AddedSinceSongFilter::ToExpression() const noexcept
|
|
|
|
{
|
2023-11-25 20:39:05 +01:00
|
|
|
return fmt::format("(added-since \"{}\")"sv, FormatISO8601(value).c_str());
|
2023-11-04 17:25:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
AddedSinceSongFilter::Match(const LightSong &song) const noexcept
|
|
|
|
{
|
|
|
|
return song.added >= value;
|
|
|
|
}
|