Add Song::is_radio()
This commit is contained in:
parent
5700c3f72e
commit
b053f99690
|
@ -375,13 +375,8 @@ double Song::rating() const { return d->rating_; }
|
|||
|
||||
bool Song::is_collection_song() const { return d->source_ == Source_Collection; }
|
||||
bool Song::is_metadata_good() const { return !d->url_.isEmpty() && !d->artist_.isEmpty() && !d->title_.isEmpty(); }
|
||||
bool Song::is_stream() const { return d->source_ == Source_Stream ||
|
||||
d->source_ == Source_Tidal ||
|
||||
d->source_ == Source_Subsonic ||
|
||||
d->source_ == Source_Qobuz ||
|
||||
d->source_ == Source_SomaFM ||
|
||||
d->source_ == Source_RadioParadise;
|
||||
}
|
||||
bool Song::is_stream() const { return is_radio() || d->source_ == Source_Tidal || d->source_ == Source_Subsonic || d->source_ == Source_Qobuz; }
|
||||
bool Song::is_radio() const { return d->source_ == Source_Stream || d->source_ == Source_SomaFM || d->source_ == Source_RadioParadise; }
|
||||
bool Song::is_cdda() const { return d->source_ == Source_CDDA; }
|
||||
bool Song::is_compilation() const { return (d->compilation_ || d->compilation_detected_ || d->compilation_on_) && !d->compilation_off_; }
|
||||
bool Song::stream_url_can_expire() const { return d->source_ == Song::Source_Tidal || d->source_ == Song::Source_Qobuz; }
|
||||
|
|
|
@ -262,6 +262,7 @@ class Song {
|
|||
|
||||
bool is_collection_song() const;
|
||||
bool is_stream() const;
|
||||
bool is_radio() const;
|
||||
bool is_cdda() const;
|
||||
bool is_metadata_good() const;
|
||||
bool art_automatic_is_valid() const;
|
||||
|
|
|
@ -381,7 +381,7 @@ AlbumCoverLoader::TryLoadResult AlbumCoverLoader::TryLoadImage(Task *task) {
|
|||
}
|
||||
|
||||
// For local files and streams initialize art if found.
|
||||
if ((task->song.source() == Song::Source_LocalFile || task->song.source() == Song::Source_Stream) && !task->song.art_manual_is_valid() && !task->song.art_automatic_is_valid()) {
|
||||
if ((task->song.source() == Song::Source_LocalFile || task->song.is_radio()) && !task->song.art_manual_is_valid() && !task->song.art_automatic_is_valid()) {
|
||||
switch (task->state) {
|
||||
case State_None:
|
||||
break;
|
||||
|
|
|
@ -642,7 +642,7 @@ void ListenBrainzScrobbler::CheckScrobblePrevSong() {
|
|||
|
||||
quint64 duration = QDateTime::currentDateTime().toSecsSinceEpoch() - timestamp_;
|
||||
|
||||
if (!scrobbled_ && song_playing_.is_metadata_good() && song_playing_.source() == Song::Source_Stream && duration > 30) {
|
||||
if (!scrobbled_ && song_playing_.is_metadata_good() && song_playing_.is_radio() && duration > 30) {
|
||||
Song song(song_playing_);
|
||||
song.set_length_nanosec(duration * kNsecPerSec);
|
||||
Scrobble(song);
|
||||
|
|
|
@ -1086,7 +1086,7 @@ void ScrobblingAPI20::CheckScrobblePrevSong() {
|
|||
|
||||
quint64 duration = QDateTime::currentDateTime().toSecsSinceEpoch() - timestamp_;
|
||||
|
||||
if (!scrobbled_ && song_playing_.is_metadata_good() && song_playing_.source() == Song::Source_Stream && duration > 30) {
|
||||
if (!scrobbled_ && song_playing_.is_metadata_good() && song_playing_.is_radio() && duration > 30) {
|
||||
Song song(song_playing_);
|
||||
song.set_length_nanosec(duration * kNsecPerSec);
|
||||
Scrobble(song);
|
||||
|
|
Loading…
Reference in New Issue