[Merge] lp:~phablet-team/media-hub/bg-playlist-fixes into lp:media-hub/stable
Jim Hodapp
jim.hodapp at canonical.com
Fri Nov 13 15:41:34 UTC 2015
A couple of comments below.
Diff comments:
>
> === modified file 'src/core/media/track_list_skeleton.cpp'
> --- src/core/media/track_list_skeleton.cpp 2015-11-12 18:09:50 +0000
> +++ src/core/media/track_list_skeleton.cpp 2015-11-12 18:09:50 +0000
> @@ -176,8 +181,53 @@
> media::Track::Id track;
> msg->reader() >> track;
>
> + auto id_it = find(impl->tracks().get().begin(), impl->tracks().get().end(), track);
> + if (id_it == impl->tracks().get().end()) {
> + ostringstream err_str;
> + err_str << "Track " << track << " not found in play list";
> + cout << __PRETTY_FUNCTION__ << " WARNING " << err_str.str() << endl;
> + auto reply = dbus::Message::make_error(
> + msg,
> + mpris::TrackList::Error::TrackNotFound::name,
> + err_str.str());
> + bus->send(reply);
> + return;
> + }
> +
> + media::Track::Id next;
> + bool deleting_current = false;
> +
> + if (id_it == impl->current_iterator()) {
> + cout << "Removing current track" << endl;
> + deleting_current = true;
> +
> + if (current_track != empty_iterator) {
> + ++current_track;
> +
> + if (current_track == impl->tracks().get().end()
> + && loop_status == media::Player::LoopStatus::playlist)
> + current_track = impl->tracks().get().begin();
> +
> + if (current_track == impl->tracks().get().end())
> + current_track = empty_iterator;
I see what you mean now and I also see my mistake in interpreting this code. Looks good to me now.
> + else
> + next = *current_track;
> + }
> + } else if (current_track != empty_iterator) {
> + next = *current_track;
> + }
> +
> impl->remove_track(track);
>
> + if (not next.empty()) {
> + current_track = find(impl->tracks().get().begin(), impl->tracks().get().end(), next);
Maybe I'm being a little too picky, but I still see a case where next could not be empty but possibly not be found in tracks().
> +
> + if (deleting_current) {
> + const bool toggle_player_state = true;
> + impl->go_to(next, toggle_player_state);
> + }
> + }
> +
> auto reply = dbus::Message::make_method_return(msg);
> bus->send(reply);
> }
--
https://code.launchpad.net/~phablet-team/media-hub/bg-playlist-fixes/+merge/276094
Your team Ubuntu Phablet Team is subscribed to branch lp:media-hub/stable.
More information about the Ubuntu-reviews
mailing list