Esempio n. 1
0
    def doModal(self, sources=None, item_information=None, pack_select=False):
        """
        Opens window in an intractable mode and runs background scripts
        :param sources: List of sources to attempt to resolve
        :type sources: list
        :param item_information: Metadata dict of item attempting to resolve for
        :type item_information: dict
        :param pack_select: Set to True to enable manual file selection
        :type pack_select: bool
        :return: Stream link
        :rtype: str
        """
        self.sources = sources if sources else []
        self.item_information = item_information if item_information else {}
        self.pack_select = pack_select

        if not self.sources:
            return

        self.resolver = Resolver()
        self._update_window_properties(self.sources[0])

        super(ResolverWindow, self).doModal()

        if not self.canceled:
            return self.return_data
        else:
            return None
Esempio n. 2
0
 def __init__(self, xml_file, location, actionArgs=None, sources=None, **kwargs):
     super(SourceSelect, self).__init__(xml_file, location, actionArgs=actionArgs)
     self.actionArgs = actionArgs
     self.sources = sources
     self.position = -1
     self.canceled = False
     self.display_list = None
     tools.closeBusyDialog()
     self.Resolver = Resolver('resolver.xml', tools.addonDir, actionArgs=actionArgs)
     self.stream_link = None
    def resolve_item(self):
        if tools.getSetting('general.autotrynext') == 'true':
            sources = self.sources[self.position:]
        else:
            sources = [self.sources[self.position]]

        resolver = Resolver(*SkinManager().confirm_skin_path('resolver.xml'), actionArgs=self.actionArgs)

        self.stream_link = database.get(resolver.doModal, 1, sources,
                                        tools.get_item_information(self.actionArgs), False)

        if self.stream_link is None:
            tools.showDialog.notification(tools.addonName, tools.lang(32047), time=2000)
            return
        else:
            self.close()
 def resolve_silent_or_visible(self, sources, item_information, pack_select=False, overwrite_cache=False):
     """
     Method to handle automatic background or foreground resolving
     :param sources: list of sources to handle
     :param item_information: information on item to play
     :param pack_select: True if you want to perform a manual file selection
     :param overwrite_cache: Set to true if you wish to overwrite the current cached return value
     :return: None if unsuccessful otherwise a playable object
     """
     if g.get_bool_runtime_setting('tempSilent'):
         return Resolver().resolve_multiple_until_valid_link(sources, item_information, pack_select, True)
     else:
         window = ResolverWindow(*SkinManager().confirm_skin_path('resolver.xml'),
                                 item_information=item_information)
         results = window.doModal(sources, item_information, pack_select)
         del window
         return results
Esempio n. 5
0
    def resolve_silent_or_visible(self,
                                  sources,
                                  item_information,
                                  pack_select=False,
                                  from_source_select=False,
                                  overwrite_cache=False):
        """
        Method to handle automatic background or foreground resolving
        :param sources: list of sources to handle
        :param item_information: information on item to play
        :param pack_select: True if you want to perform a manual file selection
        :param from_source_select: True if we were called from SS screen
        :param overwrite_cache: Set to true if you wish to overwrite the current cached return value
        :return: None if unsuccessful otherwise a playable object
        """
        stream_link = ""
        release_title = ""

        if g.get_bool_runtime_setting('tempSilent'):
            stream_link, release_title = Resolver(
            ).resolve_multiple_until_valid_link(sources, item_information,
                                                pack_select, True)
        else:
            try:
                window = ResolverWindow(
                    *SkinManager().confirm_skin_path('resolver.xml'),
                    item_information=item_information)
                stream_link, release_title = window.doModal(
                    sources,
                    pack_select,
                    from_source_select=from_source_select,
                )
            finally:
                del window

        if item_information['info'][
                'mediatype'] == g.MEDIA_EPISODE and release_title:
            g.set_runtime_setting(
                "last_resolved_release_title.{}".format(
                    item_information['info']['trakt_show_id']), release_title)
        return stream_link