예제 #1
0
def dbgettag():
    filters['类型标签']=['剧情' , '喜剧' , '动作' , '爱情' , '科幻' , '动画' , '悬疑' , '惊悚' , '恐怖' ,
        '纪录片' , '短片' , '情色' , '同性' , '音乐' , '歌舞' , '家庭' , '儿童' , '传记' , '历史' , '战争' ,
        '犯罪' , '西部' , '奇幻' , '冒险' , '灾难' , '武侠' , '古装' , '运动' , '戏曲' , '黑色电影' ,'女性' , '史诗' , 'cult']
        
    filters['地区标签']=['美国' , '中国大陆' , '香港' , '台湾' , '日本' , '韩国' , '英国' , '法国' , '意大利' , '西班牙' , 
        '德国' , '泰国' , '印度' , '加拿大' , '澳大利亚' , '俄罗斯' , '波兰' , '丹麦' , '瑞典' , '巴西' , '墨西哥' , '阿根廷' ,
        '比利时' , '奥地利' , '荷兰' , '匈牙利' , '土耳其' , '希腊' , '爱尔兰' , '伊朗' , '捷克']
        
    filters['电视剧标签']=['美剧' , '英剧' , '韩剧' , '日剧' , '国产剧' , '港剧' , '台剧' , '泰剧' , '动漫']
    
    filters['年代标签']=['2014' , '2013' , '2012' , '2011' , '2010' , '2009' , '2008' , '2007' , '2006' ,
        '2005' , '2004' , '2003' , '2002' , '2001' , '2000' , '90s' , '80s' , '70s' , '60s' , '50s' , '40s' , '30s']
    curyear=int(time.strftime('%Y',time.localtime(time.time())))
    for intyear in range(2015,curyear+1):
        filters['年代标签'].insert(0, str(intyear))
        
    filters['自定义标签']=six.ensure_text(plugin.get_setting('dbdeftag')).lower().split(',')
    
    sstr=''
    dialog = xbmcgui.Dialog()
    qtyps = ['类型标签','地区标签','电视剧标签','年代标签','自定义标签','手动输入']
    sel = dialog.select('标签类型', qtyps)
    if sel>=0:
        if sel==5:
            mstr = keyboard(u'请输入标签,多个标签用空格隔开')
            if not mstr:
                return
            return mstr
        else:
            sel2=dialog.select('标签类型',filters[qtyps[sel]])
            if sel2==-1: return ''
            return filters[qtyps[sel]][sel2]
예제 #2
0
def btsearchInit(sstr='',modify='0'):
    if sstr=='0':sstr=''
    if not sstr or sstr=='0' or modify=='1':
        sstr = keyboard(text=sstr)
        if not sstr:
            return

    
    items=[]
    items.append({'label': '编辑搜索关键字[COLOR FF00FFFF]%s[/COLOR]'%(six.ensure_text(sstr)),
                'path': plugin.url_for('btsearchInit', sstr=six.ensure_binary(sstr), modify='1'),
                'thumbnail':xbmc.translatePath( os.path.join( __cwd__, 'magnet.jpg') )})
    items.append({'label': '按[COLOR FFFF00FF]%s[/COLOR]全搜索[COLOR FF00FFFF]%s[/COLOR]'%('相关度',six.ensure_text(sstr)), 
                'path': plugin.url_for('btsearch',enginestr='all',sstr=six.ensure_binary(sstr),sorttype='relevance')})
    items.append({'label': '按[COLOR FFFF00FF]%s[/COLOR]全搜索[COLOR FF00FFFF]%s[/COLOR]'%('创建时间',six.ensure_text(sstr)), 
                'path': plugin.url_for('btsearch',enginestr='all',sstr=six.ensure_binary(sstr),sorttype='addtime')})
    items.append({'label': '按[COLOR FFFF00FF]%s[/COLOR]全搜索[COLOR FF00FFFF]%s[/COLOR]'%('文件大小',six.ensure_text(sstr)), 
                'path': plugin.url_for('btsearch',enginestr='all',sstr=six.ensure_binary(sstr),sorttype='size')})
    items.append({'label': '按[COLOR FFFF00FF]%s[/COLOR]全搜索[COLOR FF00FFFF]%s[/COLOR]'%('文件数量',six.ensure_text(sstr)), 
                'path': plugin.url_for('btsearch',enginestr='all',sstr=six.ensure_binary(sstr),sorttype='files')})
    items.append({'label': '按[COLOR FFFF00FF]%s[/COLOR]全搜索[COLOR FF00FFFF]%s[/COLOR]'%('热度',six.ensure_text(sstr)), 
                'path': plugin.url_for('btsearch',enginestr='all',sstr=six.ensure_binary(sstr),sorttype='popular')})
    btenginelist=nova2.initialize_engines()
    
    
    for btengine in btenginelist:
        items.append({'label': '在[COLOR FFFFFF00]%s[/COLOR]搜索[COLOR FF00FFFF]%s[/COLOR]'%(btengine,six.ensure_text(sstr)),
                'path': plugin.url_for('btsearch',enginestr=btengine,sstr=six.ensure_binary(sstr),sorttype='-1')})
    return items
