def process(self, subreddit):
     try:
         _remove_subreddit(subreddit)
         directory.refresh()
     except InvalidSubreddit:
         dlg = Dialog()
         dlg.ok(_('Error'), _('There is not such subreddit.'))
         raise self.AskAgain
Exemplo n.º 2
0
def play_url():
    url = plugin.args['url'][0]

    if url.startswith('https://') and (
            xbmc.getCondVisibility('system.platform.android') or
            xbmc.getCondVisibility('system.platform.ios')):
        dialog = Dialog()
        dialog.ok("NRK Nett-TV", "Direktestrømmer er ikke støttet på iOS/Android")

    xbmcplugin.setResolvedUrl(plugin.handle, True, ListItem(path=url))
Exemplo n.º 3
0
def force(mode):
	mode=str(mode)
	if path.exists(setxml):
		res=dom.read(setxml)
		adv=getchild(res,res,"advancedsettings")
		nw=getchild(res,adv,"network")
		bm=getchild(res,nw,"buffermode")
		for text in bm.childNodes:
			bm.removeChild(text)
		bm.appendChild(res.createTextNode(mode))
	else:
		res=minidom.parseString("<advancedsettings><network><buffermode>%s</buffermode></network></advancedsettings>"%mode)
	dom.write(setxml,res)
	dialog = Dialog()
	dialog.ok('UMP', 'LibCurl Buffering Mode set to %s'%mode,logs[mode],"YOU NEED TO RESTART KODI TO CHANGES TAKE AFFECT")
Exemplo n.º 4
0
def play_channel(category_id, channel_id):
    """
    Plays selected song
    :param category_id: Selected category ID
    :param channel_id: Selected channel ID
    :return:
    """
    api = API()
    user = User()
    is_authenticated = user.authenticate()
    recent_tracks_url = ''
    channel = [item for item in api.get_channels(int(category_id))
               if item['id'] == int(channel_id)][0]
    url = api.get_streaming_url(channel['streams'],
                                user.username,
                                user.token,
                                user.is_authenticated())

    if is_authenticated:
        recent_tracks_url = channel['recent_tracks']['vip']
    elif 'free' in channel['recent_tracks']:
        recent_tracks_url = channel['recent_tracks']['free']

    # is there a valid URL for channel?
    if url:
        url = quote(url, safe=':/?=@')
        li = ListItem(channel['title'], channel['description'], channel['image'])
        li.setArt({'thumb': '{0}/{1}'.format(config['urls']['calm_arts_host'], channel['image']),
                   'fanart': '{0}{1}'.format(config['urls']['calm_blurred_arts_host'], channel['image'])})
        li.setInfo('music', {'Title': channel['title'].replace('CALM RADIO -', '').title(),
                             'Artist': channel['description']})
        li.setProperty('mimetype', 'audio/mpeg')
        li.setProperty('IsPlayable', 'true')
        li.setInfo('music', {
            'Title': channel['title'].replace('CALM RADIO -', '').title()
        })
        Player().play(item=url, listitem=li)

        log('Playing url: {0}'.format(url))
        update_artwork(channel, recent_tracks_url)
    else:
        # members only access
        dialog = Dialog()
        ret = dialog.yesno(ADDON.getLocalizedString(32200), ADDON.getLocalizedString(32201))
        if ret == 1:
            ADDON.openSettings()
 def type_filtering(self, query, separator='%20'):
     from xbmcgui import Dialog
     from urllib import quote
     if '#MOVIE&FILTER' in query:
         self.use_movie()
         query = query.replace('#MOVIE&FILTER', '')
     elif '#TV&FILTER' in query:
         self.use_TV()
         query = query.replace('#TV&FILTER', '')
         query = exception(query)  # CSI series problem
     self.title = query  # to do filtering by name
     if self.time_noti > 0:
         dialog = Dialog()
         dialog.notification(self.name_provider, query.title(), self.icon, self.time_noti)
         del Dialog
     query = quote(query.rstrip()).replace('%20', separator)
     return query
    def type_filtering(self, info, separator='%20'):
        from xbmcgui import Dialog
        from urllib import quote

        if 'movie' == info["type"]:
            self.use_movie()
        elif 'show' == info["type"]:
            self.use_TV()
            info["query"] = exception(info["query"])  # CSI series problem
        elif 'anime' == info["type"]:
            self.use_TV()
        self.title = info["query"] + ' ' + info["extra"]  # to do filtering by name
        self.info = info
        if self.time_noti > 0:
            dialog = Dialog()
            dialog.notification(self.name_provider, info["query"].title(), self.icon, self.time_noti)
            del Dialog
        return quote(info["query"].rstrip()).replace('%20', separator)
