예제 #1
0
def search():
    kb = xbmc.Keyboard('', 'Search', False)
    kb.doModal()
    if kb.isConfirmed():
        text = kb.getText()
    else:
        return
    items = swefilm.search(text)
    return map(to_kodi_item, items)
예제 #2
0
def search():
    return []
    keyboard = xbmc.Keyboard('', '请输入搜索内容')

    keyboard.doModal()
    if (keyboard.isConfirmed()):
        key = keyboard.getText()
        if len(key) > 0:
            u = sys.argv[0] + '?mode=searchlist&key=' + key
            xbmc.executebuiltin('Container.Update(%s)' % u)
예제 #3
0
def search():
    keyboard = xbmc.Keyboard('', '请输入搜索内容')
    xbmc.sleep(1500)
    keyboard.doModal()
    if not keyboard.isConfirmed():
        return

    keyword = keyboard.getText()
    url = HOST_URL + '/x/search/?q=' + quote_plus(keyword)
    url += '&stag=0'

    link = get_html(url)
    items = []
    if link is None:
        xbmcgui.Dialog().ok(plugin.addon.getAddonInfo('name'),
                            ' 抱歉,没有找到[COLOR FFFF0000] ' + keyword
                            + ' [/COLOR]的相关视频')
        return items

    items.append({
        'label': '[COLOR FFFF0000]当前搜索:(' + keyword + ')[/COLOR]',
    })

    # fetch and build the video series episode list
    content = BeautifulSoup(link, 'html.parser')
    soup = content.find_all('div', {'class': 'result_item'})

    for item in soup:
        href = httphead(item.a['href'])
        img = httphead(item.img['src'])
        title = item.img['alt']

        info = item.find('span', {'class': 'desc_text'})
        try:
            info = info.text
        except:
            info = ''
        items.append({
            'label': title,
            'path': url_for('episodelist', url=href),
            'thumbnail': img,
            'info': {'title': title, 'plot': info}
        })

        list = item.find_all('div', {'class': 'item'})
        for series in list:
            subtitle = series.a.text
            href = httphead(series.a['href'])
            items.append({
                'label': subtitle,
                'path': url_for('playvideo', vid=href),
                'is_playable': True,
                'info': {'title': subtitle}
            })
    return items
예제 #4
0
def search():
    plugin.set_content('TVShows')
    keyboard = xbmc.Keyboard('', '请输入搜索内容')
    xbmc.sleep(1500)
    keyboard.doModal()
    if not keyboard.isConfirmed():
        return

    keyword = keyboard.getText()
    p_url = 'http://so.tv.sohu.com/mts?chl=&tvType=-2&wd='
    url = p_url + quote_plus(keyword)

    # construct url based on user selected item
    page = 1
    p_url = url + '&fee=0&whole=1&m=1&box=1&p=%d' % page
    link = get_html(p_url)

    #########################################################################
    # Video listing for all found related episode title
    tree = BeautifulSoup(link, 'html.parser')
    soup = tree.find_all('div', {'class': 'ssItem cfix'})

    #########################################################################
    items = []
    for page in soup[0]:
        try:
            p_url = httphead(page.a['href'])
        except:
            continue
        p_name = page.a['title'].encode('utf-8')
        img = httphead(page.img['src'])
        infop = page.find('p', {'class': 'des'})
        try:
            info = infop.text
        except:
            info = ''
        items.append({
            'label': p_name,
            'path': url_for('episodelist1', url=p_url),
            'thumbnail': httphead(page.img['src']),
            'info': {'title': p_name, 'plot': info}
        })

        album = page.find_all('a', {'class': 'ts'})
        for series in album:
            items.append({
                'label': series['title'],
                'path': url_for('playvideo', name=series['title'],
                                url=httphead(series['href']),
                                image=httphead(page.img['src'])),
                'is_playable': True,
                'info': {'title': series['title']},
            })

    return items
예제 #5
0
def keyboard(default='', heading='', hidden=False):

    if hidden:
        kb = _xbmc.Keyboard(default, heading, hidden)
    else:
        kb = xbmc.Keyboard(default, heading)

    xbmc.sleep(1000)
    kb.doModal()
    if (kb.isConfirmed()):
        return kb.getText()