예제 #3
0
def dbsearch(sstr, page=0):
    if not sstr or sstr=='0':
        sstr = keyboard()
        if not sstr or sstr=='0':
            return
    try:
        sstr=re.sub(r'\s+','',sstr)
        url = 'https://www.douban.com/j/search?q=%s&start=%s&cat=1002' % (sstr, str(int(page)*20))
        rsp = _http(url)
        minfo = json.loads(rsp[rsp.index('{'):])
        menus =[]
        if 'items' in minfo:
            for item in minfo['items']:
                rtxt =r'subject%2F(.*?)%2F.*?<img\s+src="(.*?)">.*?}\s*\x29\s*"\s*>(.*?)\s*</a>.*?rating-info">(.*?)</div>'
                patt = re.compile(rtxt, re.S)
                m = patt.search(item)
                if m:
                    rat='-'
                    ratm = re.search(r'rating_nums">(.*?)</span>', m.group(4), re.DOTALL | re.IGNORECASE)
                    if ratm:
                        rat = ratm.group(1)

                    menus.append({'label': '%s[%s]'%(m.group(3),rat),
                        'path': plugin.url_for('dbsubject', subject=m.group(1)),
                        'thumbnail': m.group(2),
                        'context_menu':[('搜索'+colorize_label(m.group(3), color='00FF00'), 
                            'RunPlugin('+plugin.url_for('searchinit',stypes='pan,bt',sstr=six.ensure_binary(m.group(2)),modify='1',otherargs='{}')+')',)],
                        })
                else:
                    plugin.log.error(item)
    except:
        xbmc.log(msg=format_exc(),level=xbmc.LOGERROR)
        return
    #try:
    if 'more' in minfo:
        if minfo['more']:
            menus.append({
                'label': '下一页',
                'path': plugin.url_for('dbsearch', sstr=six.ensure_binary(sstr), page=str(int(page)+1)),
                'thumbnail':xbmc.translatePath( os.path.join( IMAGES_PATH, 'nextpage.png') ),
                })
    #except: pass
    setthumbnail['set']=True
    return menus
예제 #4
0
def dbsearch(sstr, page=0):
    if not sstr or sstr == '0':
        sstr = keyboard()
        if not sstr or sstr == '0':
            return
    try:
        sstr = re.sub(r'\s+', '', sstr)
        url = 'https://www.douban.com/j/search?' + parse.urlencode(
            encode_obj({
                'q': sstr,
                'start': int(page) * 20,
                'cat': 1002
            }))
        rsp = _http(url)
        minfo = json.loads(rsp[rsp.index('{'):])
        menus = []
        if 'items' in minfo:
            for item in minfo['items']:
                rtxt = r'subject%2F(.*?)%2F.*?<img\s+src="(.*?)">.*?}\s*\x29\s*"\s*>(.*?)\s*</a>.*?rating-info">(.*?)</div>'
                patt = re.compile(rtxt, re.S)
                m = patt.search(item)
                if m:
                    rat = '-'
                    ratm = re.search(r'rating_nums">(.*?)</span>', m.group(4),
                                     re.DOTALL | re.IGNORECASE)
                    if ratm:
                        rat = ratm.group(1)
                    searchtitle = m.group(3).replace('第一季','s01').replace('第二季','s02').replace('第三季','s03').replace('第四季','s04').replace('第五季','s05')\
                        .replace('第六季','s06').replace('第七季','s07').replace('第八季','s08').replace('第九季','s09').replace('第十季','s10')\
                        .replace('第十一季','s11').replace('第十二季','s12').replace('第十三季','s13').replace('第十四季','s14').replace('第十五季','s15')\
                        .replace('第十六季','s16').replace('第十七季','s17').replace('第十八季','s18').replace('第十九季','s19').replace('第二十季','s20')
                    menus.append({
                        'label':
                        '%s[[COLOR FFFF3333]%s[/COLOR]]' % (m.group(3), rat),
                        'path':
                        plugin.url_for('dbsubject', subject=m.group(1)),
                        'thumbnail':
                        m.group(2),
                        'context_menu': [(
                            '搜索' + colorize_label(searchtitle, color='00FF00'),
                            'Container.update(' +
                            plugin.url_for('searchinit',
                                           stypes='pan,bt',
                                           sstr=six.ensure_binary(m.group(2)),
                                           modify='1',
                                           otherargs='{}') + ')',
                        )],
                    })
                else:
                    plugin.log.error(item)
    except:
        xbmc.log(msg=format_exc(), level=xbmc.LOGERROR)
        return
    #try:
    if 'more' in minfo:
        if minfo['more']:
            menus.append({
                'label':
                '下一页',
                'path':
                plugin.url_for('dbsearch',
                               sstr=six.ensure_binary(sstr),
                               page=str(int(page) + 1)),
                'thumbnail':
                xbmc.translatePath(os.path.join(IMAGES_PATH, 'nextpage.png')),
            })
    #except: pass
    comm.setthumbnail = True
    return menus