Exemplo n.º 7
0
def add_menu_portal():
    url = plugin.args['url'][0]
    name = unquote_plus(plugin.args['name'][0])
    if 'icon' not in plugin.args:
        icon = ""
    else:
        icon = plugin.args['icon'][0]
    menu_slots = []
    for slot in range(1, 8):
        current_slot = Addon().getSettingString('menu'+str(slot))
        if len(current_slot) > 0:
            current_slot = json.loads(current_slot)
            menu_slots.append(current_slot['name'])
        else:
            menu_slots.append(f"Menu slot {str(slot)}")
    order = str(Dialog().select("Select menu slot", menu_slots) + 1)
    if Dialog().yesno(Addon().getLocalizedString(32064), f"{Addon().getLocalizedString(32065)} {order}") == False:
        return False
    Addon().setSetting(id=str('menu'+order), value=json.dumps({"url" : url, "name" : name, "icon" : icon}))
    Dialog().notification(Addon().getLocalizedString(32066), "\""+name + f"\" {Addon().getLocalizedString(32067)} " + order, NOTIFICATION_INFO)
Exemplo n.º 8
0
def yesno_dialog(heading='',
                 message='',
                 nolabel=None,
                 yeslabel=None,
                 autoclose=0):
    """Show Kodi's Yes/No dialog"""
    from xbmcgui import Dialog
    if not heading:
        heading = addon_name()
    if kodi_version_major() < 19:
        return Dialog().yesno(heading=heading,
                              line1=message,
                              nolabel=nolabel,
                              yeslabel=yeslabel,
                              autoclose=autoclose)
    return Dialog().yesno(heading=heading,
                          message=message,
                          nolabel=nolabel,
                          yeslabel=yeslabel,
                          autoclose=autoclose)
Exemplo n.º 9
0
def notification(heading='', message='', icon='info', time=4000):
    """Show a Kodi notification"""
    from xbmcgui import Dialog
    if not heading:
        heading = addon_name()
    if not icon:
        icon = addon_icon()
    Dialog().notification(heading=heading,
                          message=message,
                          icon=icon,
                          time=time)
def reset_exclusions():
    """
    Reset all user-set exclusion paths to blanks.
    :return:
    """
    if Dialog().yesno(translate(32604), translate(32610), translate(32607)):
        ADDON.setSetting(id="exclusion1", value="")
        ADDON.setSetting(id="exclusion2", value="")
        ADDON.setSetting(id="exclusion3", value="")
        ADDON.setSetting(id="exclusion4", value="")
        ADDON.setSetting(id="exclusion5", value="")
Exemplo n.º 11
0
    def type_filtering(self, info, separator='%20'):
        from xbmcgui import Dialog
        from urllib import quote

        if 'movie' == info["type"]:
            self.use_movie()
        elif 'show' == info["type"]:
            self.use_TV()
            info["query"] = exception(info["query"])  # CSI series problem
        elif 'anime' == info["type"]:
            self.use_TV()
        self.title = info["query"] + ' ' + info[
            "extra"]  # to do filtering by name
        self.info = info
        if self.time_noti > 0:
            dialog = Dialog()
            dialog.notification(self.name_provider, info["query"].title(),
                                self.icon, self.time_noti)
            del Dialog
        return quote(info["query"].rstrip()).replace('%20', separator)
