diff --git a/TODO b/TODO index 4994d6a7..06ae97ec 100644 --- a/TODO +++ b/TODO @@ -50,7 +50,6 @@ - MediaPlayer: move the slider using js (http://redmine.webtoolkit.eu/boards/2/topics/7924?r=8478, http://redmine.emweb.be/boards/2/topics/10994) - TrackView: handle durations > 1 hour - TrackView: Reselect the current selected item when displaying the updated search results - - TrackView: display the total duration of the track query - Add covers in the release filter? - Add a download button to get the current playlist in a streamed zip file - Add a upload button to upload media files in a dedicated directory diff --git a/src/ui/audio/desktop/AudioMediaPlayer.cpp b/src/ui/audio/desktop/AudioMediaPlayer.cpp index f67a0948..ee9157d3 100644 --- a/src/ui/audio/desktop/AudioMediaPlayer.cpp +++ b/src/ui/audio/desktop/AudioMediaPlayer.cpp @@ -190,7 +190,7 @@ AudioMediaPlayer::loadPlayer(boost::filesystem::path filePath, Av::TranscodePara _mediaPlayer->play(); } -void +bool AudioMediaPlayer::load(Database::Track::id_type trackId) { Av::TranscodeParameters parameters; @@ -203,6 +203,11 @@ AudioMediaPlayer::load(Database::Track::id_type trackId) Wt::Dbo::Transaction transaction(DboSession()); Database::Track::pointer track = Database::Track::getById(DboSession(), trackId); + if (!track) + { + LMS_LOG(UI, INFO) << "Cannot find track id " << trackId; + return false; + } path = track->getPath(); parameters.setBitrate(Av::Stream::Type::Audio, CurrentUser()->getAudioBitrate() ); @@ -216,11 +221,10 @@ AudioMediaPlayer::load(Database::Track::id_type trackId) Av::MediaFile mediaFile(path); - if (!mediaFile.open()) + if (!mediaFile.open() || !mediaFile.scan()) { - // No longer exist ? TODO next? LMS_LOG(UI, INFO) << "Cannot open file '" << path << "'"; - return; + return false; } // It seems to be far better to manually map the streams @@ -248,6 +252,8 @@ AudioMediaPlayer::load(Database::Track::id_type trackId) _duration->setText( boost::posix_time::to_simple_string( duration )); loadPlayer(path, parameters); + + return true; } void diff --git a/src/ui/audio/desktop/AudioMediaPlayer.hpp b/src/ui/audio/desktop/AudioMediaPlayer.hpp index efff901b..4c3b4416 100644 --- a/src/ui/audio/desktop/AudioMediaPlayer.hpp +++ b/src/ui/audio/desktop/AudioMediaPlayer.hpp @@ -46,7 +46,7 @@ class AudioMediaPlayer : public Wt::WContainerWidget AudioMediaPlayer(Wt::WContainerWidget *parent = 0); // Load Media to be played - void load(Database::Track::id_type trackId); + bool load(Database::Track::id_type trackId); // Accessors Wt::WMediaPlayer::Encoding getEncoding() const { return _encoding; } diff --git a/src/ui/audio/desktop/DesktopAudio.cpp b/src/ui/audio/desktop/DesktopAudio.cpp index e83f8507..7e898a78 100644 --- a/src/ui/audio/desktop/DesktopAudio.cpp +++ b/src/ui/audio/desktop/DesktopAudio.cpp @@ -510,7 +510,8 @@ Audio::playTrack(Track::id_type trackId, int pos) CurrentUser().modify()->setCurPlayingTrackPos(pos); } - _mediaPlayer->load(trackId); + if (!_mediaPlayer->load(trackId)) + _playQueue->playNext(); } } // namespace Desktop