Permalink
Browse files

MythMusic: Stop playback when exiting the import music screen

This stops playback when exiting the screen if the current track was played
from the import music screen.
  • Loading branch information...
Paul Harrison
Paul Harrison committed Aug 9, 2013
1 parent 315ec24 commit 5de9c61bb001c4176665d37b791be534a315c68f
Showing with 24 additions and 15 deletions.
  1. +1 −1 mythplugins/mythmusic/mythmusic/importmusic.cpp
  2. +23 −14 mythplugins/mythmusic/mythmusic/musicplayer.cpp
@@ -121,7 +121,7 @@ ImportMusicDialog::~ImportMusicDialog()
if (gPlayer->getCurrentMetadata() && m_playingMetaData)
{
if (gPlayer->isPlaying() && gPlayer->getCurrentMetadata()->Filename() == m_playingMetaData->Filename())
gPlayer->next();
gPlayer->stop();
}
if (m_locationEdit)
@@ -480,7 +480,7 @@ void MusicPlayer::nextAuto(void)
{
delete m_oneshotMetadata;
m_oneshotMetadata = NULL;
play();
stop(true);
return;
}
@@ -794,24 +794,33 @@ void MusicPlayer::customEvent(QEvent *event)
}
else if (event->type() == DecoderEvent::Finished)
{
if (m_playMode == PLAYMODE_TRACKS && m_currentMetadata &&
m_currentTime != m_currentMetadata->Length() / 1000)
if (m_oneshotMetadata)
{
delete m_oneshotMetadata;
m_oneshotMetadata = NULL;
stop(true);
}
else
{
LOG(VB_GENERAL, LOG_NOTICE, QString("MusicPlayer: Updating track length was %1s, should be %2s")
.arg(m_currentMetadata->Length() / 1000).arg(m_currentTime));
if (m_playMode == PLAYMODE_TRACKS && m_currentMetadata &&
m_currentTime != m_currentMetadata->Length() / 1000)
{
LOG(VB_GENERAL, LOG_NOTICE, QString("MusicPlayer: Updating track length was %1s, should be %2s")
.arg(m_currentMetadata->Length() / 1000).arg(m_currentTime));
m_currentMetadata->setLength(m_currentTime * 1000);
m_currentMetadata->dumpToDatabase();
m_currentMetadata->setLength(m_currentTime * 1000);
m_currentMetadata->dumpToDatabase();
// this will update any track lengths displayed on screen
gPlayer->sendMetadataChangedEvent(m_currentMetadata->ID());
// this will update any track lengths displayed on screen
gPlayer->sendMetadataChangedEvent(m_currentMetadata->ID());
// this will force the playlist stats to update
MusicPlayerEvent me(MusicPlayerEvent::TrackChangeEvent, m_currentTrack);
dispatch(me);
}
// this will force the playlist stats to update
MusicPlayerEvent me(MusicPlayerEvent::TrackChangeEvent, m_currentTrack);
dispatch(me);
}
nextAuto();
nextAuto();
}
}
else if (event->type() == DecoderEvent::Stopped)
{

0 comments on commit 5de9c61

Please sign in to comment.