Exemplo n.º 12
0
def run():
    first_run()
    setup_root_logger()
    on_clear_cache_redirect()
    set_settings(SETTINGS.VERSION, get_info('version'))
    logger.debug('Entry point ------- ' + str(sys.argv))
    try:
        stream_cinema.vip_remains()
        # settings.load_to_cache(SETTINGS.PROVIDER_USERNAME, SETTINGS.PROVIDER_PASSWORD, SETTINGS.PROVIDER_TOKEN)
        check_version()
        plugin_url_history.add(get_plugin_url())
        return router.run()
    except requests.exceptions.ConnectionError as e:
        logger.error(e)
        if _can_connect_google():
            Dialog().ok(get_string(LANG.CONNECTION_ERROR),
                        get_string(LANG.SERVER_ERROR_HELP))
        else:
            Dialog().ok(get_string(LANG.CONNECTION_ERROR),
                        get_string(LANG.NO_CONNECTION_HELP))
Exemplo n.º 13
0
def get_dlive_userid():
    global query, menu
    # What is the Display Name set as in the add-on settings
    display_name = xbmcaddon.Addon().getSetting("user")

    # set the query object if it has a valid blockchain user-id
    if not query.set_user(display_name):

        # Warn the user that it's not a valid user and resort to DLive so the add-on at least runs
        dialog = Dialog()
        dialog.ok(
            "Unable to find your DLIVE user",
            "The DLIVE add-on cannot find the Display Name specified in settings. Using the default: DLive"
        )

        query.set_user("DLive")  # set it as winsomehax
        xbmcaddon.Addon().setSetting(
            id="user", value="DLive")  # Write that to the settings

    return display_name
Exemplo n.º 14
0
def series_route():
    search_query = Dialog().input('Search for Animation by Name')
    response = requests.get(
        'https://kisscartoonapi.herokuapp.com/api/search?s={}'.format(
            search_query),
        timeout=15)
    series = json.loads(response.text)
    for siri in series:
        addDirectoryItem(plugin.handle,
                         plugin.url_for(episodes_route, quote(siri['url'])),
                         ListItem(siri['title']), True)
    endOfDirectory(plugin.handle)
Exemplo n.º 15
0
def season_select():
    logger.debug("Season select")
    plugin = get_router_instance()
    args = _get_current_params(plugin)

    res = Dialog().select("Choose a season", seasons)

    if res >= 0:
        args[SEASON_ARG_KEY] = seasons[res]

    _display_filter_menu_items(plugin, args)
    endOfDirectory(plugin.handle)
Exemplo n.º 16
0
def year_select():
    logger.debug("Year select")
    plugin = get_router_instance()
    args = _get_current_params(plugin)

    res = Dialog().select("Choose a year", years)

    if res >= 0:
        args[YEAR_ARG_KEY] = years[res]

    _display_filter_menu_items(plugin, args)
    endOfDirectory(plugin.handle)
Exemplo n.º 17
0
 def show_yesno_dialog(self,
                       heading='',
                       message='',
                       nolabel=None,
                       yeslabel=None,
                       autoclose=0):
     """Show Kodi's Yes/No dialog"""
     from xbmcgui import Dialog
     if not heading:
         heading = ADDON.getAddonInfo('name')
     if self.kodi_version_major() < 19:
         return Dialog().yesno(heading=heading,
                               line1=message,
                               nolabel=nolabel,
                               yeslabel=yeslabel,
                               autoclose=autoclose)
     return Dialog().yesno(heading=heading,
                           message=message,
                           nolabel=nolabel,
                           yeslabel=yeslabel,
                           autoclose=autoclose)
Exemplo n.º 18
0
 def show_yesno_dialog(self,
                       heading='',
                       message='',
                       nolabel=None,
                       yeslabel=None,
                       autoclose=0):
     """Show Kodi's Yes/No dialog"""
     from xbmcgui import Dialog
     if not heading:
         heading = ADDON.getAddonInfo('name')
     if self.kodi_version_major() < 19:
         return Dialog().yesno(heading=heading,
                               line1=message,
                               nolabel=nolabel,
                               yeslabel=yeslabel,
                               autoclose=autoclose)  # pylint: disable=unexpected-keyword-arg,no-value-for-parameter
     return Dialog().yesno(heading=heading,
                           message=message,
                           nolabel=nolabel,
                           yeslabel=yeslabel,
                           autoclose=autoclose)