예제 #6
0
def search():
    plugin.set_content('TVShows')
    keyboard = xbmc.Keyboard('', '请输入搜索内容')
    # keyboard.setHiddenInput(hidden)
    xbmc.sleep(1000)
    keyboard.doModal()
    if not keyboard.isConfirmed():
        return

    keyword = keyboard.getText()

    page = 1
    #p_url = 'http://so.le.com/s?hl=1&dt=2&ph=420001&from=pcjs&ps=30&wd='
    p_url = 'http://suggest.letv.cn/suggestion?jf=3&q='
    link = get_html(p_url + quote_plus(keyword))
    items = []

    lists = loads(link)
    # fetch and build the video series episode list
    content = BeautifulSoup(link, 'html.parser')

    for item in lists['data_list']:
        try:
            aid = item['aid']
        except:
            continue

        title = item['name'].encode('utf-8')
        cate = item.get('sub_category_name', '')
        if cate:
            cate = '({})'.format(cate.encode('utf-8'))
        eps = item.get('episodes', 0)
        img = item.get('post_st', '')
        #if eps == '' or int(eps) < 2:
        #    items.append({
        #        'label': title + cate,
        #        'path': url_for('playvideo', vid=aid),
        #        'thumbnail': img,
        #        'is_playable': True,
        #        'info': {'title': title}
        #    })
        #else:
        items.append({
            'label': title + cate,
            'path': url_for('episodelist', aid=aid),
            'thumbnail': img,
            'info': {
                'title': title
            }
        })

    return items
예제 #7
0
def search(page):
    page = int(page)

    search_input = ''
    try:
        search_input = plugin.keyboard('', u'חפש כאן')
    except:
        kb = xbmc.Keyboard('', 'חפש כאן')
        kb.doModal()
        if kb.isConfirmed():
            search_input = kb.getText()

    try:
        if len(search_input) < 2:
            plugin.notify('מילת החיפוש חייבת להכיל לפחות שני תווים',
                          image=ICON)
        else:
            s = requests.Session()
            req = requests.Request(method='GET', url=API, headers=HEADERS)
            prep = req.prepare()
            prep.url = API + '/series/search/{0}/page/{1}/perPage/100'.format(
                search_input, page)
            req = s.send(prep)

            results = req.json()['series']
            if results:
                items = []
                for s in results:
                    label = u'{0}-{1}'.format(s['heb'], s['eng'])
                    path = plugin.url_for('open_series',
                                          sid=s['id'],
                                          title=s['heb'].encode('utf8'))
                    desc = s['description'].replace('<br />', '\n')
                    items.append(
                        sdarot.make_item(label,
                                         path,
                                         desc,
                                         POSTER_PREFIX + s['poster'],
                                         False,
                                         fav=build_fav(label, path, s['id'],
                                                       '0'),
                                         year=s['year']))

                sdarot.set_dir(items, 504, 'files', plugin)
                return []
            else:
                plugin.notify('לא נמצאו תוצאות לחיפוש', image=ICON)
    except:
        pass
예제 #8
0
def search():
    keyboard = xbmc.Keyboard('', '请输入搜索内容')
    xbmc.sleep(1500)
    keyboard.doModal()
    if not keyboard.isConfirmed():
        return
    keyword = keyboard.getText()
    key = quote_plus(keyword)

    searchapi = HOST + '/layout/smarttv/showsearch?'
    req = {'video_type': 1, 'keyword': keyword}
    req.update(BASEIDS)
    link = get_html(searchapi + urlencode(req))
    results = loads(link)['results']
    items = []
    for item in results:
        items.append({
            'label': item['showname'],
            'path': url_for('episodelist', tid=item['showid']),
            'thumbnail': item['show_vthumburl_hd']
        })

    searchapi = HOST + '/openapi-wireless/videos/search/{}?'
    req = {'pz': 500}
    req.update(BASEIDS)

    link = get_html(searchapi.format(key) + urlencode(req))

    # fetch and build the video series episode list
    finds = loads(link)
    for item in finds['results']:
        duration = 0
        for t in item['duration'].split(':'):
            duration = duration * 60 + int(t)

        items.append({
            'label': item['title'],
            'path': url_for('playvideo', videoid=item['videoid']),
            'thumbnail': item['img'],
            'is_playable': True,
            'info': {
                'title': item['title'],
                'plot': item['desc'],
                'duration': duration
            }
        })
    return items
예제 #9
0
    def keyboard(self, default=None, heading=None, hidden=False):
        '''Displays the keyboard input window to the user. If the user does not
        cancel the modal, the value entered by the user will be returned.

        :param default: The placeholder text used to prepopulate the input field.
        :param heading: The heading for the window. Defaults to the current
                        addon's name. If you require a blank heading, pass an
                        empty string.
        :param hidden: Whether or not the input field should be masked with
                       stars, e.g. a password field.
        '''
        if heading is None:
            heading = self.addon.getAddonInfo('name')
        if default is None:
            default = ''
        keyboard = xbmc.Keyboard(default, heading, hidden)
        keyboard.doModal()
        if keyboard.isConfirmed():
            return keyboard.getText()
