Merge pull request from Salanto/fix-jukeboxadding

Fix Jukebox incorrectly discarding songs
This commit is contained in:
Rosemary Witchaven 2021-09-13 17:10:00 -05:00 committed by GitHub
commit 45036a9b6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -536,22 +536,22 @@ void AreaData::toggleJukebox()
QString AreaData::addJukeboxSong(QString f_song)
{
if(!m_jukebox_queue.contains(f_song)) {
if (m_jukebox_queue.size() == 0) {
int l_song_duration = ConfigManager::songInformation(f_song);
if (l_song_duration >= 0) {
emit playJukeboxSong(AOPacket("MC",{f_song,QString::number(-1)}), index());
m_jukebox_timer->start(l_song_duration * 1000);
if (l_song_duration > 0) {
if (m_jukebox_queue.size() == 0) {
emit playJukeboxSong(AOPacket("MC",{f_song,QString::number(-1)}), index());
m_jukebox_timer->start(l_song_duration * 1000);
}
setCurrentMusic(f_song);
setMusicPlayedBy("Jukebox");
m_jukebox_queue.append(f_song);
return "Song added to Jukebox.";
}
}
return "Unable to add song. Duration shorther than 1.";
}
else {
return "Unable to add song. Song already in Jukebox.";
else {
return "Unable to add song. Duration shorter than 1.";
}
}
return "Unable to add song. Song already in Jukebox.";
}
void AreaData::switchJukeboxSong()