Exemplo n.º 19
0
def yesno_dialog(heading='',
                 message='',
                 nolabel=None,
                 yeslabel=None,
                 autoclose=0):
    """Show Kodi's Yes/No dialog"""
    from xbmcgui import Dialog
    if not heading:
        heading = addon_name()
    if kodi_version_major() < 19:
        # pylint: disable=unexpected-keyword-arg,no-value-for-parameter
        return Dialog().yesno(heading=heading,
                              line1=message,
                              nolabel=nolabel,
                              yeslabel=yeslabel,
                              autoclose=autoclose)
    return Dialog().yesno(heading=heading,
                          message=message,
                          nolabel=nolabel,
                          yeslabel=yeslabel,
                          autoclose=autoclose)
Exemplo n.º 20
0
	def dialog(self, msg, msg_line2=None, msg_line3=None, header_appendix=None, open_settings_on_ok=False):
		if header_appendix is not None:
			header = compat._format('{} - {}', str(header_appendix), self.get_addon().getAddonInfo('name'))
		else:
			header = self.get_addon().getAddonInfo('name')

		ret = Dialog().ok(header, xbmc_helper.dialog_msg(msg, msg_line2, msg_line3))

		if open_settings_on_ok is True and ret == 1:
			self.get_addon().openSettings()

		return ret
Exemplo n.º 21
0
    def onclick(self, controlid):
        if self.label.getId() == controlid:
            selected = Dialog().multiselect(self.heading,
                                            self.options,
                                            preselect=self.selected)

            if selected is not None:
                self.items = [self.options[i] for i in selected]
                self.selected = selected
                self.label.setLabel(
                    f'{self.heading} [{len(self.selected)}/{len(self.options)}]'
                )
Exemplo n.º 22
0
def play_episode():
    response = request(plugin.path)
    document = BeautifulSoup(response.text, 'html.parser')
    title = document.find('h1').text.strip()
    all_server = document.find_all('li', {'data-video': True})
    position = Dialog().select('Choose Server',
                               [server.contents[0] for server in all_server])

    if position != -1:
        xbmc.executebuiltin('ActivateWindow(busydialognocancel)')
        resolveurl.add_plugin_dirs(__plugins__)

        try:
            url = resolveurl.resolve(all_server[position].attrs['data-video'])

            if url:
                item = ListItem(title, path=url)
                sub = re.search('&sub=([^&]+)',
                                all_server[position].attrs['data-video'])

                if sub:
                    response = session.get(
                        'https://embed.watchasian.to/player/sub/index.php?id='
                        + sub.group(1))
                    item.setSubtitles([__temp__])

                    with open(__temp__, 'w') as o:
                        for i, text in enumerate(re.split(
                                'WEBVTT\r\n\r\n|\r\n\r\n', response.text)[1:],
                                                 start=1):
                            o.write('{}\r\n{}\r\n\r\n'.format(
                                i, text.encode('utf-8')))

                xbmcplugin.setResolvedUrl(plugin.handle, True, item)
            else:
                raise
        except:
            Dialog().notification('Couldn\'t Resolve Server', '')

        xbmc.executebuiltin('Dialog.Close(busydialognocancel)')
Exemplo n.º 23
0
def changeList(params):

    typelist = [
        '全部', '爱情', '传记', '动画', '动作', '儿童', '犯罪', '风情', '歌舞', '古装', '纪录', '惊悚',
        '警匪', '剧情', '科幻', '励志', '历史', '伦理', '冒险', '魔幻', '其他', '微电影', '文艺',
        '武侠', '喜剧', '戏曲', '悬疑', '音乐', '灾难', '战争', '老电影'
    ]
    arealist = [
        '全部', '内地', '台湾', '香港', '澳大利亚', '德国', '俄罗斯', '法国', '韩国', '加拿大', '马来西亚',
        '美国', '日本', '泰国', '西班牙', '新加坡', '意大利', '印度', '英国', '其他', '欧美'
    ]
    yearlist = [
        '全部', '2015', '2014', '2013', '2012', '2011', '2010', '00年代', '更早'
    ]
    yeartype = [
        '0', '2015', '2014', '2013', '2012', '2011', '2010', '00s', 'gz'
    ]

    url = params['url']
    name = params['name']

    dialog = Dialog()
    filter = ''
    sel = dialog.select('类型', typelist)
    if sel >= 0:
        params['type'] = str(sel)
        filter += '类型' + typelist[sel]

    sel = dialog.select('地区', arealist)
    if sel >= 0:
        params['area'] = str(sel)
        filter += '地区' + arealist[sel]

    sel = dialog.select('年份', yearlist)
    if sel >= 0:
        params['year'] = yeartype[sel]
        filter += '年份' + yearlist[sel]

    params['filter'] = filter
    movieList(params)
