information kickass update

pull/1/head
DiMartinoXBMC 2015-01-31 23:28:30 +03:00
parent 720d945133
commit 3235180025
17 changed files with 914 additions and 643 deletions

File diff suppressed because it is too large Load Diff

View File

@ -81,7 +81,7 @@ class Content:
for y in range(2015, 1970, -1): for y in range(2015, 1970, -1):
category_dict['year'][str(y)] = (str(y), '/top/y/%s/' % str(y)) category_dict['year'][str(y)] = (str(y), '/top/y/%s/' % str(y))
def get_contentList(self, category, subcategory=None, property=None): def get_contentList(self, category, subcategory=None, apps_property=None):
''' '''
Retrieve keyword from the input and return a list of tuples: Retrieve keyword from the input and return a list of tuples:
filesList.append(( filesList.append((

41
Core.py
View File

@ -18,8 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
''' '''
from StringIO import StringIO
import gzip
import tempfile import tempfile
import Downloader import Downloader
@ -33,6 +31,7 @@ from Player import TorrentPlayer
from functions import * from functions import *
from resources.utorrent.net import * from resources.utorrent.net import *
from resources.scrapers.scrapers import Scrapers from resources.scrapers.scrapers import Scrapers
from resources.skins.DialogXml import *
class Core: class Core:
@ -651,8 +650,7 @@ class Core:
apps['sort'] = int(sort) + 1 apps['sort'] = int(sort) + 1
else: else:
apps['sort'] = 0 apps['sort'] = 0
print str(apps['sort']) self.drawItem('[COLOR FFFFFFFF][B]%s %s[/B][/COLOR]' % (self.localize('Sort'), self.localize(property['sort'][apps['sort']]['name'])), 'openContent',
self.drawItem('[COLOR FFFFFFFF][B]%s: %s[/B][/COLOR]' % (self.localize('Sort'), self.localize(property['sort'][apps['sort']]['name'])), 'openContent',
json.dumps(apps), isFolder=True) json.dumps(apps), isFolder=True)
if mode == 'tracker': if mode == 'tracker':
@ -898,6 +896,11 @@ class Core:
sys.argv[0], 'downloadLibtorrent', urllib.quote_plus('%s::%s' % (provider, info.get('link'))))) sys.argv[0], 'downloadLibtorrent', urllib.quote_plus('%s::%s' % (provider, info.get('link')))))
] ]
if isinstance(info, dict) and info.get('infolink'):
contextMenu.append((self.localize('Information'),
'XBMC.RunPlugin(%s)' % ('%s?action=%s&provider=%s&url=%s&link=%s') % (
sys.argv[0], 'ActionInfo', provider, info.get('infolink'), link['url'])))
if self.open_option==0: if self.open_option==0:
self.drawItem(title, 'openTorrent', link, image=img, info=info, contextMenu=contextMenu, replaceMenu=False) self.drawItem(title, 'openTorrent', link, image=img, info=info, contextMenu=contextMenu, replaceMenu=False)
elif self.open_option==1: elif self.open_option==1:
@ -908,6 +911,27 @@ class Core:
self.drawItem(title, 'downloadLibtorrent', link, image=img, info=info, contextMenu=contextMenu, replaceMenu=False) self.drawItem(title, 'downloadLibtorrent', link, image=img, info=info, contextMenu=contextMenu, replaceMenu=False)
#self.drawItem(title, 'openTorrent', link, img, info=info, contextMenu=contextMenu, replaceMenu=False) #self.drawItem(title, 'openTorrent', link, img, info=info, contextMenu=contextMenu, replaceMenu=False)
def ActionInfo(self, params={}):
get = params.get
contenter=get('provider')
infolink=get('url')
link=get('link')
if ROOT + os.sep + 'resources' + os.sep + 'contenters' not in sys.path:
sys.path.insert(0, ROOT + os.sep + 'resources' + os.sep + 'contenters')
try:
self.Content = getattr(__import__(contenter), contenter)()
except Exception, e:
print 'Unable to use contenter: ' + contenter + ' at ' + ' ActionInfo(). Exception: ' + str(e)
movieInfo=self.Content.get_info(infolink)
if movieInfo:
w = DialogXml("movieinfo.xml", ROOT, "Default")
w.doModal(movieInfo, link)
del w
del movieInfo
else:
showMessage(self.localize('Information'),self.localize('Information not found!'))
def searchOption(self, params={}): def searchOption(self, params={}):
try: try:
apps = json.loads(urllib.unquote_plus(params.get("url"))) apps = json.loads(urllib.unquote_plus(params.get("url")))
@ -1378,10 +1402,8 @@ class Core:
x=x+1 x=x+1
fileTitle=myshows_sizes[str(i)]+myshows_cut[x] fileTitle=myshows_sizes[str(i)]+myshows_cut[x]
myshows_items.append(fileTitle) myshows_items.append(fileTitle)
myshows_items.append(self.localize('Return to MyShows.ru'))
myshows_files.append('')
dialog = xbmcgui.Dialog() dialog = xbmcgui.Dialog()
if len(myshows_items) == 2: if len(myshows_items) == 1:
ret = 0 ret = 0
else: else:
ret = dialog.select(self.localize('Search results:'), myshows_items) ret = dialog.select(self.localize('Search results:'), myshows_items)
@ -1429,7 +1451,7 @@ class Core:
get = params.get get = params.get
url = urllib.unquote_plus(get("url")) url = urllib.unquote_plus(get("url"))
addtime=get("addtime") addtime=get("addtime")
if not addtime and self.__settings__.getSetting('history')=='true': if self.__settings__.getSetting('history')=='true':
HistoryDB().add(url) HistoryDB().add(url)
try: try:
external = urllib.unquote_plus(get("external")) external = urllib.unquote_plus(get("external"))
@ -1465,7 +1487,8 @@ class Core:
if None == get('isApi'): if None == get('isApi'):
progressBar.update(0) progressBar.update(0)
progressBar.close() progressBar.close()
filesList = sorted(filesList, key=lambda x: x[0], reverse=True) if self.__settings__.getSetting('sort_search')=='true':
filesList = sorted(filesList, key=lambda x: x[0], reverse=True)
self.showFilesList(filesList, params) self.showFilesList(filesList, params)
def controlCenter(self, params={}): def controlCenter(self, params={}):

