Esempio n. 1
0
    def _start_playback(self):
        if self.playback_started:
            return

        self.playback_started = True
        self.plaback_stopped = False
        self.scrobbled = False
        self.playback_timestamp = time.time()

        while self._is_file_playing() and not g.abort_requested():
            if (int(self.getTime()) == self.skip_intro_from
                    and self.skip_intro):
                if (self.force_skip == 0 and not self.intro_skipped):
                    self.seekTime(self.skip_intro_to)
                    self.intro_skipped = True
                    break
                elif (self.force_skip == 1):
                    self.seekTime(self.skip_intro_to)
                    break
            else:
                break

        g.close_all_dialogs()

        if self.smart_playlists and self.mediatype == "episode":
            if g.PLAYLIST.size(
            ) == 1 and not self.smart_module.is_season_final():
                self.smart_module.build_playlist()
            elif g.PLAYLIST.size() == g.PLAYLIST.getposition() + 1:
                self.smart_module.append_next_season()
Esempio n. 2
0
    def _start_playback(self):
        if self.playback_started:
            return

        self.playback_started = True
        self.plaback_stopped = False
        self.scrobbled = False
        self.playback_timestamp = time.time()

        g.close_all_dialogs()

        if self.smart_playlists and self.mediatype == "episode":
            if g.PLAYLIST.size() == 1 and not self.smart_module.is_season_final():
                self.smart_module.build_playlist()
            elif g.PLAYLIST.size() == g.PLAYLIST.getposition() + 1:
                self.smart_module.append_next_season()
Esempio n. 3
0
    def play_source(self, stream_link, item_information, resume_time=None):
        """Method for handling playing of sources.

        :param stream_link: Direct link of source to be played or dict containing more information about the stream
        to play
        :type stream_link: str|dict
        :param item_information: Information about the item to be played
        :type item_information:dict
        :param resume_time:Time to resume the source at
        :type resume_time:int
        :rtype:None
        """
        self.pre_scrape_initiated = False
        if resume_time:
            self.offset = float(resume_time)

        if not stream_link:
            g.cancel_playback()
            return

        self.playing_file = stream_link
        self.item_information = item_information
        self.smart_module = smartPlay.SmartPlay(item_information)
        self.mediatype = self.item_information["info"]["mediatype"]
        self.trakt_id = self.item_information["info"]["trakt_id"]

        if self.item_information.get("resume", "false") == "true":
            self._try_get_bookmark()

        self._handle_bookmark()
        self._add_support_for_external_trakt_scrobbling()

        g.close_busy_dialog()
        g.close_all_dialogs()

        xbmcplugin.setResolvedUrl(g.PLUGIN_HANDLE, True,
                                  self._create_list_item(stream_link))

        self._keep_alive()
Esempio n. 4
0
    def resume_show(self):
        """
        Identifies resumse point for a show and plays from there
        :return:
        :rtype:
        """
        g.cancel_playback()
        g.close_all_dialogs()
        g.PLAYLIST.clear()

        window = self._get_window()

        window.set_text(g.get_language_string(30063))
        window.show()

        window.set_text(g.get_language_string(30064))

        season_id, episode = self.get_resume_episode()

        window.set_text(g.get_language_string(30065))

        window.set_text(g.get_language_string(30066))

        self.build_playlist(season_id, episode)

        window.set_text(g.get_language_string(30338))

        g.log(
            "Begining play from Season ID {} Episode {}".format(
                season_id, episode),
            "info",
        )

        window.close()
        del window

        xbmc.Player().play(g.PLAYLIST)