Exemplo n.º 24
0
def episode(eid):

    episode = session.get_cms(cms_url + 'episodes/' + eid)
    if episode.available_date:
        try:
            #title = "{} [TBA on {}]".format(title, time.strftime("%m/%d/%y %I:%M:%S %P", a_date))
            a_date = time.strptime(episode.available_date,
                                   '%Y-%m-%dT%H:%M:%SZ')
            #for some odd reason, the statement comes back with 'NoneType' callable
            #exception on datetime, I believe. handling this so it doesn't throw
            #'spurious' exceptions
        except:
            a_date = ""
    else:
        a_date = ""
    if episode.streams:
        setup_player(episode)
    else:
        dialog = Dialog()
        dialog.notification("VRV",
                            "No streams available.",
                            time=1000,
                            sound=False)
        if a_date:
            dialog.notification("VRV",
                                "TBA on {}".format(
                                    time.strftime("%m/%d/%y %I:%M:%S %P",
                                                  a_date)),
                                time=1000,
                                sound=False)
Exemplo n.º 25
0
def pluginVideoInfinity(silent=False):
    username = '******'
    plugin_id = 'plugin.video.infinity'
    branch = 'nightly'
    token = ''

    try:
        return Update(username, plugin_id, branch, token, silent)

    except Exception as e:
        xbmc.log('Exception Raised: %s' % str(e), LOGERROR)
        Dialog().ok(PLUGIN_NAME, 'Fehler beim Update vom ' + plugin_id)
        return False
Exemplo n.º 26
0
def urlResolverUpdate(silent=False):
    username = '******'            ### Repo
    plugin_id = 'script.module.urlresolver'
    branch = 'master'
    token = 'ZmY3OGNmMGU0NjgzOWQ2ODA0ZTgwNTZkZDM3MTllNWEzMTQ1OTM2Yw=='

    try:
        return Update(username, plugin_id, branch, token, silent)

    except Exception as e:
        xbmc.log('Exception Raised: %s' % str(e), xbmc.LOGERROR)
        Dialog().ok(PLUGIN_NAME, 'Fehler beim Update vom ' + plugin_id)
        return
Exemplo n.º 27
0
 def show_notification(self,
                       heading='',
                       message='',
                       icon='info',
                       time=4000):
     """ Show a Kodi notification """
     from xbmcgui import Dialog
     if not heading:
         heading = self._addon.getAddonInfo('name')
     Dialog().notification(heading=heading,
                           message=message,
                           icon=icon,
                           time=time)
Exemplo n.º 28
0
def series(nid):
    my_log('got to series ' + str(nid), xbmc.LOGDEBUG)
    seasons = session.get_cms(cms_url + 'seasons?series_id=' + nid)
    series = session.get_cms(cms_url + 'series/' + nid)
    if series:
        series_info = series.kodi_info()
    else:
        series_info = dict()

    if len(seasons.items) == 1:
        my_log('series only has one season, skipping to episodes section',
               xbmc.LOGDEBUG)
        season(seasons.items[0].id)
    else:
        my_log('series has more than one, displaying context menu',
               xbmc.LOGDEBUG)
        dummy_dialog = Dialog()
        season_names = []
        for item in seasons.items:
            season_names.append(item.title)
        choice = dummy_dialog.contextmenu(season_names)
        if choice > -1:
            season(seasons.items[choice].id)