View File

@ -87,6 +87,7 @@ dictionary = {
'Skip All Files': 'Пропустить Все Файлы', 'Skip All Files': 'Пропустить Все Файлы',
'Start': 'Пуск', 'Start': 'Пуск',
'Stop': 'Стоп', 'Stop': 'Стоп',
'Play':'Воспроизвести',
'High Priority': 'Высокий Приоритет', 'High Priority': 'Высокий Приоритет',
'Skip File': 'Пропустить Файл', 'Skip File': 'Пропустить Файл',
'Remove': 'Удалить', 'Remove': 'Удалить',
@ -226,6 +227,11 @@ dictionary = {
'by Seeders':'по Сидам', 'by Seeders':'по Сидам',
'by Date':'по Дате', 'by Date':'по Дате',
'Sort':'Сортировка', 'Sort':'Сортировка',
'Close':'Закрыть окно',
'Views:':'Просм.:',
'Rating:':'Рейтинг:',
'Information not found!':'Информация не найдена!'
} }
} }

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.torrenter" name="Torrenter" version="2.1.5" provider-name="vadim.skorba, DiMartino"> <addon id="plugin.video.torrenter" name="Torrenter" version="2.1.6" provider-name="vadim.skorba, DiMartino">
<requires> <requires>
<import addon="xbmc.python" version="2.1.0"/> <import addon="xbmc.python" version="2.1.0"/>
<import addon="script.module.libtorrent"/> <import addon="script.module.libtorrent"/>

