Пример #1
0
    def set_next(self):
        """
            Play next track
            @param sql as sqlite cursor
        """
        # Look at externals
        self.next_track = ExternalsPlayer.next(self)

        # Look at radio
        if self.next_track.id is None:
            self.next_track = RadioPlayer.next(self)

        # Look first at user queue
        if self.next_track.id is None:
            self.next_track = QueuePlayer.next(self)
            if self.next_track.id is not None:
                self.context.next_track = LinearPlayer.next(self)

        # Look at user playlist then
        if self.next_track.id is None:
            self.next_track = UserPlaylistPlayer.next(self)

        # Get a random album/track then
        if self.next_track.id is None:
            self.next_track = ShufflePlayer.next(self)

        # Get a linear track then
        if self.next_track.id is None:
            if self.context.next_track is not None:
                self.next_track = self.context.next_track
                self.context.next_track = None
            else:
                self.next_track = LinearPlayer.next(self)
        self.emit('next-changed')
Пример #2
0
    def set_next(self):
        """
            Play next track
            @param sql as sqlite cursor
        """
        # Look at externals
        self.next_track = ExternalsPlayer.next(self)

        # Look at radio
        if self.next_track.id is None:
            self.next_track = RadioPlayer.next(self)

        # Look first at user queue
        if self.next_track.id is None:
            self.next_track = QueuePlayer.next(self)
            if self.next_track.id is not None:
                self.context.next_track = LinearPlayer.next(self)

        # Look at user playlist then
        if self.next_track.id is None:
            self.next_track = UserPlaylistPlayer.next(self)

        # Get a random album/track then
        if self.next_track.id is None:
            self.next_track = ShufflePlayer.next(self)

        # Get a linear track then
        if self.next_track.id is None:
            if self.context.next_track is not None:
                self.next_track = self.context.next_track
                self.context.next_track = None
            else:
                self.next_track = LinearPlayer.next(self)
        self.emit('next-changed')
Пример #3
0
    def set_next(self, force=False):
        """
            Play next track
            @param sql as sqlite cursor
            @param force as bool
        """
        try:
            # Reset finished context
            self._next_context = NextContext.NONE

            # Same track
            if App().settings.get_enum("playback") == NextContext.REPEAT_TRACK:
                next_track = self._current_track
            # Look first at user queue
            else:
                next_track = QueuePlayer.next(self)

            # Look at shuffle
            if next_track.id is None:
                next_track = ShufflePlayer.next(self)

            # Look at user playlist then
            if next_track.id is None:
                next_track = PlaylistPlayer.next(self, force)

            # Get a linear track then
            if next_track.id is None:
                next_track = LinearPlayer.next(self)
            self._next_track = next_track
            self.emit("next-changed")
        except Exception as e:
            Logger.error("Player::set_next(): %s" % e)
Пример #4
0
    def set_next(self):
        """
            Play next track
        """
        if self.current_track.id == Type.RADIOS or\
                self._current_track.id == self.__stop_after_track_id:
            self.__stop_after_track_id = None
            self._next_track = Track()
            return
        try:
            next_track = QueuePlayer.next(self)

            # Look at shuffle
            if next_track.id is None:
                next_track = ShufflePlayer.next(self)

            # Look at user playlist then
            if next_track.id is None:
                next_track = PlaylistPlayer.next(self)

            # Get a linear track then
            if next_track.id is None:
                next_track = LinearPlayer.next(self)

            self._next_track = next_track
            if next_track.is_web:
                App().task_helper.run(self._load_from_web, next_track, False)
            self.emit("next-changed")
        except Exception as e:
            Logger.error("Player::set_next(): %s" % e)