Exemplo n.º 29
0
def play():
    if 'url_type' in plugin.args and int(plugin.args['url_type'][0]) == 2:
        files = json.loads(get_page(plugin.args['url'][0]))
        files_list = []
        for i in files['FileStats']:
            files_list.append(i['Path'])
        file_id = Dialog().select(Addon().getLocalizedString(32063), files_list)
        listitem = ListItem()
        listitem.setPath(plugin.args['url'][0]+"&file="+str(file_id))
        setResolvedUrl(plugin.handle, True, listitem)
    else:
        listitem = ListItem()
        listitem.setPath(plugin.args['url'][0])
        setResolvedUrl(plugin.handle, True, listitem)
Exemplo n.º 30
0
def handle_player_stop(info_hash, name, initial_delay=0.5, listing_timeout=10):
    sleep(int(initial_delay * 1000))
    start_time = time.time()
    while getCondVisibility("Window.IsActive(busydialog)") and not 0 < listing_timeout < time.time() - start_time:
        sleep(100)

    remove_torrent = Dialog().yesno(ADDON_NAME, name + "\n" + translate(30241))
    if remove_torrent:
        api.remove_torrent(info_hash, delete=True)
        current_folder = getInfoLabel("Container.FolderPath")
        if current_folder == plugin.url_for(torrent_files, info_hash):
            executebuiltin("Action(Back)")
        elif current_folder == plugin.url_for(torrents):
            refresh()
Exemplo n.º 31
0
def multiselect(heading='',
                options=None,
                autoclose=0,
                preselect=None,
                use_details=False):
    """Show a Kodi multi-select dialog"""
    from xbmcgui import Dialog
    if not heading:
        heading = addon_name()
    return Dialog().multiselect(heading=heading,
                                options=options,
                                autoclose=autoclose,
                                preselect=preselect,
                                useDetails=use_details)
def select_dialog(heading='',
                  opt_list=None,
                  autoclose=False,
                  preselect=None,
                  useDetails=False):  # pylint: disable=invalid-name
    """Show Kodi's Select dialog"""
    from xbmcgui import Dialog
    if not heading:
        heading = ADDON.getAddonInfo('name')
    return Dialog().select(heading=heading,
                           opt_list=opt_list,
                           autoclose=autoclose,
                           preselect=preselect,
                           useDetails=useDetails)
def yesno_dialog(heading='',
                 message='',
                 nolabel=None,
                 yeslabel=None,
                 autoclose=0):
    """Show Kodi's Yes/No dialog"""
    from xbmcgui import Dialog
    if not heading:
        heading = ADDON.getAddonInfo('name')
    return Dialog().yesno(heading=heading,
                          line1=message,
                          nolabel=nolabel,
                          yeslabel=yeslabel,
                          autoclose=autoclose)
Exemplo n.º 34
0
def search():

    input_text = Dialog().input(kodiutils.get_string(32007), "",
                                INPUT_ALPHANUM)

    try:
        req = requests.get(
            "https://www.rtp.pt/play/pesquisa?q={}".format(input_text),
            headers=HEADERS_VOD).text
    except:
        raise_notification()

    pagei = ListItem("{} [B]{}[/B]".format(kodiutils.get_string(32008),
                                           input_text))
    addDirectoryItem(handle=plugin.handle,
                     listitem=pagei,
                     isFolder=False,
                     url="")

    soup = BeautifulSoup(req, 'html.parser')

    for a in soup.find('section').find_all('a'):
        url = a.get('href')
        title = a.get('title')
        img = a.find('img').get('src')
        metas = a.find_next_sibling('i').find_all('meta')
        description = metas[1].get('content')

        liz = ListItem("{}".format(kodiutils.compat_py23str(title)))
        liz.setArt({"thumb": img, "icon": img, "fanart": kodiutils.FANART})
        liz.setInfo("Video",
                    infoLabels={
                        "plot":
                        kodiutils.strip_html_tags(
                            kodiutils.compat_py23str(description)),
                        "title":
                        kodiutils.compat_py23str(title)
                    })

        addDirectoryItem(
            plugin.handle,
            plugin.url_for(programs_episodes,
                           title=kodiutils.compat_py23str(title),
                           ep=kodiutils.compat_py23str(title),
                           img=kodiutils.compat_py23str(img),
                           description=kodiutils.compat_py23str(description),
                           url=kodiutils.compat_py23str(url),
                           page=1), liz, True)
    endOfDirectory(plugin.handle)