19
cal.py
View File

@ -4,25 +4,10 @@ import os, json
ROOT = os.path.dirname(sys.modules["__main__"].sys.argv[0]) ROOT = os.path.dirname(sys.modules["__main__"].sys.argv[0])
searcherObject = {} searcherObject = {}
searcher = 'IMDB' searcher = 'KickAssSo'
if ROOT + os.sep + 'resources' + os.sep + 'contenters' not in sys.path: if ROOT + os.sep + 'resources' + os.sep + 'contenters' not in sys.path:
sys.path.insert(0, ROOT + os.sep + 'resources' + os.sep + 'contenters') sys.path.insert(0, ROOT + os.sep + 'resources' + os.sep + 'contenters')
searcherObject[searcher] = getattr(__import__(searcher), searcher)() searcherObject[searcher] = getattr(__import__(searcher), searcher)()
#print str(searcherObject[searcher].get_contentList(category='search', subcategory='Hobbit')) print str(searcherObject[searcher].get_info('http://kickass.so/greys-anatomy-s11e09-hdtv-x264-lol-ettv-t10144556.html'))
title='No Game No Life\\Subs.[GMC]\\No Game No Life - 06.ass'
path='D:\\torrents\\Torrenter\\No Game No Life\\No Game No Life - 06.mkv'
#path='/sdasda/asdasd/asdasd/No Game No Life - 06.mkv'
folder=title.split('\\')[0]
print folder
temp=os.path.basename(title)
print temp
addition=os.path.dirname(title).lstrip(folder+'\\').replace('\\','.').replace(' ','_').strip()
print addition
ext=temp.split('.')[-1]
temp = temp[:len(temp) - len(ext) - 1]+'.'+addition+'.'+ext
print temp
newFileName=os.path.join(os.path.dirname(path),temp.replace('\\',os.sep))
print str((os.path.join(os.path.dirname(os.path.dirname(path)),title.replace('\\',os.sep)),newFileName))

View File

@ -1,5 +1,9 @@
[B]Version 2.1.4[/B] [B]Version 2.1.6[/B]
[+] Списки Медиа: Сортировка [+] Списки Медиа: Окно информации (пока только KickAssSo). Спасибо evgen_dev
[+] История Поиска: Перенос в начало списка при повторном поиске
[B]Version 2.1.5[/B]
[+] Списки Медиа: Сортировка (пока только KickAssSo)
[B]Version 2.1.4[/B] [B]Version 2.1.4[/B]
[+] Ace Stream: баг-фиксы [+] Ace Stream: баг-фиксы

View File

@ -948,12 +948,17 @@ class HistoryDB:
self._close() self._close()
def add(self, url): def add(self, url):
if not self.get(url): self._connect()
self._connect() self.cur.execute('select fav from history where string="' + url + '"')
x = self.cur.fetchone()
if x: x=int(x[0])
fav=True if x else False
if not fav:
self.cur.execute('delete from history where string="' + decode(url) + '"')
self.cur.execute('insert into history(addtime,string,fav,providers)' self.cur.execute('insert into history(addtime,string,fav,providers)'
' values(?,?,?,?)', (int(time.time()), decode(url), 0, "")) ' values(?,?,?,?)', (int(time.time()), decode(url), 0, ""))
self.db.commit() self.db.commit()
self._close() self._close()
def update(self, addtime, fav): def update(self, addtime, fav):
self._connect() self._connect()

View File

