db/LightSong: implicit initialization
This commit is contained in:
parent
b9ff6383a4
commit
80cb680fca
@ -42,7 +42,7 @@ struct LightSong {
|
|||||||
* #uri. To build the full URI, join directory and uri with a
|
* #uri. To build the full URI, join directory and uri with a
|
||||||
* slash.
|
* slash.
|
||||||
*/
|
*/
|
||||||
const char *directory;
|
const char *directory = nullptr;
|
||||||
|
|
||||||
const char *uri;
|
const char *uri;
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ struct LightSong {
|
|||||||
* This attribute is used for songs from the database which
|
* This attribute is used for songs from the database which
|
||||||
* have a relative URI.
|
* have a relative URI.
|
||||||
*/
|
*/
|
||||||
const char *real_uri;
|
const char *real_uri = nullptr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Metadata.
|
* Metadata.
|
||||||
@ -65,18 +65,18 @@ struct LightSong {
|
|||||||
* The time stamp of the last file modification. A negative
|
* The time stamp of the last file modification. A negative
|
||||||
* value means that this is unknown/unavailable.
|
* value means that this is unknown/unavailable.
|
||||||
*/
|
*/
|
||||||
std::chrono::system_clock::time_point mtime;
|
std::chrono::system_clock::time_point mtime = std::chrono::system_clock::time_point::min();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start of this sub-song within the file.
|
* Start of this sub-song within the file.
|
||||||
*/
|
*/
|
||||||
SongTime start_time;
|
SongTime start_time = SongTime::zero();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End of this sub-song within the file.
|
* End of this sub-song within the file.
|
||||||
* Unused if zero.
|
* Unused if zero.
|
||||||
*/
|
*/
|
||||||
SongTime end_time;
|
SongTime end_time = SongTime::zero();
|
||||||
|
|
||||||
explicit LightSong(const Tag &_tag) noexcept
|
explicit LightSong(const Tag &_tag) noexcept
|
||||||
:tag(_tag) {}
|
:tag(_tag) {}
|
||||||
|
@ -205,20 +205,15 @@ Copy(TagBuilder &tag, TagType d_tag,
|
|||||||
ProxySong::ProxySong(const mpd_song *song)
|
ProxySong::ProxySong(const mpd_song *song)
|
||||||
:LightSong(tag2)
|
:LightSong(tag2)
|
||||||
{
|
{
|
||||||
directory = nullptr;
|
|
||||||
uri = mpd_song_get_uri(song);
|
uri = mpd_song_get_uri(song);
|
||||||
real_uri = nullptr;
|
|
||||||
|
|
||||||
const auto _mtime = mpd_song_get_last_modified(song);
|
const auto _mtime = mpd_song_get_last_modified(song);
|
||||||
mtime = _mtime > 0
|
if (_mtime > 0)
|
||||||
? std::chrono::system_clock::from_time_t(_mtime)
|
mtime = std::chrono::system_clock::from_time_t(_mtime);
|
||||||
: std::chrono::system_clock::time_point::min();
|
|
||||||
|
|
||||||
#if LIBMPDCLIENT_CHECK_VERSION(2,3,0)
|
#if LIBMPDCLIENT_CHECK_VERSION(2,3,0)
|
||||||
start_time = SongTime::FromS(mpd_song_get_start(song));
|
start_time = SongTime::FromS(mpd_song_get_start(song));
|
||||||
end_time = SongTime::FromS(mpd_song_get_end(song));
|
end_time = SongTime::FromS(mpd_song_get_end(song));
|
||||||
#else
|
|
||||||
start_time = end_time = SongTime::zero();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TagBuilder tag_builder;
|
TagBuilder tag_builder;
|
||||||
|
@ -59,11 +59,8 @@ public:
|
|||||||
uri2(std::move(_uri)),
|
uri2(std::move(_uri)),
|
||||||
real_uri2(std::move(object.url)),
|
real_uri2(std::move(object.url)),
|
||||||
tag2(std::move(object.tag)) {
|
tag2(std::move(object.tag)) {
|
||||||
directory = nullptr;
|
|
||||||
uri = uri2.c_str();
|
uri = uri2.c_str();
|
||||||
real_uri = real_uri2.c_str();
|
real_uri = real_uri2.c_str();
|
||||||
mtime = std::chrono::system_clock::time_point::min();
|
|
||||||
start_time = end_time = SongTime::zero();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -322,11 +319,8 @@ visitSong(const UPnPDirObject &meta, const char *path,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
LightSong song(meta.tag);
|
LightSong song(meta.tag);
|
||||||
song.directory = nullptr;
|
|
||||||
song.uri = path;
|
song.uri = path;
|
||||||
song.real_uri = meta.url.c_str();
|
song.real_uri = meta.url.c_str();
|
||||||
song.mtime = std::chrono::system_clock::time_point::min();
|
|
||||||
song.start_time = song.end_time = SongTime::zero();
|
|
||||||
|
|
||||||
if (selection.Match(song))
|
if (selection.Match(song))
|
||||||
visit_song(song);
|
visit_song(song);
|
||||||
|
Loading…
Reference in New Issue
Block a user