Exemplo n.º 35
0
def categories():
    try:
        req = requests.get(BANCA_SAPO_URL).text
    except:
        Dialog().ok(translate(32000), translate(32001))
        sys.exit(0)

    categories_regex = re.findall(
        '<a href="/jornais/(.+?)" class="\[  \]">(.+?)</a>', req)
    for uri, category in categories_regex:
        liz = ListItem(category)
        liz.setArt({"thumb": GLOBAL_NEWSPAPPER_ICON, "fanart": GLOBAL_FANART})
        addDirectoryItem(plugin.handle, plugin.url_for(show_category, uri),
                         liz, True)
    endOfDirectory(plugin.handle)
Exemplo n.º 36
0
def show_category(category_id):
    try:
        req = requests.get('{}/{}'.format(BANCA_SAPO_URL, category_id)).text
    except:
        Dialog().ok(translate(32000), translate(32001))
        sys.exit(0)
    match = re.findall(
        'data-original-src="(.+?)".+?data-share-url=.+?title="(.+?)".+?source data-srcset="(.+?)" srcset',
        req, re.DOTALL)
    for cover, newspapper, thumb in match:
        if thumb.startswith('//'): thumb = '{}{}'.format('http:', thumb)
        liz = ListItem(newspapper)
        liz.setArt({"thumb": thumb, "fanart": GLOBAL_FANART})
        addDirectoryItem(plugin.handle, cover, liz)
    endOfDirectory(plugin.handle)
Exemplo n.º 37
0
                else:
                    print(filters.reason)
                if cont == settings.max_magnets:  # limit magnets
                    break
            print('>>>>>>' + str(cont) + ' torrents sent to Pulsar<<<<<<<')
            return results
        except:
            print('>>>>>>>ERROR parsing data<<<<<<<')
            settings.dialog.notification(settings.name_provider, '>>>>>>>>ERROR parsing data<<<<<<<<', settings.icon,
                                         1000)
        else:
            print('>>>>>>>%s<<<<<<<' % browser.status)
            settings.dialog.notification(settings.name_provider, browser.status, settings.icon, 1000)


dialog = Dialog()
loop = True
query = dialog.input('Query:')
type = dialog.select('Type:', ['All', 'Movies', 'TV Shows'])
if type == 1:
    filters.use_movie()
if type == 2:
    filters.use_TV()
#search result in all sites
settings.dialog.notification(settings.name_provider, 'Searching in TorrentZ', settings.icon,
                             1000)
results = torrentz(query)
settings.dialog.notification(settings.name_provider, 'Searching in ThePirateBay', settings.icon,
                             1000)
results += thepiratebay(query)
settings.dialog.notification(settings.name_provider, 'Searching in BTjunkie', settings.icon,
Exemplo n.º 38
0
    steamExe = getSteamExe(addon)
    cmd = [ahkExe, "%s" % steamExe, addon.getSetting('username'), addon.getSetting('password')]
    subprocess.check_call(cmd)

def getSteamExe(addon):
    steamFolder = addon.getSetting('steam_install_folder')
    steamBinPath = os.path.join(steamFolder, STEAM_BINARY_NAME)
    if not os.path.isfile(steamBinPath):
        raise NotFoundError(addon.getLocalizedString(71004))
    return steamBinPath

    
class NotFoundError(BaseException):
    
    def __init__(self, msg):
        self.msg = msg

if __name__ == "__main__":
    addon = Addon(__scriptID__)
    try:
        launchSteamBpm(addon)
    except CalledProcessError as e:
        log('AHK return code: %d' % e.returncode)
        msg = addon.getLocalizedString(72000 + e.returncode)
        log(msg, LOGERROR)
        dialog = Dialog() 
        dialog.ok(addon.getLocalizedString(71005), msg)
    except BaseException as e:
        log(str(e), LOGERROR)
        dialog = Dialog() 
        dialog.ok(addon.getLocalizedString(71005), str(e))