@ -19,6 +19,7 @@
''' '''
import re import re
import Content import Content
from BeautifulSoup import BeautifulSoup
class KickAssSo(Content.Content): class KickAssSo(Content.Content):
category_dict = { category_dict = {
@ -85,9 +86,9 @@ class KickAssSo(Content.Content):
num = 51 num = 51
good_forums=['TV','Anime','Movies'] good_forums=['TV','Anime','Movies']
result = re.compile( result = re.compile(
r'''<a title="Download torrent file" href="(.+?)\?.+?" class=".+?"><i.+?<a.+?<a.+?<a href=".+?html" class=".+?">(.+?)</a>.+? in <span.+?"><strong>.+?">(.+?)</a>''', r'''<a title="Download torrent file" href="(.+?)\?.+?" class=".+?"><i.+?<a.+?<a.+?<a href="(.+?html)" class=".+?">(.+?)</a>.+? in <span.+?"><strong>.+?">(.+?)</a>''',
re.DOTALL).findall(response) re.DOTALL).findall(response)
for link,title,forum in result: for link,infolink,title,forum in result:
#main #main
if forum in good_forums: if forum in good_forums:
info = {} info = {}
@ -99,9 +100,75 @@ class KickAssSo(Content.Content):
info['label'] = info['title'] = self.unescape(title) info['label'] = info['title'] = self.unescape(title)
info['link'] = link info['link'] = link
info['infolink']=self.baseurl+infolink
contentList.append(( contentList.append((
int(int(self.sourceWeight) * (int(num))), int(int(self.sourceWeight) * (int(num))),
original_title, title, int(year), img, info, original_title, title, int(year), img, info,
)) ))
return contentList return contentList
def get_info(self, url):
movieInfo={}
color='[COLOR blue]%s:[/COLOR] %s\r\n'
response = self.makeRequest(url, headers=self.headers)
if None != response and 0 < len(response):
Soup = BeautifulSoup(response)
result = Soup.find('div', 'torrentMediaInfo')
if not result:
return None
li=result.findAll('li')
info,movieInfo={'Cast':''},{'desc':'','poster':'','title':'','views':'0','rating':'50','kinopoisk':''}
try:
img=result.find('a',{'class':'movieCover'}).find('img').get('src')
movieInfo['poster']='http:'+img
except:
pass
try:
movie=re.compile('View all <strong>(.+?)</strong> episodes</a>').match(str(result))
if movie:
info['Movie']=movie.group(1)
except:
pass
for i in li:
name=i.find('strong').text
if name:
info[name.rstrip(':')]=i.text.replace(name,'',1)
plot=result.find('div',{'id':'summary'})
if plot:
cut=plot.find('strong').text
info['plot']=plot.text.replace(cut,'',1).replace('report summary','')
#print str(result)
cast=re.compile('<a href="/movies/actor/.+?">(.+?)</a>').findall(str(result))
if cast:
for actor in cast:
info['Cast']+=actor+", "
if 'Genres' in info:
info['Genres']=info['Genres'].replace(', ',',').replace(',',', ')
for key in info.keys():
if not 'Movie' in info and info[key]=='addto bookmarks':
movieInfo['title']=self.unescape(key)
info['TV Show']=self.unescape(key)
if not 'plot' in info and 'Summary' in key:
info['plot']=info[key]
for i in ['Movie','TV Show','Release date','Original run','Episode','Air date','Genres','Language','Director','Writers','Cast','Original run','IMDb rating','AniDB rating']:
if info.get(i) and info.get(i) not in ['']:
movieInfo['desc']+=color %(i,info.get(i))
if i=='Movie':
movieInfo['title']=info.get(i)
for i in ['plot','IMDb link','RottenTomatoes']:
if info.get(i) and info.get(i) not in ['']:
if i=='plot':
movieInfo['desc']+='\r\n[COLOR blue]Plot:[/COLOR]\r\n'+info.get(i)
if i=='RottenTomatoes':
movieInfo['rating']=str(info.get(i).split('%')[0])
if i=='IMDb link':
movieInfo['kinopoisk']='http://imdb.snick.ru/ratefor/02/tt%s.png' % info.get(i)
#print str(info)
return movieInfo

View File

@ -36,6 +36,7 @@
<string id="30036">Open Context Menu</string> <string id="30036">Open Context Menu</string>
<string id="30037">Download via Torrent-client</string> <string id="30037">Download via Torrent-client</string>
<string id="30038">Download via Python-Libtorrent</string> <string id="30038">Download via Python-Libtorrent</string>
<string id="30039">Sort search results by seeds</string>
<string id="30101">Interface</string> <string id="30101">Interface</string>
<string id="30102">P2P Network</string> <string id="30102">P2P Network</string>
<string id="30103">Advanced</string> <string id="30103">Advanced</string>

View File

@ -36,6 +36,7 @@
<string id="30036">Открыть Контекстное меню</string> <string id="30036">Открыть Контекстное меню</string>
<string id="30037">Скачать Торрент-клиентом</string> <string id="30037">Скачать Торрент-клиентом</string>
<string id="30038">Скачать Python-Libtorrent</string> <string id="30038">Скачать Python-Libtorrent</string>
<string id="30039">Сортировать поиск по количеству раздающих</string>
<string id="30101">Интерфейс</string> <string id="30101">Интерфейс</string>
<string id="30102">P2P Сеть</string> <string id="30102">P2P Сеть</string>
<string id="30103">Дополнительные</string> <string id="30103">Дополнительные</string>

View File

@ -146,7 +146,7 @@ class Cache:
def download(self): def download(self):
dirname = os.path.dirname(self.filename) dirname = os.path.dirname(self.filename)
zipname = os.path.basename(self.filename).rstrip('.db') + '.zip' zipname = os.path.basename(self.filename).replace('.db','') + '.zip'
url = 'http://www.tat-store.ru/torrenter/' + zipname url = 'http://www.tat-store.ru/torrenter/' + zipname
self.http = HTTP() self.http = HTTP()
response = self.http.fetch(url, download=os.path.join(dirname, zipname), progress=True) response = self.http.fetch(url, download=os.path.join(dirname, zipname), progress=True)

View File

@ -63,7 +63,7 @@ class KickAssSo(SearcherABC.SearcherABC):
def search(self, keyword): def search(self, keyword):
filesList = [] filesList = []
url = "http://kickass.so/usearch/%s/?field=seeders&sorder=desc" % urllib.quote_plus(keyword) url = "http://kickass.so/usearch/%s/?field=time_add&sorder=desc" % urllib.quote_plus(keyword)
headers = [('User-Agent', headers = [('User-Agent',
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 YaBrowser/14.10.2062.12061 Safari/537.36'), 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 YaBrowser/14.10.2062.12061 Safari/537.36'),
('Referer', 'http://kickass.so/'), ('Accept-encoding', 'gzip'), ] ('Referer', 'http://kickass.so/'), ('Accept-encoding', 'gzip'), ]

View File

@ -19,6 +19,12 @@
label="30020" label="30020"
default="true" default="true"
/> />
<setting
id="sort_search"
type="bool"
label="30039"
default="true"
/>
<setting <setting
id="skin_optimization" id="skin_optimization"
type="enum" type="enum"

View File

@ -0,0 +1,218 @@
<window>
<coordinates>
<system>1</system>
<posx>240</posx>
<posy>20</posy>
</coordinates>
<include>dialogeffect</include>
<controls>
<control type="group">
<animation effect="fade" time="250">WindowOpen</animation>
<animation effect="fade" time="250">WindowClose</animation>
<control type="image">
<description>background image</description>
<posx>0</posx>
<posy>0</posy>
<width>800</width>
<height>680</height>
<texture border="40">DialogBack.png</texture>
</control>
<control type="image">
<description>Dialog Header image</description>
<posx>40</posx>
<posy>16</posy>
<width>720</width>
<height>40</height>
<texture>dialogheader.png</texture>
</control>
<control type="label" id="1">
<description>header label</description>
<posx>40</posx>
<posy>20</posy>
<width>720</width>
<height>30</height>
<font>font13_title</font>
<label>Информация о фильме</label>
<align>center</align>
<aligny>center</aligny>
<textcolor>selected</textcolor>
<shadowcolor>black</shadowcolor>
</control>
<control type="button" id="2">
<description>Close Window button</description>
<posx>710</posx>
<posy>15</posy>
<width>64</width>
<height>32</height>
<label>-</label>
<font>-</font>
<onclick>PreviousMenu</onclick>
<texturefocus>DialogCloseButton-focus.png</texturefocus>
<texturenofocus>DialogCloseButton.png</texturenofocus>
<onleft>10</onleft>
<onright>10</onright>
<onup>10</onup>
<ondown>10</ondown>
<visible>system.getbool(input.enablemouse)</visible>
</control>
<control type="scrollbar" id="60">
<posx>760</posx>
<posy>100</posy>
<width>25</width>
<height>495</height>
<texturesliderbackground border="0,14,0,14">ScrollBarV.png</texturesliderbackground>
<texturesliderbar border="0,14,0,14">ScrollBarV_bar.png</texturesliderbar>
<texturesliderbarfocus border="0,14,0,14">ScrollBarV_bar_focus.png</texturesliderbarfocus>
<textureslidernib>ScrollBarNib.png</textureslidernib>
<textureslidernibfocus>ScrollBarNib.png</textureslidernibfocus>
<onleft>30</onleft>
<onright>131</onright>
<showonepage>true</showonepage>
<visible>IntegerGreaterThan(Container(32).NumPages,1)</visible>
<orientation>vertical</orientation>
</control>
<control type="image" id="31">
<description>Dialog Header image</description>
<posx>33</posx>
<posy>85</posy>
<width>104</width>
<height>149</height>
<texture></texture>
</control>
<control type="label" id="34">
<description>rating</description>
<posx>34</posx>
<posy>240</posy>
<width>102</width>
<height>20</height>
<visible>true</visible>
<align>left</align>
<aligny>center</aligny>
<scroll>false</scroll>
<label></label>
<haspath>false</haspath>
<font>font10</font>
<textcolor>white</textcolor>
<shadowcolor>black</shadowcolor>
<wrapmultiline>false</wrapmultiline>
</control>
<control type="label" id="35">
<description>rating</description>
<posx>34</posx>
<posy>260</posy>
<width>102</width>
<height>20</height>
<visible>true</visible>
<align>left</align>
<aligny>center</aligny>
<scroll>false</scroll>
<label>[COLOR blue]Рейтинг:[/COLOR] [COLOR red]-200[/COLOR]</label>
<haspath>false</haspath>
<font>font10</font>
<textcolor>white</textcolor>
<shadowcolor>black</shadowcolor>
<wrapmultiline>false</wrapmultiline>
</control>
<control type="image" id="36">
<description>kinopoisk</description>
<posx>34</posx>
<posy>292</posy>
<width>102</width>
<height>38</height>
<texture></texture>
</control>
<control type="textbox" id="32">
<description>filepath</description>
<posx>180</posx>
<posy>70</posy>
<width>550</width>
<pagecontrol>60</pagecontrol>
<height max="470">470</height>
<align>left</align>
<aligny>top</aligny>
<font>font18</font>
<text>Нет описания</text>
<align>center</align>
<aligny>center</aligny>
<textcolor>white</textcolor>
<shadowcolor>black</shadowcolor>
<wrapmultiline>true</wrapmultiline>
</control>
<control type="group" id="9001">
<posy>615</posy>
<posx>50</posx>
<control type="button" id="22">
<description>close</description>
<posx>350</posx>
<posy>0</posy>
<width>320</width>
<height>40</height>
<align>center</align>
<aligny>center</aligny>
<font>font12_title</font>
<label></label>
<onleft>33</onleft>
<onright>60</onright>
<onup>30</onup>
<ondown>30</ondown>
</control>
<control type="button" id="131">
<description>play</description>
<posx>20</posx>
<posy>-50</posy>
<width>320</width>
<height>40</height>
<align>center</align>
<aligny>center</aligny>
<font>font12_title</font>
<label></label>
<onleft>60</onleft>
<onright>30</onright>
<onup>33</onup>
<ondown>33</ondown>
</control>
<control type="button" id="30">
<description>libtorrent</description>
<posx>350</posx>
<posy>-50</posy>
<width>320</width>
<height>40</height>
<align>center</align>
<aligny>center</aligny>
<font>font12_title</font>
<label></label>
<onleft>131</onleft>
<onright>60</onright>
<onup>22</onup>
<ondown>22</ondown>
</control>
<control type="button" id="33">
<description>tclient</description>
<posx>20</posx>
<posy>0</posy>
<width>320</width>
<height>40</height>
<align>center</align>
<aligny>center</aligny>
<font>font12_title</font>
<label>T-client</label>
<onleft>22</onleft>
<onright>22</onright>
<onup>131</onup>
<ondown>131</ondown>
</control>
</control>
</control>
</controls>
</window>

View File

@ -0,0 +1,78 @@
# -*- coding: utf-8 -*-
import xbmcgui, Localization, sys, xbmc
KEY_BUTTON_BACK = 275
KEY_KEYBOARD_ESC = 61467
ACTION_PREVIOUS_MENU = 10
ACTION_NAV_BACK = 92
class DialogXml(xbmcgui.WindowXMLDialog):
def onInit(self):
print "onInit(): Window Initialized"
localize=Localization.localize
color='[COLOR %s]%s[/COLOR]'
self.movie_label = self.getControl(32)
self.movie_label.setText(self.movieInfo['desc'])
if self.movieInfo.get('views'):
self.view_label = self.getControl(34)
self.view_label.setLabel(color % ('blue', localize('Views:'))+self.movieInfo['views'])
self.view_label = self.getControl(35)
self.ratingcolor = 'green'
self.ratingint = int(self.movieInfo['rating'])
if(self.ratingint < 70):
self.ratingcolor = 'red'
self.view_label.setLabel(color % ('blue', localize('Rating:'))+color % (self.ratingcolor, self.movieInfo['rating']))
self.movie_label = self.getControl(1)
self.movie_label.setLabel(self.movieInfo['title'])
self.movie_label = self.getControl(32)
self.movie_label.setText(self.movieInfo['desc'])
self.poster = self.getControl(31)
self.poster.setImage(self.movieInfo['poster'])
self.poster = self.getControl(36)
self.poster.setImage(self.movieInfo['kinopoisk'])
self.getControl(22).setLabel(localize('Close'))
self.getControl(33).setLabel(localize('Download via T-client'))
self.getControl(30).setLabel(localize('Download via Libtorrent'))
self.getControl(131).setLabel(localize('Play'))
self.setFocus(self.getControl(22))
def onAction(self, action):
buttonCode = action.getButtonCode()
if (action == ACTION_NAV_BACK or action == ACTION_PREVIOUS_MENU):
self.close()
if (buttonCode == KEY_BUTTON_BACK or buttonCode == KEY_KEYBOARD_ESC):
self.close()
def onClick(self, controlID):
if (controlID == 2 or controlID == 22):
self.close()
if (controlID == 30):
self.RunPlugin('downloadLibtorrent')
if (controlID == 33):
self.RunPlugin('downloadFilesList')
if (controlID == 131):
self.RunPlugin('openTorrent&external=1')
def RunPlugin(self, action):
if self.link:
exec_str='XBMC.RunPlugin(%s)' % \
('%s?action=%s&url=%s') % \
(sys.argv[0], action, self.link)
xbmc.executebuiltin(exec_str)
def onFocus(self, controlID):
#print "onFocus(): control %i" % controlID
pass
def doModal(self, movieInfo, url):
self.movieInfo = movieInfo
self.link=url
xbmcgui.WindowXMLDialog.doModal(self)

View File