예제 #5
0
def javlist(qbbb='qb',filtertype='0',filterkey='0',page=1):
    if not 'base' in javbusurl.raw_dict():
        getjavbusurl()
    if not 'existmag' in javbusurl.raw_dict():
        javbusurl['existmag']='all'
    filterkey=filterkey.replace(' ','')
    filterkey=parse.quote(filterkey)
    filter=''
    if filtertype!='0':
        if filterkey!='0':
            filter='/%s/%s'%(filtertype,filterkey)
        
        else:
            if filtertype=='search':
                if not filterkey or filterkey=='0':
                    filterkey = keyboard()
                    if not filterkey or filterkey=='0':
                        return
                filter='/%s/%s'%(filtertype,filterkey.replace(' ',''))
            else:
                filter='/'+filtertype
    pagestr=''
    if int(page)>1:
        if filter:
            pagestr='/'+str(page)
        else:
            pagestr='/page/'+str(page)
    url='%s%s%s'%(javbusurl[qbbb],filter,pagestr)
    if filtertype=='search':
        url=url+'&type=1'
    #xbmc.log(url)
    try:
        menus=[]
        if javbusurl['existmag']=='all':
            menus.append({'label':'已显示所有片片',
                'path': plugin.url_for('chg_existmag',qbbb=qbbb,filtertype=filtertype,filterkey=filterkey),
                'thumbnail':xbmc.translatePath( os.path.join( IMAGES_PATH, 'movies.png') )})
        else:
            menus.append({'label':'已显示有磁片片',
                'path': plugin.url_for('chg_existmag',qbbb=qbbb,filtertype=filtertype,filterkey=filterkey),
                'thumbnail':xbmc.translatePath( os.path.join( IMAGES_PATH, 'magnet.png') )})
        rsp = _http(url,cookie='existmag='+javbusurl['existmag'])
        
        releech='movie-box.*?href="(?P<detailurl>.*?)".*?src="(?P<imageurl>.*?)".*?title="(?P<title>.*?)".*?<date>(?P<id>.*?)</date>.*?<date>(?P<date>.*?)</date>'
        # if qbbb=='om':
            # releech='"item pull-left".*?href="(?P<detailurl>.*?)".*?src="(?P<imageurl>.*?)".*?"_blank">(?P<title>.*?)</a><br>.*?"item-title">(?P<id>.*?)</span>.*?"item-title">(?P<date>.*?)</span>'
        leech = re.compile(releech, re.S)
        for match in leech.finditer(rsp):
            detailurl=match.group('detailurl')
            movieno=detailurl[detailurl.rfind('/')+1:]
            context_menu_items=[]
            context_menu_items.append(('搜索'+colorize_label(match.group('id'), color='00FF00'), 
                'RunPlugin('+plugin.url_for('searchinit',stypes='pan,bt',sstr=match.group('id'),modify='1',otherargs='{}')+')',))
            coverimg=match.group('imageurl').replace('thumb','cover').replace('.jpg','_b.jpg')
            listitem=ListItem(label='[[COLOR FFFFFF00]%s[/COLOR]]%s(%s)'%(match.group('id'), match.group('title'), match.group('date')),
                    thumbnail=match.group('imageurl'), path= plugin.url_for('javdetail',qbbb=qbbb, movieno=movieno,id=match.group('id'),
                    title=six.ensure_binary(match.group('title'))),)
            listitem.set_property("Fanart_Image", coverimg)
            #listitem.set_property("Landscape_Image", match.group('imageurl'))
            #listitem.set_property("Poster_Image", match.group('imageurl'))
            #listitem.set_property("Banner_Image", match.group('imageurl'))
            # menus.append({'label':'[[COLOR FFFFFF00]%s[/COLOR]]%s(%s)'%(match.group('id'), match.group('title'), match.group('date')),
                  # 'path': plugin.url_for('javdetail',qbbb=qbbb, movieno=movieno,id=match.group('id'),title=match.group('title')),
                  # 'thumbnail':match.group('imageurl'),})
            if len(context_menu_items)>0 and listitem!=None:
                listitem.add_context_menu_items(context_menu_items)
                menus.append(listitem)
        strnextpage=str(int(page)+1)
        strnextpage='/'+strnextpage+'">'+strnextpage+'</a>'
        if rsp.find(strnextpage)>=0:
            menus.append({'label': '下一页',
                        'path':plugin.url_for('javlist', qbbb=qbbb,filtertype=filtertype,filterkey=filterkey,page=int(page)+1),
                        'thumbnail':xbmc.translatePath( os.path.join( IMAGES_PATH, 'nextpage.png') )})
        setthumbnail['set']=True
        plugin.set_content('movies')
        return menus
    except Exception as ex:
        plugin.notify('片片列表获取失败'+str(ex))
        xbmc.log(msg=format_exc(),level=xbmc.LOGERROR)
        return