예제 #10
0
def search():
    plugin.set_content('video')
    keyboard = xbmc.Keyboard('', '请输入搜索内容')

    xbmc.sleep(1500)
    keyboard.doModal()
    if not keyboard.isConfirmed():
        return []

    keyword = keyboard.getText()
    p_url = 'http://www.soku.com/nt/search/q_'
    url = p_url + quote_plus(keyword)
    page = get_html(url)
    tree = BeautifulSoup(page, 'html.parser')
    soup = tree.find_all('div', {'class': 's_base'})
    items = []
    for item in soup:
        title = item.a['_log_title']
        href = item.a['href']
        info = item.find('div', {'class': 'info-cont'})
        info = info.span['data-text'] if info else ''

        items.append({
            'label': title,
            'path': url_for('playvideo', url=href),
            'is_playable': True,
            'info': {
                'title': title,
                'plot': info
            },
        })
    soup = tree.find_all('ul', {'class': 'clearfix'})
    soups = soup[0].find_all('li')
    for item in soups:
        try:
            items.append({
                'label': item.a['_log_title'] + item.span.text,
                'path': url_for('playvideo', url=item.a['href']),
                'is_playable': True,
            })
        except:
            continue
    return items
예제 #11
0
def search():
    keyboard = xbmc.Keyboard('', '请输入搜索内容')
    xbmc.sleep(1500)
    keyboard.doModal()
    if not keyboard.isConfirmed():
        return
    keyword = keyboard.getText()
    key = quote_plus(keyword)
    searchapi = 'http://tv.api.3g.youku.com/openapi-wireless/videos/search/{}?pid=0ce22bfd5ef5d2c5&pz=500'

    link = get_html(searchapi.format(key))

    if link is None:
        xbmcgui.Dialog().ok(__addonname__,
                            ' 抱歉,没有找到[COLOR FFFF0000] ' + keyword +
                      ' [/COLOR]的相关视频')
        return []

    # fetch and build the video series episode list
    finds = loads(link)
    items = []
    for item in finds['results']:
        img = item['img']
        videoid = item['videoid']
        title = item['title']
        info = item['desc']
        duration = 0
        for t in item['duration'].split(':'):
            duration = duration*60 + int(t)

        items.append({
            'label': item['title'],
            'path': url_for('playvid', vid=videoid),
            'thumbnail': item['img'],
            'is_playable': True,
            'info': {'title': item['title'], 'plot': item['desc'],
                     'duration': duration}
        })
    return items
예제 #12
0
def search():
	kb = xbmc.Keyboard('', 'Search Camlistore ' , False)
	kb.doModal()
	if (kb.isConfirmed()):                   
		search_text = kb.getText()
	return plugin.finish(camli.query(search_text))
예제 #13
0
 def __init__(self, *args, **kwargs):
     self.cptloc = kwargs.get('captcha')
     self.img = xbmcgui.ControlImage(400, 10, 400, 100,self.cptloc)
     self.addControl(self.img)
     self.kbd = xbmc.Keyboard()
예제 #14
0
def __keyboard(title, text=''):
    keyboard = xbmc.Keyboard(text, title)
    keyboard.doModal()
    if keyboard.isConfirmed() and keyboard.getText():
        return keyboard.getText()
예제 #15
0
def search():
    items = []
    keyboard = xbmc.Keyboard('', '请输入搜索内容')
    xbmc.sleep(1000)
    keyboard.doModal()
    if not keyboard.isConfirmed():
        return []

    keyword = keyboard.getText()
    key = quote_plus(keyword)
    url = 'http://so.iqiyi.com/so/q_' + key + '?source=hot'
    link = get_html(url)

    if link is None:
        items.append({
            'label': ' 抱歉,没有找到[COLOR yellow] ' + keyword + ' [/COLOR]的相关视频',
            'path': url_for('stay')
        })
        return items

    plugin.set_content('TVShows')
    items.append({
        'label': '[COLOR yellow]当前搜索:(' + keyword + ')[/COLOR]',
        'path': url_for('stay')
    })

    # fetch and build the video series episode list
    content = BeautifulSoup(link, 'html.parser')
    soup = content.find_all('ul', {'class': 'mod_result_list'})
    for item in soup:
        lists = item.find_all('li', {'class': 'list_item'})
        for series in lists:
            img = series.img.get('src', '')
            title = series.img.get('title') or series.a.get('title')
            if title is None:
                continue
            text = series.find('span', {'class': 'result_info_txt'})
            try:
                info = text.text
            except:
                info = ''
            site = series.find_all('em', {'class': 'vm-inline'})
            for t in site:
                title += ' |' + t.text
            items.append({
                'label':
                title,
                'path':
                url_for('playfound',
                        url=httphead(series.a['href']),
                        title=title.encode('utf-8'),
                        pic=httphead(img)),
                'thumbnail':
                httphead(img),
                'info': {
                    'title': title,
                    'plot': info
                }
            })

            album = series.find_all('li', {'class': 'album_item'})
            for page in album:
                title = page.a.get('title', '')
                items.append({
                    'label':
                    '--' + title,
                    'path':
                    url_for('playfound',
                            url=page.a.get('href'),
                            title=title.encode('utf-8'),
                            pic=img),
                    'thumbnail':
                    img,
                    'info': {
                        'title': title
                    }
                })
    return items
예제 #16
0
 def updateLabel(self):
     label = self.getLabel()
     keyboard = xbmc.Keyboard(label)
     keyboard.doModal()
     self.setLabel(
         keyboard.getText())