Пример #5
0
    def set_next(self):
        """
            Play next track
            @param sql as sqlite cursor
        """
        # Reset finished context
        self._finished = NextContext.NONE

        # Look at externals
        self._next_track = ExternalsPlayer.next(self)

        # Look at radio
        if self._next_track.id is None:
            self._next_track = RadioPlayer.next(self)

        # Look first at user queue
        if self._next_track.id is None:
            self._next_track = QueuePlayer.next(self)

        # Look at user playlist then
        if self._next_track.id is None:
            self._next_track = UserPlaylistPlayer.next(self)

        # Get a random album/track then
        if self._next_track.id is None:
            self._next_track = ShufflePlayer.next(self)

        # Get a linear track then
        if self._next_track.id is None:
            self._next_track = LinearPlayer.next(self)

        self.emit('next-changed')
Пример #6
0
    def set_next(self):
        """
            Play next track
            @param sql as sqlite cursor
        """
        # Look at externals
        self.next_track = ExternalsPlayer.next(self)

        # Look at radio
        if self.next_track.id is None:
            self.next_track = RadioPlayer.next(self)

        # Look first at user queue
        if self.next_track.id is None:
            self.next_track = QueuePlayer.next(self)

        # Look at user playlist then
        if self.next_track.id is None:
            self.next_track = UserPlaylistPlayer.next(self)

        # Get a random album/track then
        if self.next_track.id is None:
            self.next_track = ShufflePlayer.next(self)

        # Get a linear track then
        if self.next_track.id is None:
            self.next_track = LinearPlayer.next(self)
Пример #7
0
 def set_next(self):
     """
         Play next track
     """
     if self._current_track.id is None:
         return
     if self._current_track.id == self.__stop_after_track_id:
         self._next_track = Track()
         return
     try:
         next_track = QueuePlayer.next(self)
         if next_track.id is None:
             # Diverge current track to restore playback from queue
             diverge_current_track = None
             if self._queue_current_track is not None:
                 diverge_current_track = self._current_track
                 self._current_track = self._queue_current_track
             if App().settings.get_value("shuffle") or self.is_party:
                 next_track = ShufflePlayer.next(self)
             else:
                 next_track = LinearPlayer.next(self)
             # Restore current track
             if diverge_current_track is not None:
                 self._current_track = diverge_current_track
                 self._queue_current_track = None
         self._next_track = next_track
         emit_signal(self, "next-changed")
     except Exception as e:
         Logger.error("Player::set_next(): %s" % e)
Пример #8
0
    def set_next(self):
        """
            Play next track
            @param sql as sqlite cursor
        """
        # Look at externals
        self.next_track = ExternalsPlayer.next(self)

        # Look at radio
        if self.next_track.id is None:
            self.next_track = RadioPlayer.next(self)

        # Look first at user queue
        if self.next_track.id is None:
            self.next_track = QueuePlayer.next(self)

        # Look at user playlist then
        if self.next_track.id is None:
            self.next_track = UserPlaylistPlayer.next(self)

        # Get a random album/track then
        if self.next_track.id is None:
            self.next_track = ShufflePlayer.next(self)

        # Get a linear track then
        if self.next_track.id is None:
            self.next_track = LinearPlayer.next(self)
Пример #9
0
    def set_next(self, force=False):
        """
            Play next track
            @param sql as sqlite cursor
            @param force as bool
        """
        try:
            # Reset finished context
            self._next_context = NextContext.NONE

            if Lp().settings.get_enum('playback') == NextContext.REPEAT_TRACK:
                next_track = self._current_track
            else:
                # Look at externals
                next_track = ExternalsPlayer.next(self)

            # Look at radio
            if next_track.id is None:
                next_track = RadioPlayer.next(self)

            # Look first at user queue
            if next_track.id is None:
                next_track = QueuePlayer.next(self)

            # Look at user playlist then
            if next_track.id is None:
                next_track = UserPlaylistPlayer.next(self, force)

            # Get a random album/track then
            if next_track.id is None:
                next_track = ShufflePlayer.next(self)

            # Get a linear track then
            if next_track.id is None:
                next_track = LinearPlayer.next(self)
            if next_track.is_web:
                self._load_web(next_track, False)
            self._next_track = next_track
            self.emit('next-changed')
        except Exception as e:
            print("Player::set_next():", e)
