Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fixes and enhancements about cue files in satellite setup #1780

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 40 additions & 0 deletions src/SongPrint.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,42 @@ song_print_uri(Response &r, const DetachedSong &song, bool base) noexcept
song_print_uri(r, song.GetURI(), base);
}

static void
song_print_real_uri(Response &r, const char *real_uri, bool base) noexcept
{
std::string allocated;

if (base) {
real_uri = PathTraitsUTF8::GetBase(real_uri);
} else {
allocated = uri_remove_auth(real_uri);
if (!allocated.empty())
real_uri = allocated.c_str();
}

r.Fmt(FMT_STRING("RealUri: {}\n"), real_uri);
}

static void
song_print_real_uri(Response &r, const LightSong &song, bool base) noexcept
{
if (song.real_uri == nullptr)
return;

if (!base && song.directory != nullptr)
r.Fmt(FMT_STRING("RealUri: {}\n"),
song.real_uri);
else
song_print_real_uri(r, song.real_uri, base);
}

static void
song_print_real_uri(Response &r, const DetachedSong &song, bool base) noexcept
{
if (song.HasRealURI())
song_print_real_uri(r, song.GetRealURI(), base);
}

static void
PrintRange(Response &r, SongTime start_time, SongTime end_time) noexcept
{
Expand All @@ -71,6 +107,8 @@ song_print_info(Response &r, const LightSong &song, bool base) noexcept
{
song_print_uri(r, song, base);

song_print_real_uri(r, song, base);

PrintRange(r, song.start_time, song.end_time);

if (!IsNegative(song.mtime))
Expand All @@ -94,6 +132,8 @@ song_print_info(Response &r, const DetachedSong &song, bool base) noexcept
{
song_print_uri(r, song, base);

song_print_real_uri(r, song, base);

PrintRange(r, song.GetStartTime(), song.GetEndTime());

if (!IsNegative(song.GetLastModified()))
Expand Down
8 changes: 6 additions & 2 deletions src/db/plugins/ProxyDatabasePlugin.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,16 @@ Copy(TagBuilder &tag, TagType d_tag,
ProxySong::ProxySong(const mpd_song *song)
:LightSong(mpd_song_get_uri(song), tag2)
{
const auto _real_uri = mpd_song_get_real_uri(song);
if (_real_uri != nullptr)
real_uri = _real_uri;

const auto _mtime = mpd_song_get_last_modified(song);
if (_mtime > 0)
mtime = std::chrono::system_clock::from_time_t(_mtime);

start_time = SongTime::FromS(mpd_song_get_start(song));
end_time = SongTime::FromS(mpd_song_get_end(song));
start_time = SongTime::FromMS(mpd_song_get_start_ms(song));
end_time = SongTime::FromMS(mpd_song_get_end_ms(song));

const auto *af = mpd_song_get_audio_format(song);
if (af != nullptr) {
Expand Down
2 changes: 1 addition & 1 deletion src/input/plugins/CurlInputPlugin.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ CurlInputStream::SeekInternal(offset_type new_offset)

if (offset > 0)
request->SetOption(CURLOPT_RANGE,
fmt::format_int{offset}.c_str());
fmt::format("{}-", offset).c_str());

StartRequest();
}
Expand Down
5 changes: 4 additions & 1 deletion src/player/Thread.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,10 @@ PlayerControl::LockUpdateSongTag(DetachedSong &song,
streams may change tags dynamically */
return;

song.SetTag(new_tag);
if (!song.GetEndTime().IsZero())
song.SetTag(Tag::Merge(song.GetTag(), new_tag));
else
song.SetTag(new_tag);

LockSetTaggedSong(song);

Expand Down