Пример #10
0
    def set_next(self):
        """
            Play next track
            @param sql as sqlite cursor
        """
        # Reset finished context
        self._finished = NextContext.NONE

        # Special case to return from queue
        if self._queue and self.context.next_track.id is None:
            self.context.next_track = self.next_track
        elif not self._queue and self.context.next_track.id is not None:
            self.next_track = self.context.next_track
            self.context.next_track = Track()
            self.emit('next-changed')
            return

        # Look at externals
        self.next_track = ExternalsPlayer.next(self)

        # Look at radio
        if self.next_track.id is None:
            self.next_track = RadioPlayer.next(self)

        # Look first at user queue
        if self.next_track.id is None:
            self.next_track = QueuePlayer.next(self)

        # Look at user playlist then
        if self.next_track.id is None:
            self.next_track = UserPlaylistPlayer.next(self)

        # Get a random album/track then
        if self.next_track.id is None:
            self.next_track = ShufflePlayer.next(self)

        # Get a linear track then
        if self.next_track.id is None:
            self.next_track = LinearPlayer.next(self)

        self.emit('next-changed')
Пример #11
0
    def set_next(self, force=False):
        """
            Play next track
            @param sql as sqlite cursor
            @param force as bool
        """
        try:
            # Reset finished context
            self._next_context = NextContext.NONE

            if Lp().settings.get_enum('playback') == NextContext.REPEAT_TRACK:
                next_track = self.current_track
            else:
                # Look at externals
                next_track = ExternalsPlayer.next(self)

            # Look at radio
            if next_track.id is None:
                next_track = RadioPlayer.next(self)

            # Look first at user queue
            if next_track.id is None:
                next_track = QueuePlayer.next(self)

            # Look at user playlist then
            if next_track.id is None:
                next_track = UserPlaylistPlayer.next(self, force)

            # Get a random album/track then
            if next_track.id is None:
                next_track = ShufflePlayer.next(self)

            # Get a linear track then
            if next_track.id is None:
                next_track = LinearPlayer.next(self)
            if next_track.is_web:
                self._load_web(next_track, False)
            self._next_track = next_track
            self.emit('next-changed')
        except Exception as e:
            print("Player::set_next", e)
Пример #12
0
    def next(self, force=True, sql=None):
        # Look first at user queue
        track_id = QueuePlayer.next(self)

        # Look at user playlist then
        if track_id is None:
            track_id = UserPlaylistPlayer.next(self)

        # Get a random album/track
        if track_id is None:
            track_id = ShufflePlayer.next(self, sql)

        # Get a linear track
        if track_id is None:
            track_id = LinearPlayer.next(self, sql)

        if track_id is not None:
            if force:
                self.load(track_id)
            else:
                self._load_track(track_id, sql)
Пример #13
0
    def set_next(self, force=False):
        """
            Play next track
            @param sql as sqlite cursor
            @param force as bool
        """
        try:
            # Reset finished context
            self._finished = NextContext.NONE

            # Look at externals
            next_track = ExternalsPlayer.next(self)

            # Look at radio
            if next_track.id is None:
                next_track = RadioPlayer.next(self)

            # Look first at user queue
            if next_track.id is None:
                next_track = QueuePlayer.next(self)

            # Look at user playlist then
            if next_track.id is None:
                next_track = UserPlaylistPlayer.next(self, force)

            # Get a random album/track then
            if next_track.id is None:
                next_track = ShufflePlayer.next(self)

            # Get a linear track then
            if next_track.id is None:
                next_track = LinearPlayer.next(self)
            if next_track.is_youtube:
                self._load_youtube(next_track, False)
            self._next_track = next_track
            self.emit('next-changed')
        except Exception as e:
            print("Player::set_next", e)