Modifiche del 26/11/2021

This commit is contained in:
Alhaziel01
2021-11-26 18:55:51 +01:00
parent 48996688a6
commit 5257183fb7
221 changed files with 4565 additions and 4807 deletions
+9 -10
View File
@@ -13,42 +13,41 @@
"casacinema": "https://www.casacinema.page",
"cb01anime": "https://www.cineblog01.red",
"cineblog01": "https://cb01.uno",
"cinemalibero": "https://cinemalibero.bar",
"cinemalibero": "https://cinemalibero.surf",
"cinetecadibologna": "http://cinestore.cinetecadibologna.it",
"discoveryplus": "https://www.discoveryplus.com",
"dreamsub": "https://dreamsub.stream",
"dsda": "https://www.dsda.press",
"eurostreaming": "https://eurostreaming.bar",
"eurostreaming": "https://eurostreaming.world",
"filmigratis": "https://filmigratis.org",
"guardaseriecam": "https://guardaserie.cam",
"guardaserieclick": "https://www.guardaserie.builders",
"guardaserieicu": "https://guardaserie.cfd",
"guardaserieicu": "https://guardaserie.center",
"hd4me": "https://hd4me.net",
"ilcorsaronero": "https://ilcorsaronero.link",
"ilgeniodellostreaming": "https://ilgeniodellostreaming.wtf",
"ilgeniodellostreaming": "https://ilgeniodellostreaming.bet",
"ilgeniodellostreaming_cam": "https://ilgeniodellostreaming.city",
"italiaserie": "https://italiaserie.date",
"italiaserie": "https://italiaserie.men",
"mediasetplay": "https://www.mediasetplay.mediaset.it",
"mondoserietv": "https://mondoserietv.club",
"paramount": "https://www.paramountnetwork.it",
"piratestreaming": "https://www.piratestreaming.video",
"piratestreaming": "https://www.piratestreaming.design",
"polpotv": "https://roma.polpo.tv",
"raiplay": "https://www.raiplay.it",
"seriehd": "https://altadefinizionecommunity.casa",
"serietvonline": "https://serietvonline.art",
"serietvsubita": "http://serietvsubita.xyz",
"serietvu": "https://www.serietvu.live",
"streamingcommunity": "https://streamingcommunity.vip",
"streamtime": "https://t.me/s/StreamTime",
"tantifilm": "https://www.tantifilm.stream",
"tantifilm": "https://www.tantifilm.cfd",
"tapmovie": "https://it.tapmovie.net",
"toonitalia": "https://toonitalia.co",
"vvvvid": "https://www.vvvvid.it"
},
"findhost": {
"altadefinizioneclick": "https://altadefinizione-nuovo.click",
"altadefinizionecommunity": "https://altaregistrazione.net",
"animealtadefinizione": "https://www.animealtadefinizione.it",
"filmpertutti": "https://filmpertuttiii.nuovo.live",
"streamingcommunity": "https://streamingcommunity-nuovo.link"
"streamingcommunity": "https://t.me/s/StreamingCommunity_nuovo_link"
}
}
+1 -1
View File
@@ -25,7 +25,7 @@ def mainlist(item):
thumbnail = support.thumb('music')
))
itemlist.append(item.clone(title=support.typo(config.get_localized_string(70741) % 'Musica… ', 'bold'), action='search', thumbnail=support.thumb('music_search')))
itemlist.append(item.clone(title=support.typo(config.getLocalizedString(70741) % 'Musica… ', 'bold'), action='search', thumbnail=support.thumb('music_search')))
support.channel_config(item, itemlist)
return itemlist
+22 -22
View File
@@ -22,7 +22,7 @@ if host.endswith('/'):
host = host[:-1]
headers = {'Referer': host}
order = ['', 'i_piu_visti', 'i_piu_votati', 'i_piu_votati_dellultimo_mese', 'titolo_az', 'voto_imdb_piu_alto'][config.get_setting('order', 'altadefinizionecommunity')]
order = ['', 'i_piu_visti', 'i_piu_votati', 'i_piu_votati_dellultimo_mese', 'titolo_az', 'voto_imdb_piu_alto'][config.getSetting('order', 'altadefinizionecommunity')]
@support.menu
@@ -168,9 +168,9 @@ def findvideos(item):
def play(item):
if host in item.url: # intercetto il server proprietario
# if registerOrLogin():
return support.get_jwplayer_mediaurl(support.httptools.downloadpage(item.url, cloudscraper=True).data, 'Diretto')
return support.get_jwplayer_mediaUrl(support.httptools.downloadpage(item.url, cloudscraper=True).data, 'Diretto')
# else:
# platformtools.play_canceled = True
# platformtools.playCanceled = True
# return []
else:
return [item]
@@ -180,9 +180,9 @@ def resolve_url(item):
registerOrLogin()
if '/watch-unsubscribed' not in item.url and '/watch-external' not in item.url:
playWindow = support.match(support.httptools.downloadpage(item.url, cloudscraper=True).data, patron='playWindow" href="([^"]+)')
video_url = playWindow.match
videoUrl = playWindow.match
item.data = playWindow.data
item.url = video_url.replace('/watch-unsubscribed', '/watch-external')
item.url = videoUrl.replace('/watch-unsubscribed', '/watch-external')
return item
@@ -195,33 +195,33 @@ def login():
logger.info('Login in corso')
post = {'_token': '',
'form_action':'login',
'email': config.get_setting('username', channel='altadefinizionecommunity'),
'password':config.get_setting('password', channel='altadefinizionecommunity')}
'email': config.getSetting('username', channel='altadefinizionecommunity'),
'password':config.getSetting('password', channel='altadefinizionecommunity')}
r = support.httptools.downloadpage(host + '/login', post=post, headers={'referer': host}, cloudscraper=True)
if r.code not in [200, 302] or 'Email o Password non validi' in r.data:
platformtools.dialog_ok('AltadefinizioneCommunity', 'Username/password non validi')
platformtools.dialogOk('AltadefinizioneCommunity', 'Username/password non validi')
return False
return 'id="logged"' in r.data
def registerOrLogin():
if config.get_setting('username', channel='altadefinizionecommunity') and config.get_setting('password', channel='altadefinizionecommunity'):
if config.getSetting('username', channel='altadefinizionecommunity') and config.getSetting('password', channel='altadefinizionecommunity'):
if login():
return True
action = platformtools.dialog_yesno('AltadefinizioneCommunity',
action = platformtools.dialogYesNo('AltadefinizioneCommunity',
'Questo server necessita di un account, ne hai già uno oppure vuoi tentare una registrazione automatica?',
yeslabel='Accedi', nolabel='Tenta registrazione', customlabel='Annulla')
if action == 1: # accedi
from specials import setting
from core.item import Item
user_pre = config.get_setting('username', channel='altadefinizionecommunity')
password_pre = config.get_setting('password', channel='altadefinizionecommunity')
user_pre = config.getSetting('username', channel='altadefinizionecommunity')
password_pre = config.getSetting('password', channel='altadefinizionecommunity')
setting.channel_config(Item(config='altadefinizionecommunity'))
user_post = config.get_setting('username', channel='altadefinizionecommunity')
password_post = config.get_setting('password', channel='altadefinizionecommunity')
user_post = config.getSetting('username', channel='altadefinizionecommunity')
password_post = config.getSetting('password', channel='altadefinizionecommunity')
if user_pre != user_post or password_pre != password_post:
return registerOrLogin()
@@ -235,7 +235,7 @@ def registerOrLogin():
randPsw = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(10))
logger.debug('email: ' + mailbox.address)
logger.debug('pass: ' + randPsw)
reg = platformtools.dialog_register(register_url, email=True, password=True, email_default=mailbox.address, password_default=randPsw)
reg = platformtools.dialogRegister(register_url, email=True, password=True, email_default=mailbox.address, password_default=randPsw)
if not reg:
return False
regPost = httptools.downloadpage(register_url, post={'email': reg['email'], 'password': reg['password']}, cloudscraper=True)
@@ -243,27 +243,27 @@ def registerOrLogin():
if regPost.url == register_url:
error = scrapertools.htmlclean(scrapertools.find_single_match(regPost.data, 'Impossibile proseguire.*?</div>'))
error = scrapertools.unescape(scrapertools.re.sub('\n\s+', ' ', error))
platformtools.dialog_ok('AltadefinizioneCommunity', error)
platformtools.dialogOk('AltadefinizioneCommunity', error)
return False
if reg['email'] == mailbox.address:
if "L'indirizzo email risulta già registrato" in regPost.data:
# httptools.downloadpage(baseUrl + '/forgotPassword', post={'email': reg['email']})
platformtools.dialog_ok('AltadefinizioneCommunity', 'Indirizzo mail già utilizzato')
platformtools.dialogOk('AltadefinizioneCommunity', 'Indirizzo mail già utilizzato')
return False
mail = mailbox.waitForMail()
if mail:
checkUrl = scrapertools.find_single_match(mail.body, '<a href="([^"]+)[^>]+>Verifica').replace(r'\/', '/')
logger.debug('CheckURL: ' + checkUrl)
httptools.downloadpage(checkUrl, cloudscraper=True)
config.set_setting('username', mailbox.address, channel='altadefinizionecommunity')
config.set_setting('password', randPsw, channel='altadefinizionecommunity')
platformtools.dialog_ok('AltadefinizioneCommunity',
config.setSetting('username', mailbox.address, channel='altadefinizionecommunity')
config.setSetting('password', randPsw, channel='altadefinizionecommunity')
platformtools.dialogOk('AltadefinizioneCommunity',
'Registrato automaticamente con queste credenziali:\nemail:' + mailbox.address + '\npass: ' + randPsw)
else:
platformtools.dialog_ok('AltadefinizioneCommunity', 'Impossibile registrarsi automaticamente')
platformtools.dialogOk('AltadefinizioneCommunity', 'Impossibile registrarsi automaticamente')
return False
else:
platformtools.dialog_ok('AltadefinizioneCommunity', 'Hai modificato la mail quindi KoD non sarà in grado di effettuare la verifica in autonomia, apri la casella ' + reg['email']
platformtools.dialogOk('AltadefinizioneCommunity', 'Hai modificato la mail quindi KoD non sarà in grado di effettuare la verifica in autonomia, apri la casella ' + reg['email']
+ ' e clicca sul link. Premi ok quando fatto')
logger.debug('Registrazione completata')
else:
+2 -2
View File
@@ -11,7 +11,7 @@ host = support.config.get_channel_url()
headers = [['Referer', host]]
perpage_list = ['20','30','40','50','60','70','80','90','100']
perpage = perpage_list[support.config.get_setting('perpage' , 'animealtadefinizione')]
perpage = perpage_list[support.config.getSetting('perpage' , 'animealtadefinizione')]
epPatron = r'<td>\s*(?P<title>[^<]+)[^>]+>[^>]+>\s*<a href="(?P<url>[^"]+)"'
@@ -118,7 +118,7 @@ def findvideos(item):
for title, url in matches:
get_video_list(item, url, title, itemlist)
else:
get_video_list(item, item.url, support.config.get_localized_string(30137), itemlist)
get_video_list(item, item.url, support.config.getLocalizedString(30137), itemlist)
return support.server(item, itemlist=itemlist)
+1 -1
View File
@@ -168,6 +168,6 @@ def findvideos(item):
if url.startswith('//'): url = 'https:' + url
elif url.startswith('/'): url = 'https:/' + url
if 'vvvvid' in url: itemlist.append(item.clone(action="play", title='VVVVID', url=url, server='vvvvid'))
else: itemlist.append(item.clone(action="play", title=support.config.get_localized_string(30137), url=url, server='directo'))
else: itemlist.append(item.clone(action="play", title=support.config.getLocalizedString(30137), url=url, server='directo'))
return support.server(item, itemlist=itemlist)
+4 -4
View File
@@ -8,14 +8,14 @@ from platformcode import logger
host = support.config.get_channel_url()
__channel__ = 'animesaturn'
cookie = support.config.get_setting('cookie', __channel__)
cookie = support.config.getSetting('cookie', __channel__)
headers = {'X-Requested-With': 'XMLHttpRequest', 'Cookie': cookie}
def get_cookie(data):
global cookie, headers
cookie = support.match(data, patron=r'document.cookie="([^\s]+)').match
support.config.set_setting('cookie', cookie, __channel__)
support.config.setSetting('cookie', cookie, __channel__)
headers = [['Cookie', cookie]]
@@ -129,7 +129,7 @@ def movies(item):
action = 'findvideos'
def itemlistHook(itemlist):
if page:
itemlist.append(item.clone(title=support.typo(support.config.get_localized_string(30992), 'color kod bold'),page= page, thumbnail=support.thumb()))
itemlist.append(item.clone(title=support.typo(support.config.getLocalizedString(30992), 'color kod bold'),page= page, thumbnail=support.thumb()))
return itemlist
elif 'filter' in item.args:
page = support.match(data, patron=r'totalPages:\s*(\d+)').match
@@ -138,7 +138,7 @@ def movies(item):
if item.nextpage: item.nextpage += 1
else: item.nextpage = 2
if page and item.nextpage < int(page):
itemlist.append(item.clone(title=support.typo(support.config.get_localized_string(30992), 'color kod bold'), url= '{}&page={}'.format(item.url, item.nextpage), infoLabels={}, thumbnail=support.thumb()))
itemlist.append(item.clone(title=support.typo(support.config.getLocalizedString(30992), 'color kod bold'), url= '{}&page={}'.format(item.url, item.nextpage), infoLabels={}, thumbnail=support.thumb()))
return itemlist
else:
+8 -8
View File
@@ -47,7 +47,7 @@ def menu(item):
if item.contentType == 'tvshow':
itemlist += [item.clone(title='In Corso', args=InCorso),
item.clone(title='Terminato', args=Terminato)]
itemlist +=[item.clone(title=support.typo(config.get_localized_string(70741).replace(' %s', ''),'bold'), action='search', thumbnail=support.thumb('search'))]
itemlist +=[item.clone(title=support.typo(config.getLocalizedString(70741).replace(' %s', ''),'bold'), action='search', thumbnail=support.thumb('search'))]
return itemlist
@@ -133,7 +133,7 @@ def news(item):
fulltitle=it['anime']['title'],
thumbnail=it['anime']['imageurl'],
forcethumb = True,
video_url=it['scws_id'],
videoUrl=it['scws_id'],
plot=it['anime']['plot'],
action='findvideos')
)
@@ -149,7 +149,7 @@ def movies(item):
page = item.page if item.page else 0
item.args['offset'] = page * 30
order = support.config.get_setting('order', item.channel)
order = support.config.getSetting('order', item.channel)
if order:
order_list = [ "Standard", "Lista A-Z", "Lista Z-A", "Popolarità", "Valutazione" ]
item.args['order'] = order_list[order]
@@ -186,7 +186,7 @@ def movies(item):
itm.contentSerieName = ''
itm.action = 'play'
item.forcethumb=True
itm.video_url = it['episodes'][0]['scws_id']
itm.videoUrl = it['episodes'][0]['scws_id']
else:
itm.contentType = 'tvshow'
@@ -194,7 +194,7 @@ def movies(item):
itm.fulltitle = itm.show = itm.contentSerieName = title
itm.action = 'episodes'
itm.episodes = it['episodes'] if 'episodes' in it else it['scws_id']
# itm.video_url = item.url
# itm.videoUrl = item.url
itemlist.append(itm)
@@ -219,7 +219,7 @@ def episodes(item):
action='play',
contentType='episode',
forcethumb=True,
video_url=it['scws_id']))
videoUrl=it['scws_id']))
if inspect.stack()[1][3] not in ['find_episodes']:
autorenumber.start(itemlist, item)
@@ -234,11 +234,11 @@ def play(item):
from hashlib import md5
# Calculate Token
client_ip = support.httptools.downloadpage('https://scws.xyz/videos/{}'.format(item.video_url), headers=headers).json.get('client_ip')
client_ip = support.httptools.downloadpage('https://scws.xyz/videos/{}'.format(item.videoUrl), headers=headers).json.get('client_ip')
expires = int(time() + 172800)
token = b64encode(md5('{}{} Yc8U6r8KjAKAepEA'.format(expires, client_ip).encode('utf-8')).digest()).decode('utf-8').replace('=', '').replace('+', '-').replace('/', '_')
url = 'https://scws.xyz/master/{}?token={}&expires={}&n=1'.format(item.video_url, token, expires)
url = 'https://scws.xyz/master/{}?token={}&expires={}&n=1'.format(item.videoUrl, token, expires)
return [item.clone(server='directo', url=url, manifest='hls')]
+3 -3
View File
@@ -10,7 +10,7 @@ host = support.config.get_channel_url()
headers = {}
perpage_list = ['20','30','40','50','60','70','80','90','100']
perpage = perpage_list[support.config.get_setting('perpage' , 'animeuniverse')]
perpage = perpage_list[support.config.getSetting('perpage' , 'animeuniverse')]
epPatron = r'<td>\s*(?P<title>[^ <]+)\s*(?P<episode>\d+)?[^>]+>[^>]+>\s*<a href="(?P<url>[^"]+)"'
@@ -94,7 +94,7 @@ def movies(item):
def itemlistHook(itemlist):
if len(itemlist) == int(perpage):
item.pag += 1
itemlist.append(item.clone(title=support.typo(support.config.get_localized_string(30992), 'color kod bold'), action='movies'))
itemlist.append(item.clone(title=support.typo(support.config.getLocalizedString(30992), 'color kod bold'), action='movies'))
return itemlist
return locals()
@@ -116,7 +116,7 @@ def findvideos(item):
for title, url in matches:
get_video_list(url, title, itemlist)
else:
get_video_list(item.url, support.config.get_localized_string(30137), itemlist)
get_video_list(item.url, support.config.getLocalizedString(30137), itemlist)
return support.server(item, itemlist=itemlist)
+5 -4
View File
@@ -9,14 +9,14 @@ from platformcode import logger
host = support.config.get_channel_url()
__channel__ = 'animeworld'
cookie = support.config.get_setting('cookie', __channel__)
cookie = support.config.getSetting('cookie', __channel__)
headers = [['Cookie', cookie]]
def get_cookie(data):
global cookie, headers
cookie = support.match(data, patron=r'document.cookie="([^\s]+)').match
support.config.set_setting('cookie', cookie, __channel__)
support.config.setSetting('cookie', cookie, __channel__)
headers = [['Cookie', cookie]]
@@ -33,7 +33,7 @@ def get_data(item):
def order():
# Seleziona l'ordinamento dei risultati
return str(support.config.get_setting("order", __channel__))
return str(support.config.getSetting("order", __channel__))
@support.menu
@@ -130,7 +130,7 @@ def movies(item):
if item.args == 'updated':
item.contentType='episode'
patron=r'<div class="inner">\s*<a href="(?P<url>[^"]+)" class[^>]+>\s*<img.*?src="(?P<thumb>[^"]+)" alt?="(?P<title>[^\("]+)(?:\((?P<lang>[^\)]+)\))?"[^>]+>[^>]+>\s*(?:<div class="[^"]+">(?P<type>[^<]+)</div>)?[^>]+>[^>]+>\s*<div class="ep">[^\d]+(?P<episode>\d+)[^<]*</div>'
patron=r'<div class="inner">\s*<a href="(?P<url>[^"]+)" class[^>]+>\s*<img.*?src="(?P<thumb>[^"]+)" alt?="(?P<title>[^\("]+)(?:\((?P<lang>[^\)]+)\))?"[^>]+>[^>]+>\s*(?:<div class="[^"]+">(?P<type>[^<]+)</div>)?(?:[^>]+>){2,4}\s*<div class="ep">[^\d]+(?P<episode>\d+)[^<]*</div>'
action='findvideos'
else:
patron= r'<div class="inner">\s*<a href="(?P<url>[^"]+)" class[^>]+>\s*<img.*?src="(?P<thumb>[^"]+)" alt?="(?P<title>[^\("]+)(?:\((?P<year>\d+)\) )?(?:\((?P<lang>[^\)]+)\))?(?P<title2>[^"]+)?[^>]+>[^>]+>(?:\s*<div class="(?P<l>[^"]+)">[^>]+>)?\s*(?:<div class="[^"]+">(?P<type>[^<]+)</div>)?'
@@ -138,6 +138,7 @@ def movies(item):
# Controlla la lingua se assente
patronNext=r'<a href="([^"]+)" class="[^"]+" id="go-next'
patronTotalPages=r'<span class="total">(\d+)</span>'
typeContentDict={'movie':['movie', 'special']}
typeActionDict={'findvideos':['movie', 'special']}
def itemHook(item):
+5 -11
View File
@@ -9,9 +9,9 @@ else:
from concurrent_py2 import futures
host = config.get_channel_url()
sort = ['views', 'title', 'episodeNumber', 'startDate', 'endDate', 'createdDate'][config.get_setting('sort', 'aniplay')]
order = 'asc' if config.get_setting('order', 'aniplay') else 'desc'
perpage = [10, 20, 30 ,40, 50, 60, 70, 80, 90][config.get_setting('perpage', 'aniplay')]
sort = ['views', 'title', 'episodeNumber', 'startDate', 'endDate', 'createdDate'][config.getSetting('sort', 'aniplay')]
order = 'asc' if config.getSetting('order', 'aniplay') else 'desc'
perpage = [10, 20, 30 ,40, 50, 60, 70, 80, 90][config.getSetting('perpage', 'aniplay')]
@support.menu
@@ -123,9 +123,7 @@ def newest(category):
def latest_added(item):
itemlist = []
if config.get_setting("window_type") == 0:
item.window = True
item.folder = False
page = item.page if item.page else 0
url= '{}/api/home/latest-episodes?page={}'.format(host, page)
js = httptools.downloadpage(url).json
@@ -194,10 +192,6 @@ def episodes(item):
logger.debug()
itemlist = []
if config.get_setting("window_type") == 0:
item.window = True
item.folder = False
# url = '{}/api/anime/{}'.format(host, item.id)
json = httptools.downloadpage(item.url, CF=False ).json
@@ -299,7 +293,7 @@ def findvideos(item):
videourl = json['episodeVideo']
itemlist = [item.clone(title=config.get_localized_string(30137),
itemlist = [item.clone(title=config.getLocalizedString(30137),
url=videourl,
server='directo')]
+1 -1
View File
@@ -191,7 +191,7 @@ def episodes(item):
itemlist = support.season_pagination(itemlist, item, [], 'episodes')
else:
itemlist = support.pagination(itemlist, item, 'episodes')
if config.get_setting('episode_info'):
if config.getSetting('episode_info'):
support.tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
support.videolibrary(itemlist, item)
support.download(itemlist, item)
+1 -1
View File
@@ -68,7 +68,7 @@ def findvideos(item):
matches = support.match(item, patron=r'filename: "(.*?)"').matches
for url in matches:
itemlist.append(item.clone(action="play", title=support.config.get_localized_string(30137), server='directo', url=host + url))
itemlist.append(item.clone(action="play", title=support.config.getLocalizedString(30137), server='directo', url=host + url))
return support.server(item, itemlist=itemlist)
+13 -18
View File
@@ -23,7 +23,7 @@ def Dict(item):
@support.menu
def mainlist(item):
top = [('Dirette {bold}', ['', 'live']),
top = [('Dirette {bullet bold}', ['', 'live']),
('Programmi {bullet bold tv}', ['', 'movies', 'programmi']),
('Generi {bullet bold tv}', ['', 'genres'])]
@@ -32,20 +32,6 @@ def mainlist(item):
return locals()
def liveDict():
livedict = {}
for key in session.get(api + '/cms/routes/canali?decorators=viewingHistory&include=default', headers=headers).json()['included']:
if key['type'] == 'channel' and key.get('attributes',{}).get('hasLiveStream', '') and 'Free' in key.get('attributes',{}).get('packages', []):
title = key['attributes']['name']
livedict[title] = {}
livedict[title]['plot'] = key['attributes']['description']
livedict[title]['url'] = '{}/canali/{}'.format(host, key['attributes']['alternateId'])
livedict[title]['id'] = key['id']
return livedict
def search(item, text):
itemlist = []
item.args = 'search'
@@ -63,8 +49,14 @@ def search(item, text):
def live(item):
logger.debug()
itemlist =[]
for name, values in liveDict().items():
itemlist.append(item.clone(title=name, fulltitle=name, plot=values['plot'], url=values['url'], id=values['id'], action='play', forcethumb=True, no_return=True))
for key in session.get(api + '/cms/routes/canali?decorators=viewingHistory&include=default', headers=headers).json()['included']:
if key['type'] == 'channel' and key.get('attributes',{}).get('hasLiveStream', '') and 'Free' in key.get('attributes',{}).get('packages', []):
title = key['attributes']['name']
plot = key['attributes']['description']
url = '{}/canali/{}'.format(host, key['attributes']['alternateId'])
_id = key['id']
itemlist.append(item.clone(title=title, fulltitle=title, plot=plot, url=url, id=_id, action='findvideos', forcethumb=True))
return support.thumb(itemlist, mode='live')
@@ -166,7 +158,7 @@ def episodes(item):
fulltitle=title,
plot=plot,
id=episode['id'],
action='play',
action='findvideos',
contentType='episode',
season=option['id'],
episode=episode['attributes']['episodeNumber'],
@@ -176,6 +168,9 @@ def episodes(item):
if itemlist: itemlist.sort(key=lambda it: (int(it.season), int(it.episode)))
return itemlist
def findvideos(item):
logger.debug()
return support.server(item, itemlist=[item.clone(server='directo', action='play')])
def play(item):
if item.livefilter:
+1 -1
View File
@@ -60,7 +60,7 @@ def movies(item):
args = item.args
args[0] += 1
support.nextPage(itemlist, item, next_page=item.url, "movies")
# itemlist.append(item.clone(title=support.typo(support.config.get_localized_string(30992), 'color kod bold'), args=args, thumbnail=support.thumb()))
# itemlist.append(item.clone(title=support.typo(support.config.getLocalizedString(30992), 'color kod bold'), args=args, thumbnail=support.thumb()))
return itemlist
return locals()
+32 -29
View File
@@ -24,8 +24,8 @@ headers = {
@support.menu
def mainlist(item):
top = [('Dirette {bold}', ['', 'live']),
('Replay {bold}', ['', 'replay_channels'])]
top = [('Dirette {bullet bold}', ['', 'live']),
('Replay {bullet bold}', ['', 'replay_channels'])]
menu = [('Programmi TV {bullet bold}', ['/tutti-i-programmi', 'movies', '', 'tvshow']),
('Teche La7 {bullet bold}', ['/i-protagonisti', 'movies', '', 'tvshow'])]
@@ -35,14 +35,14 @@ def mainlist(item):
def live(item):
itemlist = [item.clone(title=support.typo('La7', 'bold'), fulltitle='La7', url= host + '/dirette-tv', action='play', forcethumb = True, no_return=True),
item.clone(title=support.typo('La7d', 'bold'), fulltitle='La7d', url= host + '/live-la7d', action='play', forcethumb = True, no_return=True)]
itemlist = [item.clone(title='La7', fulltitle='La7', url= host + '/dirette-tv', action='findvideos', forcethumb = True),
item.clone(title='La7d', fulltitle='La7d', url= host + '/live-la7d', action='findvideos', forcethumb = True)]
return support.thumb(itemlist, mode='live')
def replay_channels(item):
itemlist = [item.clone(title=support.typo('La7', 'bold'), fulltitle='La7', url= host + '/rivedila7/0/la7', action='replay_menu', forcethumb = True),
item.clone(title=support.typo('La7d', 'bold'), fulltitle='La7d', url= host + '/rivedila7/0/la7d', action='replay_menu', forcethumb = True)]
itemlist = [item.clone(title='La7', fulltitle='La7', url= host + '/rivedila7/0/la7', action='replay_menu', forcethumb = True),
item.clone(title='La7d', fulltitle='La7d', url= host + '/rivedila7/0/la7d', action='replay_menu', forcethumb = True)]
return support.thumb(itemlist, mode='live')
@@ -51,17 +51,17 @@ def replay_menu(item):
action = 'replay'
patron = r'href="(?P<url>[^"]+)"><div class="giorno-text">\s*(?P<day>[^>]+)</div><[^>]+>\s*(?P<num>[^<]+)</div><[^>]+>\s*(?P<month>[^<]+)<'
def itemHook(item):
item.title = support.typo(item.day + ' ' + item.num + ' ' + item.month,'bold')
item.title = '{} {} {}'.format(item.day, item.num, item.month)
return item
return locals()
@support.scrape
def replay(item):
action = 'play'
action = 'findvideos'
patron = r'guida-tv"><[^>]+><[^>]+>(?P<hour>[^<]+)<[^>]+><[^>]+><[^>]+>\s*<a href="(?P<url>[^"]+)"><[^>]+><div class="[^"]+" data-background-image="(?P<t>[^"]+)"><[^>]+><[^>]+><[^>]+><[^>]+>\s*(?P<name>[^<]+)<[^>]+><[^>]+><[^>]+>(?P<plot>[^<]+)<'
def itemHook(item):
item.title = support.typo(item.hour + ' - ' + item.name,'bold')
item.title = '{} - {}'.format(item.hour, item.name)
item.contentTitle = item.fulltitle = item.show = item.name
item.thumbnail = 'http:' + item.t
item.fanart = item.thumbnail
@@ -85,14 +85,18 @@ def search(item, text):
@support.scrape
def movies(item):
search = item.search
tmdbEnabled = False
videlibraryEnabled = False
downloadEnabled = False
disableAll = True
action = 'episodes'
patron = r'<a href="(?P<url>[^"]+)"[^>]+><div class="[^"]+" data-background-image="(?P<t>[^"]+)"></div><div class="titolo">\s*(?P<title>[^<]+)<'
def itemHook(item):
logger.debug(item)
item.thumbnail = 'http:' + item.t if item.t.startswith('//') else item.t if item.t else item.thumbnail
prepose = ''
if item.t.startswith('//'):
prepose = 'http:'
elif item.t.startswith('/'):
prepose = host
elif not item.t.startswith('http'):
prepose = host + '/'
item.thumbnail = prepose + item.t
item.fanart = item.thumb
return item
return locals()
@@ -101,8 +105,7 @@ def movies(item):
@support.scrape
def episodes(item):
data = support.match(item).data
# debug = True
action = 'play'
action = 'findvideos'
if '>puntate<' in data:
patronBlock = r'>puntate<(?P<block>.*?)home-block-outbrain'
url = support.match(data, patron=r'>puntate<[^>]+>[^>]+>[^>]+><a href="([^"]+)"').match
@@ -119,10 +122,10 @@ def episodes(item):
def itemHook(item):
if item.Thumb: item.t = item.Thumb
item.thumbnail = 'http:' + item.t if item.t.startswith('//') else item.t if item.t else item.thumbnail
if item.Title: item.title = support.typo(item.Title, 'bold')
if item.Title: item.title = item.Title
if item.date:
item.title = support.re.sub(r'[Pp]untata (?:del )?\d+/\d+/\d+', '', item.title)
item.title += support.typo(item.date, '_ [] bold')
item.title = '{} [{}]'.format(item.title, item.date)
if item.desc: item.plot = item.desc
item.forcethumb = True
item.fanart = item.thumbnail
@@ -130,21 +133,16 @@ def episodes(item):
return locals()
def findvideos(item):
logger.debug()
return support.server(item, itemlist=[item.clone(server='directo', action='play')])
def play(item):
logger.debug()
if item.livefilter:
for it in live(item):
if it.fulltitle == item.livefilter:
item = it
break
data = support.match(item).data
match = support.match(data, patron='/content/entry/data/(.*?).mp4').match
if match:
url = 'https://awsvodpkg.iltrovatore.it/local/hls/,/content/entry/data/' + support.match(item, patron='/content/entry/data/(.*?).mp4').match + '.mp4.urlset/master.m3u8'
item = item.clone(title='Direct', url=url, server='directo', action='play')
else:
url = support.match(data, patron=r'''["]?dash["]?\s*:\s*["']([^"']+)["']''').match
if url:
preurl = support.match(data, patron=r'preTokenUrl = "(.+?)"').match
url = support.match(data, patron=r'''["]?dash["]?\s*:\s*["']([^"']+)["']''').match
tokenHeader = {
'host': headers['host_token'],
'user-agent': headers['user-agent'],
@@ -171,4 +169,9 @@ def play(item):
lic_url='%s|%s|R{SSM}|'%(license_url, preLic)
item.drm = DRM
item.license = lic_url
else:
match = support.match(data, patron='/content/entry/data/(.*?).mp4').match
if match:
url = 'https://awsvodpkg.iltrovatore.it/local/hls/,/content/entry/data/' + support.match(item, patron='/content/entry/data/(.*?).mp4').match + '.mp4.urlset/master.m3u8'
item = item.clone(url=url, server='directo', action='play')
return support.servertools.find_video_items(item, data=url)
+2 -2
View File
@@ -38,7 +38,7 @@ session.headers.update({'authorization': 'Bearer ' + Token})
sessionKey = session.get(sessionUrl.format(uuid=str(uuid.uuid4())), verify=False).json()['sessionKey']
session.headers.update({'x-session': sessionKey})
pagination = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100][config.get_setting('pagination', 'mediasetplay')]
pagination = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100][config.getSetting('pagination', 'mediasetplay')]
@support.menu
@@ -224,7 +224,7 @@ def episodes(item):
def play(item):
logger.debug()
item.no_return=True
mpd = config.get_setting('mpd', item.channel)
mpd = config.getSetting('mpd', item.channel)
lic_url = 'https://widevine.entitlement.theplatform.eu/wv/web/ModularDrm/getRawWidevineLicense?releasePid={pid}&account=http://access.auth.theplatform.com/data/Account/2702976343&schema=1.0&token={token}|Accept=*/*&Content-Type=&User-Agent={ua}|R{{SSM}}|'
+1 -1
View File
@@ -25,7 +25,7 @@ def mainlist(item):
itemlist.append(
support.Item(
channel=item.channel,
title=support.typo(config.get_localized_string(70741) % 'Musica… ', 'bold'),
title=support.typo(config.getLocalizedString(70741) % 'Musica… ', 'bold'),
contentType='music',
url=item.url,
action='search',
+7 -7
View File
@@ -100,8 +100,8 @@ def episodes(item):
items = item.data
elif item.season_url:
items = requests.get(item.season_url).json()['items']
elif item.video_url:
items = requests.get(item.video_url).json()['blocks']
elif item.videoUrl:
items = requests.get(item.videoUrl).json()['blocks']
if 'sets' in items[0]:
if len(items) > 1:
@@ -119,7 +119,7 @@ def episodes(item):
def epMenu(item):
video_url = ''
videoUrl = ''
itemlist = []
for it in item.data:
if 'sets' in it:
@@ -141,7 +141,7 @@ def live(item):
current = it['currentItem']
next = it['nextItem']
plot = '[B]{}[/B]\n{}\n\nA Seguire: [B]{}[/B]\n{}'.format(current['name'], current['description'], next['name'], next['description'])
itemlist.append(item.clone(title=title, fulltitle=title, fanart=fanart, plot=plot, url=url, video_url=url + '.json', action='play'))
itemlist.append(item.clone(title=title, fulltitle=title, fanart=fanart, plot=plot, url=url, videoUrl=url + '.json', action='play'))
itemlist.sort(key=lambda it: support.channels_order.get(it.fulltitle, 999))
support.thumb(itemlist, mode='live')
return itemlist
@@ -206,7 +206,7 @@ def replay(item):
fanart = image,
plot = info['description'],
url = getUrl(it['weblink']),
video_url = getUrl(it['path_id']),
videoUrl = getUrl(it['path_id']),
action = 'play',
forcethumb = True)
@@ -228,7 +228,7 @@ def replay(item):
def play(item):
logger.debug()
res = requests.get(item.video_url).json()
res = requests.get(item.videoUrl).json()
if 'first_item_path' in res:
res = requests.get(getUrl(res['first_item_path'])).json()
@@ -279,7 +279,7 @@ def addinfo(items, item):
thumbnail= getUrl(thumb),
fanart=getUrl(fanart),
url=getUrl(key.get('weblink', '')),
video_url=getUrl(key['path_id']),
videoUrl=getUrl(key['path_id']),
plot=info.get('description', ''))
if 'Genere' not in key.get('sub_type', '') and ('layout' not in key or key['layout'] == 'single'):
+6 -6
View File
@@ -55,7 +55,7 @@ def findvideos(item):
data = re.sub(r'\n|\t|\s+', ' ', data)
# recupero il blocco contenente i link
blocco = scrapertools.find_single_match(data, r'<div class="entry">([\s\S.]*?)<div class="post').replace('..:: Episodio ', 'Episodio ').strip()
matches = scrapertools.find_multiple_matches(blocco, r'(S(\d*)E(\d*))\s')
matches = scrapertools.findMultipleMatches(blocco, r'(S(\d*)E(\d*))\s')
if len(matches) > 0:
for fullseasonepisode, season, episode in matches:
blocco = blocco.replace(fullseasonepisode + ' ', 'Episodio ' + episode + ' ')
@@ -67,7 +67,7 @@ def findvideos(item):
logger.debug(patron)
logger.debug(blocco)
matches = scrapertools.find_multiple_matches(blocco, patron)
matches = scrapertools.findMultipleMatches(blocco, patron)
if len(matches):
data = matches[0][0]
@@ -78,7 +78,7 @@ def findvideos(item):
['Referer', keeplinks]]
html = httptools.downloadpage(keeplinks, headers=headers2).data
data += str(scrapertools.find_multiple_matches(html, '</lable><a href="([^"]+)" target="_blank"'))
data += str(scrapertools.findMultipleMatches(html, '</lable><a href="([^"]+)" target="_blank"'))
return support.server(item, data=data)
@@ -157,7 +157,7 @@ def episodes(item, itemlist=[]):
blocco = scrapertools.find_single_match(data, r'<div class="entry">[\s\S.]*?<div class="post')
blocco = blocco.replace('<strong>Episodio ', '<strong>Episodio ').replace(' </strong>', ' </strong>')
blocco = blocco.replace('<strong>Episodio ', '<strong>S' + season.zfill(2) + 'E')
matches = scrapertools.find_multiple_matches(blocco, r'(S(\d*)E(\d*))\s')
matches = scrapertools.findMultipleMatches(blocco, r'(S(\d*)E(\d*))\s')
episodes = []
if len(matches) > 0:
for fullepisode_s, season, episode in matches:
@@ -173,7 +173,7 @@ def episodes(item, itemlist=[]):
title = scrapedtitle.split(" S0")[0].strip()
title = title.split(" S1")[0].strip()
title = title.split(" S2")[0].strip()
episodes = scrapertools.find_multiple_matches(scrapedtitle, r'((\d*)x(\d*))')
episodes = scrapertools.findMultipleMatches(scrapedtitle, r'((\d*)x(\d*))')
for fullepisode, season, episode in episodes:
infoLabels = {}
@@ -227,7 +227,7 @@ def movies_tv(item):
scrapedplot = ""
scrapedtitle = cleantitle(scrapedtitle)
infoLabels = {}
episode = scrapertools.find_multiple_matches(scrapedtitle, r'((\d*)x(\d*))')
episode = scrapertools.findMultipleMatches(scrapedtitle, r'((\d*)x(\d*))')
if episode: # workaround per quando mettono le serie intere o altra roba, sarebbero da intercettare TODO
episode = episode[0]
title = scrapedtitle.split(" S0")[0].strip()
+23 -14
View File
@@ -4,7 +4,7 @@
# ------------------------------------------------------------
import json, requests, sys
from core import support, channeltools
from core import support, channeltools, jsontools
from platformcode import config, logger
if sys.version_info[0] >= 3:
from concurrent import futures
@@ -12,28 +12,34 @@ else:
from concurrent_py2 import futures
def findhost(url):
return 'https://' + support.match(url, patron='var domain\s*=\s*"([^"]+)').match
matches = support.match(url, patron='<a href="([^"]+)" target="_blank"').matches
if matches:
return matches[-1]
host = support.config.get_channel_url(findhost)
session = requests.Session()
headers = {}
perpage = config.get_setting('pagination', 'streamingcommunity', default=1) * 10 + 10
perpage = config.getSetting('pagination', 'streamingcommunity', default=1) * 10 + 10
def getHeaders():
def getHeaders(forced=False):
global headers
global host
# support.dbg()
if not headers:
headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14'}
response = session.get(host, headers=headers)
if response.status_code != 200 or response.url != host:
try:
headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14'}
response = session.get(host, headers=headers)
if not response.url.startswith(host):
host = support.config.get_channel_url(findhost, forceFindhost=True)
csrf_token = support.match(response.text, patron='name="csrf-token" content="([^"]+)"').match
headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14',
'content-type': 'application/json;charset=UTF-8',
'Referer': host,
'x-csrf-token': csrf_token,
'Cookie': '; '.join([x.name + '=' + x.value for x in response.cookies])}
except:
host = support.config.get_channel_url(findhost, forceFindhost=True)
csrf_token = support.match(response.text, patron='name="csrf-token" content="([^"]+)"').match
headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14',
'content-type': 'application/json;charset=UTF-8',
'Referer': host,
'x-csrf-token': csrf_token,
'Cookie': '; '.join([x.name + '=' + x.value for x in response.cookies])}
if not forced: getHeaders(True)
getHeaders()
@support.menu
@@ -118,6 +124,7 @@ def movies(item):
if type(item.args) == int:
data = support.scrapertools.decodeHtmlentities(support.match(item).data)
records = json.loads(support.match(data, patron=r'slider-title titles-json="(.*?)" slider-name="').matches[item.args])
elif not item.search:
payload = json.dumps({'type': videoType, 'offset':offset, 'genre':item.args})
records = session.post(host + '/api/browse', headers=headers, data=payload).json()['records']
@@ -131,6 +138,8 @@ def movies(item):
js += record
else:
js = records
logger.debug(jsontools.dump(js))
itemlist = makeItems(item, js)
+1 -1
View File
@@ -177,7 +177,7 @@ def findvideos(item):
item.contentType = 'movie'
# if 'protectlink' in data:
# urls = scrapertools.find_multiple_matches(data, r'<iframe src="[^=]+=(.*?)"')
# urls = scrapertools.findMultipleMatches(data, r'<iframe src="[^=]+=(.*?)"')
# logger.debug("SONO QUI: ", urls)
# for url in urls:
# url = url.decode('base64')
+1 -1
View File
@@ -21,7 +21,7 @@ def mainlist(item):
return item
def itemlistHook(itemlist):
itemlist.append(
item.clone(title=support.typo(config.get_localized_string(70741) % 'Musica… ', 'bold'), action='search', thumbnail=support.thumb('search')))
item.clone(title=support.typo(config.getLocalizedString(70741) % 'Musica… ', 'bold'), action='search', thumbnail=support.thumb('search')))
support.channel_config(item, itemlist)
return itemlist
return locals()
+2 -6
View File
@@ -140,10 +140,6 @@ def movies(item):
def episodes(item):
itemlist = []
if config.get_setting("window_type") == 0:
item.window = True
item.folder = False
if item.episodes:
episodes = item.episodes
show_id = item.show_id
@@ -202,7 +198,7 @@ def findvideos(item):
url = url.split()[-1]
itemlist.append(
item.clone(action= 'play',
title=config.get_localized_string(30137),
title=config.getLocalizedString(30137),
url= 'https://or01.top-ix.org/videomg/_definst_/mp4:' + item.url + '/' + url,
server= 'directo')
)
@@ -212,7 +208,7 @@ def findvideos(item):
itemlist.append(
item.clone(action= 'play',
title=config.get_localized_string(30137),
title=config.getLocalizedString(30137),
url= item.url + '?' + key,
server= 'directo'))
+45 -45
View File
@@ -15,46 +15,46 @@ def getmainlist(view="thumb_"):
# Main Menu Channels
if addon.getSetting('enable_news_menu') == "true":
itemlist.append(Item(title=config.get_localized_string(30130), channel="news", action="mainlist",
thumbnail=thumb("news"), category=config.get_localized_string(30119), viewmode="thumbnails",
context=[{"title": config.get_localized_string(70285), "channel": "shortcuts", "action": "SettingOnPosition", "category":7, "setting":1}]))
itemlist.append(Item(title=config.getLocalizedString(30130), channel="news", action="mainlist",
thumbnail=thumb("news"), category=config.getLocalizedString(30119), viewmode="thumbnails",
context=[{"title": config.getLocalizedString(70285), "channel": "shortcuts", "action": "SettingOnPosition", "category":7, "setting":1}]))
if addon.getSetting('enable_channels_menu') == "true":
itemlist.append(Item(title=config.get_localized_string(30118), channel="channelselector", action="getchanneltypes",
thumbnail=thumb("channels"), view=view, category=config.get_localized_string(30119), viewmode="thumbnails"))
itemlist.append(Item(title=config.getLocalizedString(30118), channel="channelselector", action="getchanneltypes",
thumbnail=thumb("channels"), view=view, category=config.getLocalizedString(30119), viewmode="thumbnails"))
if addon.getSetting('enable_search_menu') == "true":
itemlist.append(Item(title=config.get_localized_string(30103), channel="search", path='special', action="mainlist",
thumbnail=thumb("search"), category=config.get_localized_string(30119), viewmode="list",
context = [{"title": config.get_localized_string(60412), "action": "channels_selections", "channel": "search"},
{"title": config.get_localized_string(70286), "channel": "shortcuts", "action": "SettingOnPosition", "category":5 , "setting":1}]))
itemlist.append(Item(title=config.getLocalizedString(30103), channel="search", path='special', action="mainlist",
thumbnail=thumb("search"), category=config.getLocalizedString(30119), viewmode="list",
context = [{"title": config.getLocalizedString(60412), "action": "channels_selections", "channel": "search"},
{"title": config.getLocalizedString(70286), "channel": "shortcuts", "action": "SettingOnPosition", "category":5 , "setting":1}]))
if addon.getSetting('enable_onair_menu') == "true":
itemlist.append(Item(channel="filmontv", action="mainlist", title=config.get_localized_string(50001),
itemlist.append(Item(channel="filmontv", action="mainlist", title=config.getLocalizedString(50001),
thumbnail=thumb("live"), viewmode="thumbnails"))
if addon.getSetting('enable_link_menu') == "true":
itemlist.append(Item(title=config.get_localized_string(70527), channel="kodfavorites", action="mainlist", thumbnail=thumb("mylink"),
view=view, category=config.get_localized_string(70527), viewmode="thumbnails"))
itemlist.append(Item(title=config.getLocalizedString(70527), channel="kodfavorites", action="mainlist", thumbnail=thumb("mylink"),
view=view, category=config.getLocalizedString(70527), viewmode="thumbnails"))
if addon.getSetting('enable_fav_menu') == "true":
itemlist.append(Item(title=config.get_localized_string(30102), channel="favorites", action="mainlist",
thumbnail=thumb("favorites"), category=config.get_localized_string(30102), viewmode="thumbnails"))
itemlist.append(Item(title=config.getLocalizedString(30102), channel="favorites", action="mainlist",
thumbnail=thumb("favorites"), category=config.getLocalizedString(30102), viewmode="thumbnails"))
if config.get_videolibrary_support() and addon.getSetting('enable_library_menu') == "true":
itemlist.append(Item(title=config.get_localized_string(30131), channel="videolibrary", action="mainlist",
thumbnail=thumb("videolibrary"), category=config.get_localized_string(30119), viewmode="thumbnails",
context=[{"title": config.get_localized_string(70287), "channel": "shortcuts", "action": "SettingOnPosition", "category":2, "setting":1},
{"title": config.get_localized_string(60568), "channel": "videolibrary", "action": "update_videolibrary"}]))
itemlist.append(Item(title=config.getLocalizedString(30131), channel="videolibrary", action="mainlist",
thumbnail=thumb("videolibrary"), category=config.getLocalizedString(30119), viewmode="thumbnails",
context=[{"title": config.getLocalizedString(70287), "channel": "shortcuts", "action": "SettingOnPosition", "category":2, "setting":1},
{"title": config.getLocalizedString(60568), "channel": "videolibrary", "action": "update_videolibrary"}]))
if downloadenabled != "false":
itemlist.append(Item(title=config.get_localized_string(30101), channel="downloads", action="mainlist", thumbnail=thumb("download"), viewmode="list",
context=[{"title": config.get_localized_string(70288), "channel": "shortcuts", "action": "SettingOnPosition", "category":6}]))
itemlist.append(Item(title=config.getLocalizedString(30101), channel="downloads", action="mainlist", thumbnail=thumb("download"), viewmode="list",
context=[{"title": config.getLocalizedString(70288), "channel": "shortcuts", "action": "SettingOnPosition", "category":6}]))
itemlist.append(Item(title=config.get_localized_string(30100), channel="setting", action="settings",
thumbnail=thumb('setting'), category=config.get_localized_string(30100), viewmode="list", folder=False))
itemlist.append(Item(title=config.get_localized_string(30104) + " (v" + config.get_addon_version(with_fix=True) + ")", channel="help", action="mainlist",
thumbnail=thumb("help"), category=config.get_localized_string(30104), viewmode="list"))
itemlist.append(Item(title=config.getLocalizedString(30100), channel="setting", action="settings",
thumbnail=thumb('setting'), category=config.getLocalizedString(30100), viewmode="list", folder=False))
itemlist.append(Item(title=config.getLocalizedString(30104) + " (v" + config.getAddonVersion(with_fix=True) + ")", channel="help", action="mainlist",
thumbnail=thumb("help"), category=config.getLocalizedString(30104), viewmode="list"))
return itemlist
@@ -70,19 +70,19 @@ def getchanneltypes(view="thumb_"):
# Build Itemlist
itemlist = list()
title = config.get_localized_string(30121)
title = config.getLocalizedString(30121)
itemlist.append(Item(title=title, channel="channelselector", action="filterchannels", view=view,
category=title, channel_type="all", thumbnail=thumb("all"),
viewmode="thumbnails"))
for channel_type in channel_types:
title = config.get_localized_category(channel_type)
title = config.getLocalizedCategory(channel_type)
itemlist.append(Item(title=title, channel="channelselector", action="filterchannels", category=title,
channel_type=channel_type, viewmode="thumbnails",
thumbnail=thumb(channel_type)))
itemlist.append(Item(title=config.get_localized_string(70685), channel="community", action="mainlist", view=view,
category=config.get_localized_string(70685), channel_type="all", thumbnail=thumb("community"),
itemlist.append(Item(title=config.getLocalizedString(70685), channel="community", action="mainlist", view=view,
category=config.getLocalizedString(70685), channel_type="all", thumbnail=thumb("community"),
viewmode="thumbnails"))
return itemlist
@@ -99,7 +99,7 @@ def filterchannels(category, view="thumb_"):
category = "all"
appenddisabledchannels = True
channel_path = os.path.join(config.get_runtime_path(), 'channels', '*.json')
channel_path = os.path.join(config.getRuntimePath(), 'channels', '*.json')
logger.debug("channel_path = %s" % channel_path)
channel_files = glob.glob(channel_path)
@@ -134,7 +134,7 @@ def filterchannels(category, view="thumb_"):
continue
# The channel is skipped if it is not active and we are not activating / deactivating the channels
channel_status = config.get_setting("enabled", channel_parameters["channel"])
channel_status = config.getSetting("enabled", channel_parameters["channel"])
if channel_status is None:
# if channel_status does not exist, there is NO value in _data.json.
@@ -158,7 +158,7 @@ def filterchannels(category, view="thumb_"):
# If you have configuration we add an item in the context
context = []
if channel_parameters["has_settings"]:
context.append({"title": config.get_localized_string(70525), "channel": "setting", "action": "channel_config",
context.append({"title": config.getLocalizedString(70525), "channel": "setting", "action": "channel_config",
"config": channel_parameters["channel"]})
channel_info = set_channel_info(channel_parameters)
@@ -175,7 +175,7 @@ def filterchannels(category, view="thumb_"):
channelslist.sort(key=lambda item: item.title.lower().strip())
if not config.get_setting("only_channel_icons"):
if not config.getSetting("only_channel_icons"):
from core.support import thumb
if category == "all":
@@ -184,12 +184,12 @@ def filterchannels(category, view="thumb_"):
# if view == "banner_" and "banner" in channel_parameters:
# channel_parameters["thumbnail"] = channel_parameters["banner"]
channelslist.insert(0, Item(title=config.get_localized_string(60088), action="mainlist", channel="url",
channelslist.insert(0, Item(title=config.getLocalizedString(60088), action="mainlist", channel="url",
thumbnail=channel_parameters["thumbnail"], type="generic", viewmode="list"))
# Special Category
if category in ['movie', 'tvshow']:
ch_list = []
titles = [config.get_localized_string(70028), config.get_localized_string(30985), config.get_localized_string(70559), config.get_localized_string(60264), config.get_localized_string(70560)]
titles = [config.getLocalizedString(70028), config.getLocalizedString(30985), config.getLocalizedString(70559), config.getLocalizedString(60264), config.getLocalizedString(70560)]
ids = ['popular', 'top_rated', 'now_playing', 'on_the_air']
for x in range(0,3):
if x == 2 and category != 'movie':
@@ -203,7 +203,7 @@ def filterchannels(category, view="thumb_"):
list_type='%s/%s' % (category.replace('show',''), id), mode=category))
ch_list.insert(3, Item(channel='classicsearch', action='genres_menu', title=config.get_localized_string(30987) + '{' + category.replace('show','') + '}',
ch_list.insert(3, Item(channel='classicsearch', action='genres_menu', title=config.getLocalizedString(30987) + '{' + category.replace('show','') + '}',
type=category.replace('show',''), mode=category))
channelslist = thumb(ch_list) + channelslist
@@ -214,10 +214,10 @@ def filterchannels(category, view="thumb_"):
# from core import filetools
# if thumb_name.startswith('http'):
# return thumb_name
# elif config.get_setting('enable_custom_theme') and config.get_setting('custom_theme') and filetools.isfile(config.get_setting('custom_theme') + view + thumb_name):
# media_path = config.get_setting('custom_theme')
# elif config.getSetting('enable_custom_theme') and config.getSetting('custom_theme') and filetools.isfile(config.getSetting('custom_theme') + view + thumb_name):
# media_path = config.getSetting('custom_theme')
# else:
# icon_pack_name = config.get_setting('icon_set', default="default")
# icon_pack_name = config.getSetting('icon_set', default="default")
# media_path = filetools.join("https://raw.githubusercontent.com/kodiondemand/media/master/themes/new", icon_pack_name)
# return filetools.join(media_path, thumb_name)
@@ -246,22 +246,22 @@ def set_channel_info(parameters):
categories = parameters['categories']
for cat in categories:
if content != '':
content = '%s, %s' % (content, config.get_localized_category(cat))
content = '%s, %s' % (content, config.getLocalizedCategory(cat))
else:
content = config.get_localized_category(cat)
content = config.getLocalizedCategory(cat)
info = '[B]' + config.get_localized_string(70567) + ' [/B]' + content + '\n\n'
info += '[B]' + config.get_localized_string(70568) + ' [/B] ' + language
info = '[B]' + config.getLocalizedString(70567) + ' [/B]' + content + '\n\n'
info += '[B]' + config.getLocalizedString(70568) + ' [/B] ' + language
return info
def auto_filter(auto_lang=False):
list_lang = ['ita', 'vos', 'sub-ita']
if config.get_setting("channel_language") == 'auto' or auto_lang == True:
lang = config.get_localized_string(20001)
if config.getSetting("channel_language") == 'auto' or auto_lang == True:
lang = config.getLocalizedString(20001)
else:
lang = config.get_setting("channel_language", default="all")
lang = config.getSetting("channel_language", default="all")
if lang not in list_lang:
lang = 'all'
+4 -4
View File
@@ -1,14 +1,14 @@
from platformcode import config, logger
import xbmc, sys, xbmcgui, os
librerias = xbmc.translatePath(os.path.join(config.get_runtime_path(), 'lib'))
librerias = xbmc.translatePath(os.path.join(config.getRuntimePath(), 'lib'))
sys.path.insert(0, librerias)
from core import jsontools, support
addon_id = config.get_addon_core().getAddonInfo('id')
addon_id = config.getAddonCore().getAddonInfo('id')
LOCAL_FILE = os.path.join(config.get_runtime_path(), "platformcode/contextmenu/contextmenu.json")
LOCAL_FILE = os.path.join(config.getRuntimePath(), "platformcode/contextmenu/contextmenu.json")
f = open(LOCAL_FILE)
contextmenu_settings = jsontools.load(open(LOCAL_FILE).read())
f.close()
@@ -53,7 +53,7 @@ def build_menu():
def empty_item():
return config.get_localized_string(90004)
return config.getLocalizedString(90004)
if __name__ == '__main__':
+8 -4
View File
@@ -36,9 +36,13 @@ def encode(obj):
def decode(obj):
return pickle.loads(zlib.decompress(bytes(obj)))
db_name = filetools.join(config.get_data_path(), "db.sqlite")
db = nested_dict_sqlite(lambda table: SqliteDict(db_name, table, 'c', True))
db_name = filetools.join(config.getDataPath(), "db.sqlite")
vdb_name = filetools.join(config.getVideolibraryPath(), "videolibrary.sqlite")
vdb_name = filetools.join(config.get_videolibrary_path(), "videolibrary.sqlite")
# videolibrarydb = nested_dict_sqlite(lambda table: SqliteDict(vdb_name, table, 'c', True))
db = nested_dict_sqlite(lambda table: SqliteDict(db_name, table, 'c', True))
videolibrarydb = nested_dict_sqlite(lambda table: SqliteDict(vdb_name, table, 'c', True, encode=encode, decode=decode))
if 'played_time' not in SqliteDict.get_tablenames(vdb_name):
for k, v in dict(db['viewed']).items():
videolibrarydb['played_time'][k] = v
+21 -21
View File
@@ -32,13 +32,13 @@ def start(itemlist, item):
if not config.is_xbmc():
return itemlist
if config.get_setting('autoplay') or item.autoplay:
if config.getSetting('autoplay') or item.autoplay:
# Save the current value of "Action and Player Mode" in preferences
user_config_setting_action = config.get_setting("default_action")
# user_config_setting_player = config.get_setting("player_mode")
user_config_setting_action = config.getSetting("default_action")
# user_config_setting_player = config.getSetting("player_mode")
# Enable the "View in high quality" action (if the server returns more than one quality, eg gdrive)
if not user_config_setting_action: config.set_setting("default_action", 2)
if not user_config_setting_action: config.setSetting("default_action", 2)
from core.servertools import sort_servers
autoplay_list = sort_servers(itemlist)
@@ -48,8 +48,8 @@ def start(itemlist, item):
max_intents_servers = {}
# If something is playing it stops playing
if platformtools.is_playing():
platformtools.stop_video()
if platformtools.isPlaying():
platformtools.stopVideo()
for autoplay_elem in autoplay_list:
play_item = Item
@@ -57,7 +57,7 @@ def start(itemlist, item):
if autoplay_elem.channel == 'videolibrary':
channel_id = autoplay_elem.contentChannel
if not platformtools.is_playing() and not PLAYED:
if not platformtools.isPlaying() and not PLAYED:
videoitem = autoplay_elem
if videoitem.server.lower() not in max_intents_servers:
max_intents_servers[videoitem.server.lower()] = max_intents
@@ -69,16 +69,16 @@ def start(itemlist, item):
lang = " [{}]".format(videoitem.language) if videoitem.language else ''
quality = ' [{}]'.format(videoitem.quality) if videoitem.quality and videoitem.quality != 'default' else ''
name = servername(videoitem.server)
platformtools.dialog_notification('AutoPlay', '{}{}{}'.format(name, lang, quality), sound=False)
platformtools.dialogNotification('AutoPlay', '{}{}{}'.format(name, lang, quality), sound=False)
# Try to play the links If the channel has its own play method, use it
channel = platformtools.channel_import(channel_id)
channel = platformtools.channelImport(channel_id)
if not channel:
return
if hasattr(channel, 'play'):
resolved_item = getattr(channel, 'play')(videoitem)
if len(resolved_item) > 0:
if isinstance(resolved_item[0], list): videoitem.video_urls = resolved_item
if isinstance(resolved_item[0], list): videoitem.videoUrls = resolved_item
else: videoitem = resolved_item[0]
play_item.autoplay = True
@@ -88,16 +88,16 @@ def start(itemlist, item):
if base_item.contentChannel == 'videolibrary' or base_item.nfo:
# Fill the video with the data of the main item and play
play_item = base_item.clone(**videoitem.__dict__)
platformtools.play_video(play_item, autoplay=True)
platformtools.playVideo(play_item, autoplay=True)
else:
videoitem.window = base_item.window
# If it doesn't come from the video library, just play
platformtools.play_video(videoitem, autoplay=True)
platformtools.playVideo(videoitem, autoplay=True)
except:
pass
# sleep(3)
try:
if platformtools.is_playing():
if platformtools.isPlaying():
PLAYED = True
break
except:
@@ -108,20 +108,20 @@ def start(itemlist, item):
# If the maximum number of attempts of this server has been reached, ask if we want to continue testing or ignore it.
if max_intents_servers[videoitem.server.lower()] == 0:
text = config.get_localized_string(60072) % name
if not platformtools.dialog_yesno("AutoPlay", text, config.get_localized_string(60073)):
text = config.getLocalizedString(60072) % name
if not platformtools.dialogYesNo("AutoPlay", text, config.getLocalizedString(60073)):
max_intents_servers[videoitem.server.lower()] = max_intents
# If there are no items in the list, it is reported
if autoplay_elem == autoplay_list[-1]:
platformtools.dialog_notification('AutoPlay', config.get_localized_string(60072) % name)
platformtools.dialogNotification('AutoPlay', config.getLocalizedString(60072) % name)
else:
platformtools.dialog_notification(config.get_localized_string(60074), config.get_localized_string(60075))
platformtools.dialogNotification(config.getLocalizedString(60074), config.getLocalizedString(60075))
# Restore if necessary the previous value of "Action and Player Mode" in preferences
if not user_config_setting_action: config.set_setting("default_action", user_config_setting_action)
# if user_config_setting_player != 0: config.set_setting("player_mode", user_config_setting_player)
if not user_config_setting_action: config.setSetting("default_action", user_config_setting_action)
# if user_config_setting_player != 0: config.setSetting("player_mode", user_config_setting_player)
return itemlist
@@ -133,7 +133,7 @@ def play_multi_channel(item, itemlist):
def servername(server):
from core.servertools import translate_server_name
path = filetools.join(config.get_runtime_path(), 'servers', server.lower() + '.json')
path = filetools.join(config.getRuntimePath(), 'servers', server.lower() + '.json')
name = jsontools.load(open(path, "rb").read())['name']
if name.startswith('@'): name = config.get_localized_string(int(name.replace('@','')))
if name.startswith('@'): name = config.getLocalizedString(int(name.replace('@','')))
return translate_server_name(name)
+29 -26
View File
@@ -16,8 +16,7 @@ remote_path = 'https://raw.githubusercontent.com/kodiondemand/media/master/'
def is_enabled(channel_name):
logger.debug("channel_name=" + channel_name)
return get_channel_parameters(channel_name)["active"] and get_channel_setting("enabled", channel=channel_name,
default=True)
return get_channel_parameters(channel_name)["active"] and getChannelSetting("enabled", channel=channel_name, default=True)
def get_channel_parameters(channel_name):
@@ -90,13 +89,13 @@ def get_channel_json(channel_name):
from core import filetools
channel_json = None
try:
channel_path = filetools.join(config.get_runtime_path(), "channels", channel_name + ".json")
channel_path = filetools.join(config.getRuntimePath(), "channels", channel_name + ".json")
if not filetools.isfile(channel_path):
channel_path = filetools.join(config.get_runtime_path(), "specials", channel_name + ".json")
channel_path = filetools.join(config.getRuntimePath(), "specials", channel_name + ".json")
if not filetools.isfile(channel_path):
channel_path = filetools.join(config.get_runtime_path(), "servers", channel_name + ".json")
channel_path = filetools.join(config.getRuntimePath(), "servers", channel_name + ".json")
if not filetools.isfile(channel_path):
channel_path = filetools.join(config.get_runtime_path(), "servers", "debriders",
channel_path = filetools.join(config.getRuntimePath(), "servers", "debriders",
channel_name + ".json")
if filetools.isfile(channel_path):
@@ -115,24 +114,27 @@ def get_channel_json(channel_name):
def get_channel_controls_settings(channel_name):
logger.debug("channel_name=" + channel_name)
dict_settings = {}
# import web_pdb; web_pdb.set_trace()
# list_controls = get_channel_json(channel_name).get('settings', list())
list_controls = get_default_settings(channel_name)
for c in list_controls:
if 'id' not in c or 'type' not in c or 'default' not in c:
# If any control in the list does not have id, type or default, we ignore it
continue
# new dict with key(id) and value(default) from settings
dict_settings[c['id']] = c['default']
if c['type'] == 'list' and c.get('values'):
dict_settings[c['id']] = list(c['values'])[c['default']]
elif c['type'] == 'list' and c.get('dvalues'):
dict_settings[c['id']] = list(c['dvalues'].values())[c['default']]
else:
dict_settings[c['id']] = c['default']
return list_controls, dict_settings
def get_lang(channel_name):
channel = __import__('channels.%s' % channel_name, fromlist=["channels.%s" % channel_name])
list_language = [config.get_localized_string(70522)]
list_language = [config.getLocalizedString(70522)]
if hasattr(channel, 'list_language'):
for language in channel.list_language:
list_language.append(language)
@@ -160,7 +162,7 @@ def get_default_settings(channel_name):
from core import filetools
import copy
default_path = filetools.join(config.get_runtime_path(), 'default_channel_settings' + '.json')
default_path = filetools.join(config.getRuntimePath(), 'default_channel_settings' + '.json')
if channel_name not in ['trakt', 'autoplay']:
global default_file
else:
@@ -168,7 +170,7 @@ def get_default_settings(channel_name):
if not default_file:
default_file = jsontools.load(filetools.read(default_path))
channel_path = filetools.join(config.get_runtime_path(), 'channels', channel_name + '.json')
channel_path = filetools.join(config.getRuntimePath(), 'channels', channel_name + '.json')
if filetools.exists(channel_path):
default_controls = default_file['settings']
@@ -183,35 +185,36 @@ def get_default_settings(channel_name):
default_off = channel_json['default_off'] if 'default_off' in channel_json else []
# Apply default configurations if they do not exist
# logger.dbg()
for control in copy.deepcopy(default_controls):
if control['id'] not in str(channel_controls):
if 'include_in_newest' in control['id'] and 'include_in_newest' not in not_active and control['id'] not in not_active:
label = control['id'].split('_')
label = label[-1]
if label == 'movies':
if label == 'movie':
if 'movie' in categories:
control['label'] = config.get_localized_string(70727) + ' - ' + config.get_localized_string( 30122)
control['label'] = config.getLocalizedString(70727) + ' - ' + config.getLocalizedString( 30122)
control['default'] = False if ('include_in_newest' in default_off) or ( ' include_in_newest_movie' in default_off) else True
channel_controls.append(control)
else:
pass
elif label == 'tvshows':
elif label == 'tvshow':
if 'tvshow' in categories:
control['label'] = config.get_localized_string(70727) + ' - ' + config.get_localized_string( 30123)
control['default'] = False if ('include_in_newest' in default_off) or ( 'include_in_newest_series' in default_off) else True
control['label'] = config.getLocalizedString(70727) + ' - ' + config.getLocalizedString( 30123)
control['default'] = False if ('include_in_newest' in default_off) or ( 'include_in_newest_tvshow' in default_off) else True
channel_controls.append(control)
else:
pass
elif label == 'anime':
if 'anime' in categories:
control['label'] = config.get_localized_string(70727) + ' - ' + config.get_localized_string( 30124)
control['label'] = config.getLocalizedString(70727) + ' - ' + config.getLocalizedString( 30124)
control['default'] = False if ('include_in_newest' in default_off) or ( 'include_in_newest_anime' in default_off) else True
channel_controls.append(control)
else:
pass
else:
control['label'] = config.get_localized_string(70727) + ' - ' + label.capitalize()
control['label'] = config.getLocalizedString(70727) + ' - ' + label.capitalize()
control['default'] = control['default'] if control['id'] not in default_off else False
channel_controls.append(control)
@@ -231,7 +234,7 @@ def get_default_settings(channel_name):
return channel_controls
def get_channel_setting(name, channel, default=None):
def getChannelSetting(name, channel, default=None):
from core import filetools
"""
Returns the configuration value of the requested parameter.
@@ -255,7 +258,7 @@ def get_channel_setting(name, channel, default=None):
@rtype: any
"""
file_settings = filetools.join(config.get_data_path(), "settings_channels", channel + "_data.json")
file_settings = filetools.join(config.getDataPath(), "settings_channels", channel + "_data.json")
dict_settings = {}
dict_file = {}
@@ -288,7 +291,7 @@ def get_channel_setting(name, channel, default=None):
return dict_settings.get(name, default)
def set_channel_setting(name, value, channel):
def setChannelSetting(name, value, channel):
from core import filetools
"""
Sets the configuration value of the indicated parameter.
@@ -312,10 +315,10 @@ def set_channel_setting(name, value, channel):
"""
# We create the folder if it does not exist
if not filetools.exists(filetools.join(config.get_data_path(), "settings_channels")):
filetools.mkdir(filetools.join(config.get_data_path(), "settings_channels"))
if not filetools.exists(filetools.join(config.getDataPath(), "settings_channels")):
filetools.mkdir(filetools.join(config.getDataPath(), "settings_channels"))
file_settings = filetools.join(config.get_data_path(), "settings_channels", channel + "_data.json")
file_settings = filetools.join(config.getDataPath(), "settings_channels", channel + "_data.json")
dict_settings = {}
dict_file = None
+4 -4
View File
@@ -102,16 +102,16 @@ class Downloader(object):
return os.path.abspath(filetools.join(self._path, self._filename))
# Features
def start_dialog(self, title=config.get_localized_string(60200)):
def start_dialog(self, title=config.getLocalizedString(60200)):
from platformcode import platformtools
progreso = platformtools.dialog_progress_bg(title, config.get_localized_string(60201))
progreso = platformtools.dialogProgressBg(title, config.getLocalizedString(60201))
try:
self.start()
while self.state == self.states.downloading:
time.sleep(0.2)
line1 = "%s" % (self.filename)
line2 = config.get_localized_string(59983) % ( self.downloaded[1], self.downloaded[2], self.size[1], self.size[2], self.speed[1], self.speed[2], self.connections[0], self.connections[1])
line3 = config.get_localized_string(60202) % (self.remaining_time)
line2 = config.getLocalizedString(59983) % ( self.downloaded[1], self.downloaded[2], self.size[1], self.size[2], self.speed[1], self.speed[2], self.connections[0], self.connections[1])
line3 = config.getLocalizedString(60202) % (self.remaining_time)
progreso.update(int(self.progress), line1 + '\n' + line2 + " " + line3)
self.__update_json()
+15 -15
View File
@@ -127,7 +127,7 @@ def getfilefromtitle(url, title):
# Print in the log what you will discard
logger.info("title=" + title)
logger.info("url=" + url)
plataforma = config.get_system_platform()
plataforma = config.getSystemPlatform()
logger.info("platform=" + plataforma)
# filename = xbmc.makeLegalFilename(title + url[-4:])
@@ -146,7 +146,7 @@ def getfilefromtitle(url, title):
logger.info("filename= %s" % nombrefichero)
fullpath = filetools.join(config.get_setting("downloadpath"), nombrefichero)
fullpath = filetools.join(config.getSetting("downloadpath"), nombrefichero)
logger.info("fullpath= %s" % fullpath)
if config.is_xbmc() and fullpath.startswith("special://"):
@@ -161,11 +161,11 @@ def downloadtitle(url, title):
return downloadfile(url, fullpath)
def downloadbest(video_urls, title, continuar=False):
def downloadbest(videoUrls, title, continuar=False):
logger.info()
# Flip it over, to put the highest quality one first (list () is for you to make a copy of)
invertida = list(video_urls)
invertida = list(videoUrls)
invertida.reverse()
for elemento in invertida:
@@ -271,7 +271,7 @@ def downloadfile(url, nombrefichero, headers=None, silent=False, continuar=False
# Create the progress dialog
if not silent:
progreso = platformtools.dialog_progress(header, "Downloading..." + '\n' + url + '\n' + nombrefichero)
progreso = platformtools.dialogProgress(header, "Downloading..." + '\n' + url + '\n' + nombrefichero)
# If the platform does not return a valid dialog box, it assumes silent mode
if progreso is None:
@@ -399,7 +399,7 @@ def downloadfile(url, nombrefichero, headers=None, silent=False, continuar=False
if not silent:
progreso.close()
# platformtools.dialog_ok('Error al descargar' , 'Se ha producido un error' , 'al descargar el archivo')
# platformtools.dialogOk('Error al descargar' , 'Se ha producido un error' , 'al descargar el archivo')
return -2
@@ -408,7 +408,7 @@ def downloadfile(url, nombrefichero, headers=None, silent=False, continuar=False
error = downloadfileRTMP(url, nombrefichero, silent)
if error and not silent:
from platformcode import platformtools
platformtools.dialog_ok("You cannot download that video "," RTMP downloads not yet supported")
platformtools.dialogOk("You cannot download that video "," RTMP downloads not yet supported")
else:
import traceback
from pprint import pprint
@@ -448,7 +448,7 @@ def downloadfileRTMP(url, nombrefichero, silent):
if not filetools.isfile(rtmpdump_cmd) and not silent:
from platformcode import platformtools
advertencia = platformtools.dialog_ok("Lack " + rtmpdump_cmd, "Check that rtmpdump is installed")
advertencia = platformtools.dialogOk("Lack " + rtmpdump_cmd, "Check that rtmpdump is installed")
return True
valid_rtmpdump_options = ["help", "url", "rtmp", "host", "port", "socks", "protocol", "playpath", "playlist",
@@ -480,7 +480,7 @@ def downloadfileRTMP(url, nombrefichero, silent):
rtmpdump_exit = spawnv(P_NOWAIT, rtmpdump_cmd, rtmpdump_args)
if not silent:
from platformcode import platformtools
advertencia = platformtools.dialog_ok("RTMP download option is experimental", "and the video will download in the background. \n No progress bar will be displayed.")
advertencia = platformtools.dialogOk("RTMP download option is experimental", "and the video will download in the background. \n No progress bar will be displayed.")
except:
return True
@@ -520,7 +520,7 @@ def downloadfileGzipped(url, pathfichero):
# Create the progress dialog
from platformcode import platformtools
progreso = platformtools.dialog_progress("addon", config.get_localized_string(60200) + '\n' + url.split("|")[0] + '\n' + nombrefichero)
progreso = platformtools.dialogProgress("addon", config.getLocalizedString(60200) + '\n' + url.split("|")[0] + '\n' + nombrefichero)
# Socket timeout at 60 seconds
socket.setdefaulttimeout(10)
@@ -662,7 +662,7 @@ def downloadfileGzipped(url, pathfichero):
def GetTitleFromFile(title):
# Print in the log what you will discard
logger.info("title= " + title)
plataforma = config.get_system_platform()
plataforma = config.getSystemPlatform()
logger.info("plataform= " + plataforma)
# nombrefichero = xbmc.makeLegalFilename(title + url[-4:])
@@ -852,14 +852,14 @@ def download_all_episodes(item, channel, first_episode="", preferred_server="vid
video_item = video_items[0]
# Check that it is available
video_urls, puedes, motivo = servertools.resolve_video_urls_for_playing(video_item.server, video_item.url, video_password="", muestra_dialogo=False)
videoUrls, puedes, motivo = servertools.resolve_videoUrls_for_playing(video_item.server, video_item.url, video_password="", muestra_dialogo=False)
# Adds it to the download list
if puedes:
logger.info("downloading mirror started...")
# The highest quality video is the latest
# mediaurl = video_urls[len(video_urls) - 1][1]
devuelve = downloadbest(video_urls, show_title + " " + episode_title + " " + idioma +
# mediaUrl = videoUrls[len(videoUrls) - 1][1]
devuelve = downloadbest(videoUrls, show_title + " " + episode_title + " " + idioma +
" [" + video_item.server + "]", continuar=False)
if devuelve == 0:
@@ -869,7 +869,7 @@ def download_all_episodes(item, channel, first_episode="", preferred_server="vid
elif devuelve == -1:
try:
from platformcode import platformtools
platformtools.dialog_ok("plugin", "Descarga abortada")
platformtools.dialogOk("plugin", "Descarga abortada")
except:
pass
return
+11 -11
View File
@@ -255,7 +255,7 @@ def file_open(path, mode="r", silent=False, vfs=True):
logger.error("ERROR when opening file: %s, %s" % (path, mode))
if not silent:
logger.error(traceback.format_exc())
platformtools.dialog_notification("Error Opening", path)
platformtools.dialogNotification("Error Opening", path)
return False
@@ -301,7 +301,7 @@ def rename(path, new_name, silent=False, strict=False, vfs=True):
if not result and not strict:
logger.error("ERROR RENAME file: %s. Copying and deleting" % path)
if not silent:
dialogo = platformtools.dialog_progress("Copying file", "")
dialogo = platformtools.dialogProgress("Copying file", "")
result = xbmcvfs.copy(path, dest)
if not result:
return False
@@ -317,7 +317,7 @@ def rename(path, new_name, silent=False, strict=False, vfs=True):
logger.error("ERROR when renaming the file: %s" % path)
if not silent:
logger.error(traceback.format_exc())
platformtools.dialog_notification("Error renaming", path)
platformtools.dialogNotification("Error renaming", path)
return False
else:
return True
@@ -342,7 +342,7 @@ def move(path, dest, silent=False, strict=False, vfs=True):
if not result and not strict:
logger.error("ERROR when MOVING the file: %s. Copying and deleting" % path)
if not silent:
dialogo = platformtools.dialog_progress("Copying file", "")
dialogo = platformtools.dialogProgress("Copying file", "")
result = xbmcvfs.copy(path, dest)
if not result:
return False
@@ -362,7 +362,7 @@ def move(path, dest, silent=False, strict=False, vfs=True):
# mixed In this case the file is copied and then the source file is deleted
else:
if not silent:
dialogo = platformtools.dialog_progress("Copying file", "")
dialogo = platformtools.dialogProgress("Copying file", "")
return copy(path, dest) == True and remove(path) == True
except:
logger.error("ERROR when moving file: %s to %s" % (path, dest))
@@ -390,14 +390,14 @@ def copy(path, dest, silent=False, vfs=True):
path = encode(path)
dest = encode(dest)
if not silent:
dialogo = platformtools.dialog_progress("Copying file", "")
dialogo = platformtools.dialogProgress("Copying file", "")
return bool(xbmcvfs.copy(path, dest))
fo = file_open(path, "rb")
fd = file_open(dest, "wb")
if fo and fd:
if not silent:
dialogo = platformtools.dialog_progress("Copying file", "")
dialogo = platformtools.dialogProgress("Copying file", "")
size = getsize(path)
copiado = 0
while True:
@@ -559,7 +559,7 @@ def remove(path, silent=False, vfs=True):
logger.error("ERROR deleting file: %s" % path)
if not silent:
logger.error(traceback.format_exc())
platformtools.dialog_notification("ERROR deleting file", path)
platformtools.dialogNotification("ERROR deleting file", path)
return False
else:
return True
@@ -599,7 +599,7 @@ def rmdirtree(path, silent=False, vfs=True):
logger.error("ERROR deleting directory: %s" % path)
if not silent:
logger.error(traceback.format_exc())
platformtools.dialog_notification("ERROR deleting directory", path)
platformtools.dialogNotification("ERROR deleting directory", path)
return False
else:
return not exists(path)
@@ -627,7 +627,7 @@ def rmdir(path, silent=False, vfs=True):
logger.error("ERROR deleting directory: %s" % path)
if not silent:
logger.error(traceback.format_exc())
platformtools.dialog_notification("ERROR deleting directory", path)
platformtools.dialogNotification("ERROR deleting directory", path)
return False
else:
return True
@@ -660,7 +660,7 @@ def mkdir(path, silent=False, vfs=True):
logger.error("ERROR when creating directory: %s" % path)
if not silent:
logger.error(traceback.format_exc())
platformtools.dialog_notification("ERROR when creating directory", path)
platformtools.dialogNotification("ERROR when creating directory", path)
return False
else:
return True
+44 -44
View File
@@ -47,10 +47,10 @@ class Filter(object):
def __get_data(self, item, global_filter_lang_id):
dict_filtered_shows = jsontools.get_node_from_file(item.channel, TAG_TVSHOW_FILTER)
dict_filtered_shows = jsontools.getNodeFromFile(item.channel, TAG_TVSHOW_FILTER)
tvshow = item.show.lower().strip()
global_filter_language = config.get_setting(global_filter_lang_id, item.channel)
global_filter_language = config.getSetting(global_filter_lang_id, item.channel)
if tvshow in list(dict_filtered_shows.keys()):
@@ -86,7 +86,7 @@ def access():
"""
allow = False
if config.is_xbmc() or config.get_platform() == "mediaserver":
if config.is_xbmc() or config.getXBMCPlatform() == "mediaserver":
allow = True
return allow
@@ -119,7 +119,7 @@ def context(item, list_language=None, list_quality=None, exist=False):
_context = []
if access():
dict_data = {"title": config.get_localized_string(60426), "action": "config_item", "channel": "filtertools"}
dict_data = {"title": config.getLocalizedString(60426), "action": "config_item", "channel": "filtertools"}
if list_language:
dict_data["list_language"] = list_language
if list_quality:
@@ -138,10 +138,10 @@ def context(item, list_language=None, list_quality=None, exist=False):
if item.action == "play":
if not exist:
_context.append({"title": config.get_localized_string(60427) % item.language, "action": "save_from_context",
_context.append({"title": config.getLocalizedString(60427) % item.language, "action": "save_from_context",
"channel": "filtertools", "from_channel": item.channel})
else:
_context.append({"title": config.get_localized_string(60428) % item.language, "action": "delete_from_context",
_context.append({"title": config.getLocalizedString(60428) % item.language, "action": "delete_from_context",
"channel": "filtertools", "from_channel": item.channel})
return _context
@@ -149,7 +149,7 @@ def context(item, list_language=None, list_quality=None, exist=False):
def show_option(itemlist, channel, list_language, list_quality):
if access():
itemlist.append(Item(channel=__channel__, title=config.get_localized_string(60429) % COLOR.get("parent_item", "auto"), action="load",
itemlist.append(Item(channel=__channel__, title=config.getLocalizedString(60429) % COLOR.get("parent_item", "auto"), action="load",
list_language=list_language, list_quality=list_quality, from_channel=channel))
return itemlist
@@ -286,7 +286,7 @@ def get_links(list_item, item, list_language, list_quality=None, global_filter_l
return list_item
second_lang = config.get_setting('second_language')
second_lang = config.getSetting('second_language')
logger.debug("total de items : %s" % len(list_item))
@@ -326,7 +326,7 @@ def get_links(list_item, item, list_language, list_quality=None, global_filter_l
for i in list_item:
list_item_all.append(i.tourl())
_context = [{"title": config.get_localized_string(60430) % _filter.language, "action": "delete_from_context", "channel": "filtertools", "to_channel": item.channel}]
_context = [{"title": config.getLocalizedString(60430) % _filter.language, "action": "delete_from_context", "channel": "filtertools", "to_channel": item.channel}]
if _filter.quality_allowed:
msg_quality_allowed = " y calidad %s" % _filter.quality_allowed
@@ -339,7 +339,7 @@ def get_links(list_item, item, list_language, list_quality=None, global_filter_l
new_itemlist.append(Item(channel=__channel__, action="no_filter", list_item_all=list_item_all,
show=item.show,
title=config.get_localized_string(60432) % (_filter.language, msg_quality_allowed),
title=config.getLocalizedString(60432) % (_filter.language, msg_quality_allowed),
context=_context))
else:
@@ -386,7 +386,7 @@ def mainlist(channel, list_language, list_quality):
"""
logger.debug()
itemlist = []
dict_series = jsontools.get_node_from_file(channel, TAG_TVSHOW_FILTER)
dict_series = jsontools.getNodeFromFile(channel, TAG_TVSHOW_FILTER)
idx = 0
for tvshow in sorted(dict_series):
@@ -404,16 +404,16 @@ def mainlist(channel, list_language, list_quality):
idx += 1
name = dict_series.get(tvshow, {}).get(TAG_NAME, tvshow)
activo = config.get_localized_string(60433)
activo = config.getLocalizedString(60433)
if dict_series[tvshow][TAG_ACTIVE]:
activo = ""
title = config.get_localized_string(60434) % (tag_color, name, activo)
title = config.getLocalizedString(60434) % (tag_color, name, activo)
itemlist.append(Item(channel=__channel__, action="config_item", title=title, show=name,
list_language=list_language, list_quality=list_quality, from_channel=channel))
if len(itemlist) == 0:
itemlist.append(Item(channel=channel, action="mainlist", title=config.get_localized_string(60435)))
itemlist.append(Item(channel=channel, action="mainlist", title=config.getLocalizedString(60435)))
return itemlist
@@ -429,7 +429,7 @@ def config_item(item):
logger.debug("item %s" % item.tostring())
# WE GET THE JSON DATA
dict_series = jsontools.get_node_from_file(item.from_channel, TAG_TVSHOW_FILTER)
dict_series = jsontools.getNodeFromFile(item.from_channel, TAG_TVSHOW_FILTER)
tvshow = item.show.lower().strip()
default_lang = ''
@@ -443,7 +443,7 @@ def config_item(item):
pass
if default_lang == '':
platformtools.dialog_notification("FilterTools", "There are no defined languages")
platformtools.dialogNotification("FilterTools", "There are no defined languages")
return
else:
lang_selected = dict_series.get(tvshow, {}).get(TAG_LANGUAGE, default_lang)
@@ -457,7 +457,7 @@ def config_item(item):
if item.show.lower().strip() in dict_series:
allow_option = True
active = dict_series.get(item.show.lower().strip(), {}).get(TAG_ACTIVE, False)
custom_button = {'label': config.get_localized_string(60437), 'function': 'delete', 'visible': True, 'close': True}
custom_button = {'label': config.getLocalizedString(60437), 'function': 'delete', 'visible': True, 'close': True}
list_controls = []
@@ -465,7 +465,7 @@ def config_item(item):
active_control = {
"id": "active",
"type": "bool",
"label": config.get_localized_string(60438),
"label": config.getLocalizedString(60438),
"color": "",
"default": active,
"enabled": allow_option,
@@ -476,7 +476,7 @@ def config_item(item):
language_option = {
"id": "language",
"type": "list",
"label": config.get_localized_string(60439),
"label": config.getLocalizedString(60439),
# "color": "0xFFee66CC",
"default": item.list_language.index(lang_selected),
"enabled": True,
@@ -509,9 +509,9 @@ def config_item(item):
# we concatenate list_controls with list_controls_quality
list_controls.extend(list_controls_calidad)
title = config.get_localized_string(60441) % (COLOR.get("selected", "auto"), item.show)
title = config.getLocalizedString(60441) % (COLOR.get("selected", "auto"), item.show)
platformtools.show_channel_settings(list_controls=list_controls, callback='save', item=item,
platformtools.showChannelSettings(list_controls=list_controls, callback='save', item=item,
caption=title, custom_button=custom_button)
@@ -519,30 +519,30 @@ def delete(item, dict_values):
logger.debug()
if item:
dict_series = jsontools.get_node_from_file(item.from_channel, TAG_TVSHOW_FILTER)
dict_series = jsontools.getNodeFromFile(item.from_channel, TAG_TVSHOW_FILTER)
tvshow = item.show.strip().lower()
heading = config.get_localized_string(60442)
line1 = config.get_localized_string(60443) % (COLOR.get("selected", "auto"), item.show.strip())
heading = config.getLocalizedString(60442)
line1 = config.getLocalizedString(60443) % (COLOR.get("selected", "auto"), item.show.strip())
if platformtools.dialog_yesno(heading, line1) == 1:
if platformtools.dialogYesNo(heading, line1) == 1:
lang_selected = dict_series.get(tvshow, {}).get(TAG_LANGUAGE, "")
dict_series.pop(tvshow, None)
result, json_data = jsontools.update_node(dict_series, item.from_channel, TAG_TVSHOW_FILTER)
result, json_data = jsontools.updateNode(dict_series, item.from_channel, TAG_TVSHOW_FILTER)
sound = False
if result:
message = config.get_localized_string(60444)
message = config.getLocalizedString(60444)
else:
message = config.get_localized_string(60445)
message = config.getLocalizedString(60445)
sound = True
heading = "%s [%s]" % (item.show.strip(), lang_selected)
platformtools.dialog_notification(heading, message, sound=sound)
platformtools.dialogNotification(heading, message, sound=sound)
if item.action in ["findvideos", "play"]:
platformtools.itemlist_refresh()
platformtools.itemlistRefresh()
def save(item, dict_data_saved):
@@ -561,7 +561,7 @@ def save(item, dict_data_saved):
if item.from_channel == "videolibrary":
item.from_channel = item.contentChannel
dict_series = jsontools.get_node_from_file(item.from_channel, TAG_TVSHOW_FILTER)
dict_series = jsontools.getNodeFromFile(item.from_channel, TAG_TVSHOW_FILTER)
tvshow = item.show.strip().lower()
logger.debug("Data is updated")
@@ -576,20 +576,20 @@ def save(item, dict_data_saved):
TAG_LANGUAGE: lang_selected, TAG_QUALITY_ALLOWED: list_quality}
dict_series[tvshow] = dict_filter
result, json_data = jsontools.update_node(dict_series, item.from_channel, TAG_TVSHOW_FILTER)
result, json_data = jsontools.updateNode(dict_series, item.from_channel, TAG_TVSHOW_FILTER)
sound = False
if result:
message = config.get_localized_string(60446)
message = config.getLocalizedString(60446)
else:
message = config.get_localized_string(70593)
message = config.getLocalizedString(70593)
sound = True
heading = "%s [%s]" % (item.show.strip(), lang_selected)
platformtools.dialog_notification(heading, message, sound=sound)
platformtools.dialogNotification(heading, message, sound=sound)
if item.from_action in ["findvideos", "play"]:
platformtools.itemlist_refresh()
platformtools.itemlistRefresh()
def save_from_context(item):
@@ -601,13 +601,13 @@ def save_from_context(item):
"""
logger.debug()
dict_series = jsontools.get_node_from_file(item.from_channel, TAG_TVSHOW_FILTER)
dict_series = jsontools.getNodeFromFile(item.from_channel, TAG_TVSHOW_FILTER)
tvshow = item.show.strip().lower()
dict_filter = {TAG_NAME: item.show, TAG_ACTIVE: True, TAG_LANGUAGE: item.language, TAG_QUALITY_ALLOWED: []}
dict_series[tvshow] = dict_filter
result, json_data = jsontools.update_node(dict_series, item.from_channel, TAG_TVSHOW_FILTER)
result, json_data = jsontools.updateNode(dict_series, item.from_channel, TAG_TVSHOW_FILTER)
sound = False
if result:
@@ -617,10 +617,10 @@ def save_from_context(item):
sound = True
heading = "%s [%s]" % (item.show.strip(), item.language)
platformtools.dialog_notification(heading, message, sound=sound)
platformtools.dialogNotification(heading, message, sound=sound)
if item.from_action in ["findvideos", "play"]:
platformtools.itemlist_refresh()
platformtools.itemlistRefresh()
def delete_from_context(item):
@@ -636,13 +636,13 @@ def delete_from_context(item):
if item.to_channel != "":
item.from_channel = item.to_channel
dict_series = jsontools.get_node_from_file(item.from_channel, TAG_TVSHOW_FILTER)
dict_series = jsontools.getNodeFromFile(item.from_channel, TAG_TVSHOW_FILTER)
tvshow = item.show.strip().lower()
lang_selected = dict_series.get(tvshow, {}).get(TAG_LANGUAGE, "")
dict_series.pop(tvshow, None)
result, json_data = jsontools.update_node(dict_series, item.from_channel, TAG_TVSHOW_FILTER)
result, json_data = jsontools.updateNode(dict_series, item.from_channel, TAG_TVSHOW_FILTER)
sound = False
if result:
@@ -652,7 +652,7 @@ def delete_from_context(item):
sound = True
heading = "%s [%s]" % (item.show.strip(), lang_selected)
platformtools.dialog_notification(heading, message, sound=sound)
platformtools.dialogNotification(heading, message, sound=sound)
if item.from_action in ["findvideos", "play", "no_filter"]: # 'no_filter' es el mismo caso que L#601
platformtools.itemlist_refresh()
platformtools.itemlistRefresh()
+9 -9
View File
@@ -21,16 +21,16 @@ from core import scrapertools
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# Get the addon version
__version = config.get_addon_version()
__version = config.getAddonVersion()
cookies_lock = Lock()
cj = cookielib.MozillaCookieJar()
cookies_file = os.path.join(config.get_data_path(), "cookies.dat")
cookies_file = os.path.join(config.getDataPath(), "cookies.dat")
# Headers by default, if nothing is specified
default_headers = dict()
default_headers["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36" % config.get_setting("chrome_ua_version")
default_headers["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36" % config.getSetting("chrome_ua_version")
default_headers["Accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
default_headers["Accept-Language"] = "it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3"
default_headers["Accept-Charset"] = "UTF-8"
@@ -52,7 +52,7 @@ directIP = {
}
# Maximum wait time for downloadpage, if nothing is specified
HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT = config.get_setting('httptools_timeout', default=15)
HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT = config.getSetting('httptools_timeout', default=15)
if HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT == 0: HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT = None
# Random use of User-Agents, if nad is not specified
@@ -67,7 +67,7 @@ HTTPTOOLS_DEFAULT_RANDOM_HEADERS = False
# domainCF.extend(otherCF)
# CF_LIST = list()
# CF_LIST_PATH = os.path.join(config.get_data_path(), "CF_Domains.txt")
# CF_LIST_PATH = os.path.join(config.getDataPath(), "CF_Domains.txt")
#
# if os.path.exists(CF_LIST_PATH):
# with open(CF_LIST_PATH, "rb") as CF_File:
@@ -167,7 +167,7 @@ def random_useragent():
import random
UserAgentPath = os.path.join(config.get_runtime_path(), 'tools', 'UserAgent.csv')
UserAgentPath = os.path.join(config.getRuntimePath(), 'tools', 'UserAgent.csv')
if os.path.exists(UserAgentPath):
UserAgentIem = random.choice(list(open(UserAgentPath))).strip()
if UserAgentIem:
@@ -203,7 +203,7 @@ def show_infobox(info_dict):
width = 100
version = '%s: %s' % (config.get_localized_string(20000), __version)
version = '%s: %s' % (config.getLocalizedString(20000), __version)
if config.is_xbmc():
box = box_items_kodi
else:
@@ -292,7 +292,7 @@ def downloadpage(url, **opt):
from lib import requests
session = requests.session()
if config.get_setting('resolver_dns') and not opt.get('use_requests', False):
if config.getSetting('resolver_dns') and not opt.get('use_requests', False):
from core import resolverdns
session.mount('https://', resolverdns.CipherSuiteAdapter(domain))
@@ -454,7 +454,7 @@ def downloadpage(url, **opt):
if not 'api.themoviedb' in url and not opt.get('alfa_s', False):
show_infobox(info_dict)
if not config.get_setting("debug"): logger.info('Page URL:',url)
if not config.getSetting("debug"): logger.info('Page URL:',url)
return type('HTTPResponse', (), response)
def fill_fields_pre(url, opt, proxy_data, file_name):
+4 -4
View File
@@ -58,7 +58,7 @@ def to_utf8(dct):
return dct
def get_node_from_file(name_file, node, path=None):
def getNodeFromFile(name_file, node, path=None):
"""
Gets the node of a JSON file
@@ -80,7 +80,7 @@ def get_node_from_file(name_file, node, path=None):
name_file += "_data.json"
if not path:
path = filetools.join(config.get_data_path(), "settings_channels")
path = filetools.join(config.getDataPath(), "settings_channels")
fname = filetools.join(path, name_file)
@@ -126,7 +126,7 @@ def check_to_backup(data, fname, dict_data):
logger.debug("The file is empty: %s" % fname)
def update_node(dict_node, name_file, node, path=None, silent=False):
def updateNode(dict_node, name_file, node, path=None, silent=False):
"""
update the json_data of a file with the last dictionary
@@ -152,7 +152,7 @@ def update_node(dict_node, name_file, node, path=None, silent=False):
name_file += "_data.json"
if not path:
path = filetools.join(config.get_data_path(), "settings_channels")
path = filetools.join(config.getDataPath(), "settings_channels")
fname = filetools.join(path, name_file)
+1 -1
View File
@@ -127,7 +127,7 @@ class CipherSuiteAdapter(host_header_ssl.HostHeaderSSLAdapter):
logger.info(e)
# if 'SSLError' in str(e):
# # disabilito
# config.set_setting("resolver_dns", False)
# config.setSetting("resolver_dns", False)
# request.url = realUrl
# ret = super(CipherSuiteAdapter, self).send(request, **kwargs)
# else:
+30 -30
View File
@@ -25,14 +25,14 @@ def find_and_set_infoLabels(item):
scraper = None
# logger.debug("item:\n" + item.tostring('\n'))
list_opciones_cuadro = [config.get_localized_string(60223), config.get_localized_string(60224)]
list_opciones_cuadro = [config.getLocalizedString(60223), config.getLocalizedString(60224)]
# If more scrapers are added, they must be declared here-> "modulo_scraper": "Text_in_box"
scrapers_disponibles = {'tmdb': config.get_localized_string(60225), 'tvdb': config.get_localized_string(60226)}
scrapers_disponibles = {'tmdb': config.getLocalizedString(60225), 'tvdb': config.getLocalizedString(60226)}
# Get the default Scraper of the configuration according to the content type
if item.contentType == "movie":
scraper_actual = 'tmdb'
# scraper_actual = ['tmdb'][config.get_setting("scraper_movies", "videolibrary")]
# scraper_actual = ['tmdb'][config.getSetting("scraper_movies", "videolibrary")]
tipo_contenido = "movie"
title = item.contentTitle
# Complete list of options for this type of content
@@ -40,7 +40,7 @@ def find_and_set_infoLabels(item):
else:
scraper_actual = 'tmdb'
# scraper_actual = ['tmdb', 'tvdb'][config.get_setting("scraper_tvshows", "videolibrary")]
# scraper_actual = ['tmdb', 'tvdb'][config.getSetting("scraper_tvshows", "videolibrary")]
tipo_contenido = "serie"
title = item.contentSerieName
# Complete list of options for this type of content
@@ -68,14 +68,14 @@ def find_and_set_infoLabels(item):
return True
elif scraper_result:
# Content found but no 'code'
msg = config.get_localized_string(60227) % title
msg = config.getLocalizedString(60227) % title
else:
# Content not found
msg = config.get_localized_string(60228) % title
msg = config.getLocalizedString(60228) % title
logger.debug(msg)
# Show box with other options:
item = platformtools.dialog_info(item, scraper_actual)
item = platformtools.dialogInfo(item, scraper_actual)
if item.exit:
logger.debug("You have clicked 'cancel' in the window '%s'" % msg)
return False
@@ -91,19 +91,19 @@ def find_and_set_infoLabels(item):
# COLOR = ["0xFF65B3DA", "0xFFFFFFFF"]
# # We create the list of infoLabel fields
# controls = [("title", "text", config.get_localized_string(60230)),
# ("originaltitle", "text", config.get_localized_string(60231)),
# ("year", "text", config.get_localized_string(60232)),
# ("identificadores", "label", config.get_localized_string(60233)),
# ("tmdb_id", "text", config.get_localized_string(60234)),
# ("url_tmdb", "text", config.get_localized_string(60235), "+!eq(-1,'')"),
# ("tvdb_id", "text", config.get_localized_string(60236), "+eq(-7,'Serie')"),
# ("url_tvdb", "text", config.get_localized_string(60237), "+!eq(-1,'')+eq(-8,'Serie')"),
# ("imdb_id", "text", config.get_localized_string(60238)),
# ("otro_id", "text", config.get_localized_string(60239), "+eq(-1,'')"),
# ("urls", "label", config.get_localized_string(60240)),
# ("fanart", "text", config.get_localized_string(60241)),
# ("thumbnail", "text", config.get_localized_string(60242))]
# controls = [("title", "text", config.getLocalizedString(60230)),
# ("originaltitle", "text", config.getLocalizedString(60231)),
# ("year", "text", config.getLocalizedString(60232)),
# ("identificadores", "label", config.getLocalizedString(60233)),
# ("tmdb_id", "text", config.getLocalizedString(60234)),
# ("url_tmdb", "text", config.getLocalizedString(60235), "+!eq(-1,'')"),
# ("tvdb_id", "text", config.getLocalizedString(60236), "+eq(-7,'Serie')"),
# ("url_tvdb", "text", config.getLocalizedString(60237), "+!eq(-1,'')+eq(-8,'Serie')"),
# ("imdb_id", "text", config.getLocalizedString(60238)),
# ("otro_id", "text", config.getLocalizedString(60239), "+eq(-1,'')"),
# ("urls", "label", config.getLocalizedString(60240)),
# ("fanart", "text", config.getLocalizedString(60241)),
# ("thumbnail", "text", config.getLocalizedString(60242))]
# if item.infoLabels["mediatype"] == "movie":
# mediatype_default = 0
@@ -112,12 +112,12 @@ def find_and_set_infoLabels(item):
# listado_controles = [{'id': "mediatype",
# 'type': "list",
# 'label': config.get_localized_string(60243),
# 'label': config.getLocalizedString(60243),
# 'color': COLOR[1],
# 'default': mediatype_default,
# 'enabled': True,
# 'visible': True,
# 'lvalues': [config.get_localized_string(60244), config.get_localized_string(70136)]
# 'lvalues': [config.getLocalizedString(60244), config.getLocalizedString(70136)]
# }]
# for i, c in enumerate(controls):
@@ -154,7 +154,7 @@ def find_and_set_infoLabels(item):
# 'visible': True})
# # logger.debug(dict_default)
# if platformtools.show_channel_settings(list_controls=listado_controles, caption=config.get_localized_string(60246), item=item,
# if platformtools.showChannelSettings(list_controls=listado_controles, caption=config.getLocalizedString(60246), item=item,
# callback="core.scraper.callback_cuadro_completar",
# custom_button={"visible": False}):
# return True
@@ -225,16 +225,16 @@ def get_nfo(item, search_groups=False):
return info_nfo
else:
try: return scraper.get_nfo(item)
except:
if item.contentType == "movie": scraper_actual = ['tmdb'][config.get_setting("scraper_movies", "videolibrary")]
else: scraper_actual = ['tmdb', 'tvdb'][config.get_setting("scraper_tvshows", "videolibrary")]
scraper = __import__('core.%s' % scraper_actual, fromlist=["core.%s" % scraper_actual])
return scraper.get_nfo(item, search_groups)
# try: return scraper.get_nfo(item)
# except:
# if item.contentType == "movie": scraper_actual = ['tmdb'][config.getSetting("scraper_movies", "videolibrary")]
# else: scraper_actual = ['tmdb', 'tvdb'][config.getSetting("scraper_tvshows", "videolibrary")]
scraper = __import__('core.tmdb', fromlist=["core.tmdb" ])
return scraper.get_nfo(item, search_groups)
def sort_episode_list(episodelist):
scraper_actual = ['tmdb', 'tvdb'][config.get_setting("scraper_tvshows", "videolibrary")]
scraper_actual = ['tmdb', 'tvdb'][config.getSetting("scraper_tvshows", "videolibrary")]
if scraper_actual == "tmdb":
episodelist.sort(key=lambda e: (int(e.contentSeason), int(e.contentEpisodeNumber)))
+2 -2
View File
@@ -59,11 +59,11 @@ def find_single_match(data, patron, index=0):
# Parse string and extracts multiple matches using regular expressions
def find_multiple_matches(text, pattern):
def findMultipleMatches(text, pattern):
return re.findall(pattern, text, re.DOTALL)
def find_multiple_matches_groups(text, pattern):
def findMultipleMatches_groups(text, pattern):
r = re.compile(pattern)
return [m.groupdict() for m in r.finditer(text)]
+51 -51
View File
@@ -223,7 +223,7 @@ def get_server_from_url(url):
return None
def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialogo=False, background_dialog=False):
def resolve_videoUrls_for_playing(server, url, video_password="", muestra_dialogo=False, background_dialog=False):
"""
Function to get the real url of the video
@param server: Server where the video is hosted
@@ -244,7 +244,7 @@ def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialo
server = server.lower()
video_urls = []
videoUrls = []
video_exists = True
error_messages = []
opciones = []
@@ -254,7 +254,7 @@ def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialo
if isinstance(video_password, list):
return video_password, len(video_password) > 0, "<br/>".join(error_messages)
logger.info("Server: %s, url is good" % server)
video_urls.append({'type':urlparse.urlparse(url)[2].split('.')[-1], 'url':url})
videoUrls.append({'type':urlparse.urlparse(url)[2].split('.')[-1], 'url':url})
# Find out the video URL
else:
@@ -266,7 +266,7 @@ def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialo
if server_parameters:
# Show a progress dialog
if muestra_dialogo:
progreso = (platformtools.dialog_progress_bg if background_dialog else platformtools.dialog_progress)(config.get_localized_string(20000), config.get_localized_string(70180) % translate_server_name(server_parameters["name"]))
progreso = (platformtools.dialogProgressBg if background_dialog else platformtools.dialogProgress)(config.getLocalizedString(20000), config.getLocalizedString(70180) % translate_server_name(server_parameters["name"]))
# Count the available options, to calculate the percentage
@@ -279,15 +279,15 @@ def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialo
if server_parameters["free"] == True:
opciones.append("free")
opciones.extend(
[premium for premium in server_parameters["premium"] if config.get_setting("premium", server=premium)])
[premium for premium in server_parameters["premium"] if config.getSetting("premium", server=premium)])
priority = int(config.get_setting("resolve_priority"))
priority = int(config.getSetting("resolve_priority"))
opciones = sorted(opciones, key=lambda x: order[priority].index(x))
logger.info("Available options: %s | %s" % (len(opciones), opciones))
else:
logger.error("There is no connector for the server %s" % server)
error_messages.append(config.get_localized_string(60004) % server)
error_messages.append(config.getLocalizedString(60004) % server)
muestra_dialogo = False
# Import the server
@@ -336,60 +336,60 @@ def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialo
# Show progress
if muestra_dialogo:
progreso.update((old_div(100, len(opciones))) * opciones.index(opcion), config.get_localized_string(70180) % server_name)
progreso.update((old_div(100, len(opciones))) * opciones.index(opcion), config.getLocalizedString(70180) % server_name)
# Free mode
if opcion == "free":
try:
logger.info("Invoking a %s.get_video_url" % server)
response = serverid.get_video_url(page_url=url, video_password=video_password)
video_urls.extend(response)
logger.info("Invoking a %s.get_videoUrl" % server)
response = serverid.get_videoUrl(page_url=url, video_password=video_password)
videoUrls.extend(response)
except:
logger.error("Error getting url in free mode")
error_messages.append(config.get_localized_string(60014))
error_messages.append(config.getLocalizedString(60014))
import traceback
logger.error(traceback.format_exc())
# Premium mode
else:
try:
logger.info("Invoking a %s.get_video_url" % opcion)
response = serverid.get_video_url(page_url=url, premium=True,
user=config.get_setting("user", server=opcion),
password=config.get_setting("password", server=opcion),
logger.info("Invoking a %s.get_videoUrl" % opcion)
response = serverid.get_videoUrl(page_url=url, premium=True,
user=config.getSetting("user", server=opcion),
password=config.getSetting("password", server=opcion),
video_password=video_password)
if response and response[0][1]:
video_urls.extend(response)
videoUrls.extend(response)
elif response and response[0][0]:
error_messages.append(response[0][0])
else:
error_messages.append(config.get_localized_string(60014))
error_messages.append(config.getLocalizedString(60014))
except:
logger.error("Server errorr: %s" % opcion)
error_messages.append(config.get_localized_string(60014))
error_messages.append(config.getLocalizedString(60014))
import traceback
logger.error(traceback.format_exc())
# If we already have URLS, we stop searching
if video_urls and config.get_setting("resolve_stop") == True:
if videoUrls and config.getSetting("resolve_stop") == True:
break
# We close progress
if muestra_dialogo:
progreso.update(100, config.get_localized_string(60008))
progreso.update(100, config.getLocalizedString(60008))
progreso.close()
# If there are no options available, we show the notice of premium accounts
if video_exists and not opciones and server_parameters.get("premium"):
listapremium = [get_server_parameters(premium)["name"] for premium in server_parameters["premium"]]
error_messages.append(
config.get_localized_string(60009) % (server, " o ".join(listapremium)))
config.getLocalizedString(60009) % (server, " o ".join(listapremium)))
# If we do not have urls or error messages, we put a generic one
elif not video_urls and not error_messages:
error_messages.append(config.get_localized_string(60014))
elif not videoUrls and not error_messages:
error_messages.append(config.getLocalizedString(60014))
return video_urls, len(video_urls) > 0, "<br/>".join(error_messages)
return videoUrls, len(videoUrls) > 0, "<br/>".join(error_messages)
def get_server_name(serverid):
@@ -444,11 +444,11 @@ def is_server_enabled(server):
server_parameters = get_server_parameters(server)
if server_parameters["active"] == True:
if not config.get_setting("hidepremium"):
if not config.getSetting("hidepremium"):
return True
elif server_parameters["free"] == True:
return True
elif [premium for premium in server_parameters["premium"] if config.get_setting("premium", server=premium)]:
elif [premium for premium in server_parameters["premium"] if config.getSetting("premium", server=premium)]:
return True
return False
@@ -473,12 +473,12 @@ def get_server_parameters(server):
try:
path = ''
# Servers
if filetools.isfile(filetools.join(config.get_runtime_path(), "servers", server + ".json")):
path = filetools.join(config.get_runtime_path(), "servers", server + ".json")
if filetools.isfile(filetools.join(config.getRuntimePath(), "servers", server + ".json")):
path = filetools.join(config.getRuntimePath(), "servers", server + ".json")
# Debriders
elif filetools.isfile(filetools.join(config.get_runtime_path(), "servers", "debriders", server + ".json")):
path = filetools.join(config.get_runtime_path(), "servers", "debriders", server + ".json")
elif filetools.isfile(filetools.join(config.getRuntimePath(), "servers", "debriders", server + ".json")):
path = filetools.join(config.getRuntimePath(), "servers", "debriders", server + ".json")
# When the server is not well defined in the channel (there is no connector), it shows an error because there is no "path" and the channel has to be checked
dict_server = jsontools.load(filetools.read(path))
@@ -487,7 +487,7 @@ def get_server_parameters(server):
# Images: url and local files are allowed inside "resources / images"
if dict_server.get("thumbnail") and "://" not in dict_server["thumbnail"]:
dict_server["thumbnail"] = filetools.join(config.get_runtime_path(), "resources", "media",
dict_server["thumbnail"] = filetools.join(config.getRuntimePath(), "resources", "media",
"servers", dict_server["thumbnail"])
for k in ['premium', 'id']:
dict_server[k] = dict_server.get(k, list())
@@ -507,7 +507,7 @@ def get_server_parameters(server):
dict_servers_parameters[server] = dict_server
except:
mensaje = config.get_localized_string(59986) % server
mensaje = config.getLocalizedString(59986) % server
import traceback
logger.error(mensaje + traceback.format_exc())
return {}
@@ -539,7 +539,7 @@ def get_server_controls_settings(server_name):
return list_controls, dict_settings
def get_server_setting(name, server, default=None):
def getServerSetting(name, server, default=None):
"""
Returns the configuration value of the requested parameter.
@@ -563,10 +563,10 @@ def get_server_setting(name, server, default=None):
"""
# We create the folder if it does not exist
if not filetools.exists(filetools.join(config.get_data_path(), "settings_servers")):
filetools.mkdir(filetools.join(config.get_data_path(), "settings_servers"))
if not filetools.exists(filetools.join(config.getDataPath(), "settings_servers")):
filetools.mkdir(filetools.join(config.getDataPath(), "settings_servers"))
file_settings = filetools.join(config.get_data_path(), "settings_servers", server + "_data.json")
file_settings = filetools.join(config.getDataPath(), "settings_servers", server + "_data.json")
dict_settings = {}
dict_file = {}
if filetools.exists(file_settings):
@@ -596,12 +596,12 @@ def get_server_setting(name, server, default=None):
return dict_settings.get(name, default)
def set_server_setting(name, value, server):
def setServerSetting(name, value, server):
# We create the folder if it does not exist
if not filetools.exists(filetools.join(config.get_data_path(), "settings_servers")):
filetools.mkdir(filetools.join(config.get_data_path(), "settings_servers"))
if not filetools.exists(filetools.join(config.getDataPath(), "settings_servers")):
filetools.mkdir(filetools.join(config.getDataPath(), "settings_servers"))
file_settings = filetools.join(config.get_data_path(), "settings_servers", server + "_data.json")
file_settings = filetools.join(config.getDataPath(), "settings_servers", server + "_data.json")
dict_settings = {}
dict_file = None
@@ -639,7 +639,7 @@ def get_servers_list():
"""
global server_list
if not server_list:
for server in filetools.listdir(filetools.join(config.get_runtime_path(), "servers")):
for server in filetools.listdir(filetools.join(config.getRuntimePath(), "servers")):
if server.endswith(".json") and not server == "version.json":
server_parameters = get_server_parameters(server)
if server_parameters['active']:
@@ -657,7 +657,7 @@ def get_debriders_list():
@rtype: dict
"""
server_list = {}
for server in filetools.listdir(filetools.join(config.get_runtime_path(), "servers", "debriders")):
for server in filetools.listdir(filetools.join(config.getRuntimePath(), "servers", "debriders")):
if server.endswith(".json"):
server_parameters = get_server_parameters(server)
if server_parameters["active"] == True:
@@ -682,13 +682,13 @@ def sort_servers(servers_list):
if not servers_list:
return []
blacklisted_servers = config.get_setting("black_list", server='servers', default=[])
favorite_servers = [s for s in config.get_setting('favorites_servers_list', server='servers', default=[]) if s not in blacklisted_servers]
blacklisted_servers = config.getSetting("black_list", server='servers', default=[])
favorite_servers = [s for s in config.getSetting('favorites_servers_list', server='servers', default=[]) if s not in blacklisted_servers]
sorted_list = []
inverted = False
if config.get_setting('default_action') == 2:
if config.getSetting('default_action') == 2:
inverted = True
# Priorities when ordering itemlist:
@@ -697,8 +697,8 @@ def sort_servers(servers_list):
# 2: Qualities and Servers
priority = 0
if config.get_setting('favorites_servers') and favorite_servers: priority = 1
if config.get_setting('quality_priority'): priority = 2
if config.getSetting('favorites_servers') and favorite_servers: priority = 1
if config.getSetting('quality_priority'): priority = 2
for item in servers_list:
element = dict()
@@ -802,16 +802,16 @@ def check_video_link(item, timeout=3):
def translate_server_name(name):
if '@' in name: return config.get_localized_string(int(name.replace('@','')))
if '@' in name: return config.getLocalizedString(int(name.replace('@','')))
else: return name
# def get_server_json(server_name):
# # logger.info("server_name=" + server_name)
# try:
# server_path = filetools.join(config.get_runtime_path(), "servers", server_name + ".json")
# server_path = filetools.join(config.getRuntimePath(), "servers", server_name + ".json")
# if not filetools.exists(server_path):
# server_path = filetools.join(config.get_runtime_path(), "servers", "debriders", server_name + ".json")
# server_path = filetools.join(config.getRuntimePath(), "servers", "debriders", server_name + ".json")
#
# # logger.info("server_path=" + server_path)
# server_json = jsontools.load(filetools.read(server_path))
+90 -91
View File
@@ -174,7 +174,7 @@ class scrape:
scrapingTime = time()
if self.patronBlock:
if self.debugBlock: regexDbg(item, self.patronBlock, self.headers, self.data)
blocks = scrapertools.find_multiple_matches_groups(self.data, self.patronBlock)
blocks = scrapertools.findMultipleMatches_groups(self.data, self.patronBlock)
for bl in blocks:self._scrapeBlock(item, bl)
elif self.patron:
@@ -226,10 +226,6 @@ class scrape:
self.itemlist = newFunc()
self.itemlist = [i for i in self.itemlist if i.action not in ['add_movie_to_library', 'add_serie_to_library']]
if not self.group and not self.args.get('groupExplode') and ((self.pagination and len(self.matches) <= self.pag * self.pagination) or not self.pagination): # next page with pagination
if self.patronNext and not stackCheck('newest') and not stackCheck('get_channel_results'):
nextPage(self.itemlist, item, self.function, data=self.data, patron=self.patronNext, patron_total_pages=self.patronTotalPages)
if self.numerationEnabled and not stackCheck('find_episodes'):
from platformcode import autorenumber
if self.function == 'episodes':
@@ -251,9 +247,13 @@ class scrape:
if self.tmdbEnabled and (
self.action != 'play' and 'patronMenu' not in self.args and 'patronGenreMenu' not in self.args
and not stackCheck(['add_tvshow', 'get_newest']) and (self.function not in ['episodes', 'mainlist']
or (self.function in ['episodes'] and config.get_setting('episode_info')))):
or (self.function in ['episodes'] and config.getSetting('episode_info')))):
tmdb.set_infoLabels_itemlist(self.itemlist, seekTmdb=True)
if not self.group and not self.args.get('groupExplode') and ((self.pagination and len(self.matches) <= self.pag * self.pagination) or not self.pagination): # next page with pagination
if self.patronNext and not stackCheck('newest') and not stackCheck('get_channel_results'):
nextPage(self.itemlist, item, self.function, data=self.data, patron=self.patronNext, patron_total_pages=self.patronTotalPages)
if not stackCheck(['find_episodes', 'add_tvshow']):
if self.videlibraryEnabled and (item.infoLabels["title"] or item.fulltitle):
@@ -274,7 +274,7 @@ class scrape:
raise logger.ChannelScraperException
if config.get_setting('trakt_sync'):
if config.getSetting('trakt_sync'):
from core import trakt_tools
trakt_tools.trakt_check(self.itemlist)
logger.debug(item.channel, 'scraping time:', time()-scrapingTime)
@@ -292,7 +292,7 @@ class scrape:
if self.debug:
regexDbg(item, self.patron, self.headers, block)
matches = scrapertools.find_multiple_matches_groups(block, self.patron)
matches = scrapertools.findMultipleMatches_groups(block, self.patron)
logger.debug('MATCHES =', matches)
for match in matches:
@@ -320,7 +320,7 @@ class scrape:
self.itemParams._plot = cleantitle(self.itemParams._plot)
self.itemParams._language = scrapeLang(self.itemParams, self.lang)
self.set_infolabels(item)
self.setInfolabels(item)
if self.sceneTitle: self.set_sceneTitle()
if not self.group or item.grouped:
@@ -330,13 +330,13 @@ class scrape:
if self.itemParams._season: self.itemParams.infoLabels['season'] = int(self.itemParams._season)
if self.itemParams._episode: self.itemParams.infoLabels['episode'] = int(self.itemParams._episode)
it = self.set_item(item, match)
it = self.setItem(item, match)
if it: itemlist.append(it)
self.itemlist.extend(itemlist)
self.matches.extend(matches)
def set_infolabels(self, item):
def setInfolabels(self, item):
if item.infoLabels["title"]:
infolabels = item.infoLabels
else:
@@ -349,7 +349,7 @@ class scrape:
if self.itemParams._plot:
infolabels['plot'] = self.itemParams._plot
if self.itemParams._duration:
dur = scrapertools.find_multiple_matches(self.itemParams._duration, r'([0-9])\s*?(?:[hH]|:|\.|,|\\|\/|\||\s)\s*?([0-9]+)')
dur = scrapertools.findMultipleMatches(self.itemParams._duration, r'([0-9])\s*?(?:[hH]|:|\.|,|\\|\/|\||\s)\s*?([0-9]+)')
for h, m in dur:
self.itemParams._duration = int(h) * 60 + int(m)
if not dur:
@@ -359,7 +359,7 @@ class scrape:
except:
self.itemParams._duration = ''
if self.itemParams._genre:
genres = scrapertools.find_multiple_matches(self.itemParams._genre, '[A-Za-z]+')
genres = scrapertools.findMultipleMatches(self.itemParams._genre, '[A-Za-z]+')
infolabels['genere'] = ", ".join(genres)
if self.itemParams._rating:
rating = scrapertools.decodeHtmlentities(self.itemParams._rating)
@@ -397,7 +397,7 @@ class scrape:
self.itemParams.infoLabels['episode'] = parsedTitle.get('episode')
elif parsedTitle.get('season') and type(parsedTitle.get('season')) == list:
self.itemParams._extraInfo = '{}: {}-{}'.format(config.get_localized_string(30140), parsedTitle.get('season')[0], parsedTitle.get('season')[-1])
self.itemParams._extraInfo = '{}: {}-{}'.format(config.getLocalizedString(30140), parsedTitle.get('season')[0], parsedTitle.get('season')[-1])
elif parsedTitle.get('season'):
self.itemParams._season = str(parsedTitle.get('season'))
if parsedTitle.get('episode_title'):
@@ -439,7 +439,7 @@ class scrape:
logger.debug('invalid episode: ' + self.itemParams._episode)
pass
def set_item(self, item, match):
def setItem(self, item, match):
AC = ''
CT = ''
if self.typeContentDict:
@@ -485,11 +485,6 @@ class scrape:
else:
it.action=self.action
if it.action == 'findvideos':
platformtools.window_type(it)
# it.window = True if item.window_type == 0 or (config.get_setting("window_type") == 0) else False
if it.window: it.folder = False
for lg in list(set(match.keys()).difference(self.known_keys)):
it.__setattr__(lg, match[lg])
@@ -506,7 +501,7 @@ class scrape:
def regexDbg(item, patron, headers, data=''):
if config.dev_mode():
if config.devMode():
import json, webbrowser
url = 'https://regex101.com'
@@ -608,11 +603,11 @@ def menu(func):
single_search = False
# listUrls = ['film', 'filmSub', 'tvshow', 'tvshowSub', 'anime', 'animeSub', 'search', 'top', 'topSub']
listUrls = ['top', 'film', 'tvshow', 'anime', 'search', 'host']
names = {'film':config.get_localized_string(30122),
'tvshow':config.get_localized_string(30123),
'anime':config.get_localized_string(30124),
'doc':config.get_localized_string(30125),
'music':config.get_localized_string(30139)}
names = {'film':config.getLocalizedString(30122),
'tvshow':config.getLocalizedString(30123),
'anime':config.getLocalizedString(30124),
'doc':config.getLocalizedString(30125),
'music':config.getLocalizedString(30139)}
listUrls_extra = []
dictUrl = {}
@@ -665,7 +660,7 @@ def menu(func):
args=var[2] if len(var) > 2 else '',
contentType= var[3] if len(var) > 3 else 'movie' if name == 'film' else 'tvshow')
# add search menu for category
if 'search' not in args: menuItem(itemlist, channel, config.get_localized_string(70741) % title + '{submenu bold}', 'search', host + url, contentType='movie' if name == 'film' else 'tvshow', style=not global_search)
if 'search' not in args: menuItem(itemlist, channel, config.getLocalizedString(70741) % title + '{submenu bold}', 'search', host + url, contentType='movie' if name == 'film' else 'tvshow', style=not global_search)
# Make EXTRA MENU (on bottom)
for name, var in args.items():
@@ -684,7 +679,7 @@ def menu(func):
contentType= var[3] if len(var) > 3 else 'movie',)
if single_search:
menuItem(itemlist, channel, config.get_localized_string(70741).replace(' %s', '{bold}'), 'search', host + dictUrl['search'], style=not global_search)
menuItem(itemlist, channel, config.getLocalizedString(70741).replace(' %s', '{bold}'), 'search', host + dictUrl['search'], style=not global_search)
if not global_search:
channel_config(item, itemlist)
@@ -788,7 +783,7 @@ def match(item_url_string, **args):
if type(patronBlocks) == str:
patronBlocks = [patronBlocks]
for p in patronBlocks:
blocks += scrapertools.find_multiple_matches(data, p)
blocks += scrapertools.findMultipleMatches(data, p)
else:
blocks = [data]
@@ -798,10 +793,10 @@ def match(item_url_string, **args):
patron = [patron]
for b in blocks:
for p in patron:
matches += scrapertools.find_multiple_matches(b, p)
matches += scrapertools.findMultipleMatches(b, p)
# debug mode
if config.dev_mode():
if config.devMode():
if debugBlock:
match_dbg(data, patronBlock)
if debug:
@@ -884,7 +879,7 @@ def nextPage(itemlist, item, function_or_level=1, **kwargs):
# create Item
if next_page or page:
itemlist.append(item.clone(action = inspect.stack()[function_or_level][3] if type(function_or_level) == int else function_or_level,
title=typo(config.get_localized_string(90006), 'color kod bold'),
title=typo(config.getLocalizedString(90006), 'color kod bold'),
nextPage=True,
page=page if page else item.page + 1 if item.page else 2,
prevthumb = item.thumbnail,
@@ -892,11 +887,12 @@ def nextPage(itemlist, item, function_or_level=1, **kwargs):
thumbnail=thumb()))
itemlist.append(item.clone(action='gotopage',
itemlist.append(item.clone(from_cannel=item.channel,
channel='shortcuts',
action='gotopage',
real_action = inspect.stack()[function_or_level][3] if type(function_or_level) == int else function_or_level,
title=typo(config.get_localized_string(90007), 'color kod bold'),
title=typo(config.getLocalizedString(90007), 'color kod bold'),
nextPage=True,
total_pages = total_pages,
page=page if page else item.page + 1 if item.page else 2,
prevthumb = item.thumbnail,
thumbnail=thumb(),
@@ -910,7 +906,7 @@ def pagination(itemlist, item, function_level=1):
if not item.page:
item.page = 1
perpage = config.get_setting('pagination', default=20)
perpage = config.getSetting('pagination', default=20)
action = function_level if type(function_level) == str else inspect.stack()[function_level][3]
itlist = []
for i, it in enumerate(itemlist):
@@ -924,7 +920,7 @@ def pagination(itemlist, item, function_level=1):
Item(channel=item.channel,
contentType=item.contentType,
action=action,
title=typo(config.get_localized_string(90006), 'color kod bold'),
title=typo(config.getLocalizedString(90006), 'color kod bold'),
page=item.page + 1,
total_pages=round(len(itemlist)/perpage),
nextPage = True,
@@ -933,18 +929,19 @@ def pagination(itemlist, item, function_level=1):
thumbnail=thumb()))
if len(itemlist) > perpage:
itlist.append(
Item(channel=item.channel,
contentType=item.contentType,
action='gotopage',
real_action=action,
title=typo(config.get_localized_string(90007), 'color kod bold'),
page=item.page + 1,
total_pages=round(len(itemlist)/perpage),
nextPage = True,
itemlist = True,
prevthumb = item.thumbnail,
thumbnail=thumb(),
folder = False))
Item(from_cannel=item.channel,
channel='shortcuts',
contentType=item.contentType,
action='gotopage',
real_action=action,
title=typo(config.getLocalizedString(90007), 'color kod bold'),
page=item.page + 1,
total_pages=round(len(itemlist)/perpage),
nextPage = True,
itemlist = True,
prevthumb = item.thumbnail,
thumbnail=thumb(),
folder = False))
return itlist
@@ -981,17 +978,18 @@ def season_pagination(itemlist, item, seasons=[], function_level=1):
itlist.append(
Item(channel=item.channel,
action=action,
title=typo(config.get_localized_string(90008), 'color kod bold'),
title=typo(config.getLocalizedString(90008), 'color kod bold'),
allSeasons = seasons,
nextSeason = item.nextSeason + 1,
itemlist = True,
prevthumb = item.thumbnail,
thumbnail=thumb()))
itlist.append(
Item(channel=item.channel,
Item(from_cannel=item.channel,
channel='shortcuts',
action='gotoseason',
real_action=action,
title=typo(config.get_localized_string(90009), 'color kod bold'),
title=typo(config.getLocalizedString(90009), 'color kod bold'),
allSeasons = seasons,
nextSeason = item.nextSeason + 1,
itemlist = True,
@@ -1021,14 +1019,14 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
verifiedItemlist = []
def getItem(videoitem):
if not videoitem.video_urls:
if not videoitem.videoUrls:
srv_param = servertools.get_server_parameters(videoitem.server.lower())
if not srv_param: # do not exists or it's empty
findS = servertools.get_server_from_url(videoitem.url)
logger.debug(findS)
if not findS:
if item.channel == 'community':
findS= (config.get_localized_string(30137), videoitem.url, 'directo')
findS= (config.getLocalizedString(30137), videoitem.url, 'directo')
else:
videoitem.url = unshortenit.unshorten_only(videoitem.url)[0]
findS = servertools.get_server_from_url(videoitem.url)
@@ -1042,12 +1040,12 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
else:
videoitem.server = videoitem.server.lower()
if videoitem.video_urls or srv_param.get('active', False):
if videoitem.videoUrls or srv_param.get('active', False):
vi = item.clone(server=videoitem.server,
serverName=videoitem.serverName,
url=videoitem.url,
video_urls= videoitem.video_urlsn,
videoUrls= videoitem.videoUrlsn,
ch_name=channeltools.get_channel_parameters(item.channel)['title'],
action = "play")
@@ -1069,7 +1067,7 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
# videoitem.fulltitle = item.fulltitle
# videoitem.show = item.show
# videoitem.ch_name = channeltools.get_channel_parameters(item.channel)['title']
# if not videoitem.video_urls: videoitem.thumbnail = item.thumbnail
# if not videoitem.videoUrls: videoitem.thumbnail = item.thumbnail
# videoitem.contentType = item.contentType
# videoitem.infoLabels = item.infoLabels
# videoitem.quality = quality
@@ -1082,13 +1080,13 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
# non threaded for webpdb
# dbg()
thL = [getItem(videoitem) for videoitem in itemlist if videoitem.url or videoitem.video_urls]
thL = [getItem(videoitem) for videoitem in itemlist if videoitem.url or videoitem.videoUrls]
for it in thL:
if it and not config.get_setting("black_list", server=it.server.lower()):
if it and not config.getSetting("black_list", server=it.server.lower()):
verifiedItemlist.append(it)
# with futures.ThreadPoolExecutor() as executor:
# thL = [executor.submit(getItem, videoitem) for videoitem in itemlist if videoitem.url or videoitem.video_urls]
# thL = [executor.submit(getItem, videoitem) for videoitem in itemlist if videoitem.url or videoitem.videoUrls]
# for it in futures.as_completed(thL):
# if it.result():
# verifiedItemlist.append(it.result())
@@ -1097,8 +1095,8 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
addQualityTag(item, verifiedItemlist, data, patronTag)
# Check Links
if not item.global_search and config.get_setting('checklinks') and CheckLinks and not config.get_setting('autoplay'):
checklinks_number = config.get_setting('checklinks_number')
if not item.global_search and config.getSetting('checklinks') and CheckLinks and not config.getSetting('autoplay'):
checklinks_number = config.getSetting('checklinks_number')
verifiedItemlist = servertools.check_list_links(verifiedItemlist, checklinks_number)
try:
@@ -1145,7 +1143,7 @@ def videolibrary(itemlist, item, typography='', function_level=1, function=''):
if not typography: typography = 'color kod bold'
title = typo(config.get_localized_string(30161), typography)
title = typo(config.getLocalizedString(30161), typography)
contentSerieName=item.contentSerieName if item.contentSerieName else item.fulltitle if item.contentType != 'movie' else ''
contentTitle=item.contentTitle if item.contentTitle else item.fulltitle if item.contentType == 'movie' else ''
@@ -1171,22 +1169,22 @@ def videolibrary(itemlist, item, typography='', function_level=1, function=''):
def download(itemlist, item, typography='', function_level=1, function=''):
if config.get_setting('downloadenabled'):
if config.getSetting('downloadenabled'):
if not typography: typography = 'color kod bold'
if item.contentType == 'movie':
from_action = 'findvideos'
title = typo(config.get_localized_string(60354), typography)
title = typo(config.getLocalizedString(60354), typography)
elif item.contentType == 'episode':
from_action = 'findvideos'
title = typo(config.get_localized_string(60356), typography) + ' - ' + item.title
title = typo(config.getLocalizedString(60356), typography) + ' - ' + item.title
elif item.contentType in 'tvshow':
if item.channel == 'community' and config.get_setting('show_seasons', item.channel):
if item.channel == 'community' and config.getSetting('show_seasons', item.channel):
from_action = 'season'
else:
from_action = 'episodes'
title = typo(config.get_localized_string(60355), typography)
title = typo(config.getLocalizedString(60355), typography)
elif item.contentType in 'season':
from_action = 'get_seasons'
else: # content type does not support download
@@ -1228,7 +1226,7 @@ def download(itemlist, item, typography='', function_level=1, function=''):
itemlist.append(
Item(channel='downloads',
from_channel=item.channel,
title=typo(config.get_localized_string(60357),typography),
title=typo(config.getLocalizedString(60357),typography),
fulltitle=item.fulltitle,
show=item.fulltitle,
contentType=item.contentType,
@@ -1261,7 +1259,7 @@ def channel_config(item, itemlist):
itemlist.append(
Item(channel='setting',
action="channel_config",
title=typo(config.get_localized_string(60587), 'color kod bold'),
title=typo(config.getLocalizedString(60587), 'color kod bold'),
config=item.channel,
folder=False,
thumbnail=thumb('setting'))
@@ -1373,8 +1371,8 @@ def thumb(data=None, mode=None):
_year = ['anno', 'anni', 'year', 'years']
_top = ['voto', 'voti', 'votato', 'votati', 'migliore', 'migliori', 'fortunato', 'classifica', 'classifiche', 'vote', 'voted', 'best', 'top', 'lucky', 'ranking', 'rating', 'charts']
_popular = ['popolare', 'popolari', 'raccomandato', 'raccomandati', 'raccomandazione', 'raccomandazioni', 'momento', 'popular', 'recommended', 'recommendation', 'recommendations', 'moment']
_all = ['tutto', 'tutta', 'tutti', 'tutte' 'all']
_az = ['lettera', 'lettere', 'lista', 'liste', 'alfabetico', 'a-z', 'letter', 'letters', 'list', 'alphabetical']
_all = ['tutto', 'tutta', 'tutti', 'tutte', 'all']
_az = ['lettera', 'lettere', 'lista', 'liste', 'alfabetico', 'a-z', 'letter', 'letters', 'list', 'alphabetical', 'order', 'ordine']
_news = ['novità', "novita'", 'aggiornamenti', 'nuovo', 'nuova', 'nuovi', 'nuove', 'ultimo', 'ultima', 'ultimi', 'ultime', 'notizia', 'notizie', 'new', 'newest', 'last', 'latest', 'news']
_cinema = ['cinema', 'sala', 'theatre', 'theatres']
_genre = ['genere', 'generi', 'categoria', 'categorie', 'genre', 'genres', 'category', 'categories']
@@ -1385,9 +1383,9 @@ def thumb(data=None, mode=None):
_info = ['informazione', 'informazioni', 'info', 'information', 'informations']
_star = ['attore', 'attrice', 'attori', 'attrici', 'regista', 'registi', 'personaggio', 'personaggi', 'interprete', 'interpreti', 'star', 'stars', 'character', 'characters', 'performer', 'performers', 'staff', 'actor', 'actors', 'actress', 'actresses', 'director', 'directors']
_winter = ['inverno', 'winter']
_spring = ['primavera', 'spring'],
_summer = ['estate', 'summer'],
_autumn = ['autunno', 'autumn'],
_spring = ['primavera', 'spring']
_summer = ['estate', 'summer']
_autumn = ['autunno', 'autumn']
_teenager = ['ragazzo', 'ragazza', 'ragazzi', 'ragazze','teenager', 'teen']
_learning = ['imparare', 'scuola', 'learn', 'learning', 'school']
_animation = ['animazione', 'cartoni', 'animation', 'cartoon']
@@ -1456,7 +1454,7 @@ def thumb(data=None, mode=None):
'teenager':_teenager,
'learning':_learning,
'quality':_quality,
'autoplay':[config.get_localized_string(60071)]
'autoplay':[config.getLocalizedString(60071)]
}
genre_dict = {'documentary':_documentary,
@@ -1562,6 +1560,7 @@ def thumb(data=None, mode=None):
thumb = thumb + suffix
if not thumb:
for t, titles in icon_dict.items():
logger.debug(titles)
if any(word in searched_title for word in titles):
thumb = t
@@ -1590,10 +1589,10 @@ def get_thumb(thumb_name, view="thumb_"):
from core import filetools
if thumb_name.startswith('http'):
return thumb_name
elif config.get_setting('enable_custom_theme') and config.get_setting('custom_theme') and filetools.isfile(config.get_setting('custom_theme') + view + thumb_name):
media_path = config.get_setting('custom_theme')
elif config.getSetting('enable_custom_theme') and config.getSetting('custom_theme') and filetools.isfile(config.getSetting('custom_theme') + view + thumb_name):
media_path = config.getSetting('custom_theme')
else:
icon_pack_name = config.get_setting('icon_set', default="default")
icon_pack_name = config.getSetting('icon_set', default="default")
media_path = filetools.join("https://raw.githubusercontent.com/kodiondemand/media/master/themes/new", icon_pack_name)
return filetools.join(media_path, thumb_name)
@@ -1609,10 +1608,10 @@ def typo(string, typography=''):
try: string = str(string)
except: string = str(string.encode('utf8'))
if config.get_localized_string(30992) in string:
if config.getLocalizedString(30992) in string:
string = string + ' >'
if int(config.get_setting('view_mode_channel').split(',')[-1]) in [0, 50, 55]:
if int(config.getSetting('view_mode_channel').split(',')[-1]) in [0, 50, 55]:
VLT = True
else:
VLT = False
@@ -1683,7 +1682,7 @@ def hdpass_get_servers(item, data=''):
page = httptools.downloadpage(url, CF=False).data
mir = scrapertools.find_single_match(page, patron_mir)
for mir_url, srv in scrapertools.find_multiple_matches(mir, patron_option):
for mir_url, srv in scrapertools.findMultipleMatches(mir, patron_option):
mir_url = scrapertools.decodeHtmlentities(mir_url)
logger.debug(mir_url)
it = hdpass_get_url(item.clone(action='play', quality=quality, url=mir_url))[0]
@@ -1712,13 +1711,13 @@ def hdpass_get_servers(item, data=''):
res = scrapertools.find_single_match(data, patron_res)
# non threaded for webpdb
# for res_url, res_video in scrapertools.find_multiple_matches(res, patron_option):
# for res_url, res_video in scrapertools.findMultipleMatches(res, patron_option):
# res_url = scrapertools.decodeHtmlentities(res_url)
# itemlist.extend(get_hosts(res_url, res_video))
#
with futures.ThreadPoolExecutor() as executor:
thL = []
for res_url, res_video in scrapertools.find_multiple_matches(res, patron_option):
for res_url, res_video in scrapertools.findMultipleMatches(res, patron_option):
res_url = scrapertools.decodeHtmlentities(res_url)
thL.append(executor.submit(get_hosts, res_url, res_video))
for res in futures.as_completed(thL):
@@ -1758,7 +1757,7 @@ def dooplay_get_links(item, host, paramList=[]):
if not paramList:
data = httptools.downloadpage(item.url).data.replace("'", '"')
patron = r'<li id="player-option-[0-9]".*?data-type="([^"]+)" data-post="([^"]+)" data-nume="([^"]+)".*?<span class="title".*?>([^<>]+)</span>(?:<span class="server">([^<>]+))?'
matches = scrapertools.find_multiple_matches(data, patron)
matches = scrapertools.findMultipleMatches(data, patron)
else:
matches = paramList
ret = []
@@ -1846,9 +1845,9 @@ def dooplay_menu(item, type):
########## JWPLAYER ##########
def get_jwplayer_mediaurl(data, srvName, onlyHttp=False, dataIsBlock=False):
def get_jwplayer_mediaUrl(data, srvName, onlyHttp=False, dataIsBlock=False):
from core import jsontools
video_urls = []
videoUrls = []
block = scrapertools.find_single_match(data, r'sources"?\s*:\s*(.*?}?])') if not dataIsBlock else data
if block:
json = jsontools.load(block)
@@ -1865,17 +1864,17 @@ def get_jwplayer_mediaurl(data, srvName, onlyHttp=False, dataIsBlock=False):
sources.append((src, s.get('label')))
else:
if 'file:' in block:
sources = scrapertools.find_multiple_matches(block, r'file:\s*"([^"]+)"(?:,label:\s*"([^"]+)")?')
sources = scrapertools.findMultipleMatches(block, r'file:\s*"([^"]+)"(?:,label:\s*"([^"]+)")?')
elif 'src:' in block:
sources = scrapertools.find_multiple_matches(block, r'src:\s*"([^"]+)",\s*type:\s*"[^"]+"(?:,[^,]+,\s*label:\s*"([^"]+)")?')
sources = scrapertools.findMultipleMatches(block, r'src:\s*"([^"]+)",\s*type:\s*"[^"]+"(?:,[^,]+,\s*label:\s*"([^"]+)")?')
else:
sources =[(block.replace('"',''), '')]
for url, quality in sources:
quality = 'auto' if not quality else quality
if url.split('.')[-1] != 'mpd':
video_urls.append({'type':url.split('.')[-1], 'res':quality, 'url':url if not onlyHttp else url.replace('https://', 'http://')})
videoUrls.append({'type':url.split('.')[-1], 'res':quality, 'url':url if not onlyHttp else url.replace('https://', 'http://')})
return video_urls
return videoUrls
########## ITEMLIST DB FOR PAGINATION ##########
+13 -13
View File
@@ -22,7 +22,7 @@ from core.item import InfoLabels
from platformcode import config, logger, platformtools
info_language = ["de", "en", "es", "fr", "it", "pt"] # from videolibrary.json
def_lang = info_language[config.get_setting("info_language", "videolibrary")]
def_lang = info_language[config.getSetting("info_language", "videolibrary")]
host = 'https://api.themoviedb.org/3'
api = 'a1ab8b8669da03637a4b98fa39c39228'
@@ -82,7 +82,7 @@ def cache_response(fn):
def check_expired(saved_date):
valided = False
cache_expire = config.get_setting("tmdb_cache_expire", default=0)
cache_expire = config.getSetting("tmdb_cache_expire", default=0)
current_date = datetime.datetime.now()
elapsed = current_date - saved_date
@@ -123,7 +123,7 @@ def cache_response(fn):
try:
# cache is not active
if not config.get_setting("tmdb_cache", default=False) or not kwargs.get('cache', True):
if not config.getSetting("tmdb_cache", default=False) or not kwargs.get('cache', True):
logger.debug('no cache')
result = fn(*args)
else:
@@ -168,7 +168,7 @@ def set_infoLabels(source, seekTmdb=True, search_language=def_lang, forced=False
@rtype: int, list
"""
if not config.get_setting('tmdb_active') and not forced:
if not config.getSetting('tmdb_active') and not forced:
return
start_time = time.time()
@@ -199,7 +199,7 @@ def set_infoLabels_itemlist(itemlist, seekTmdb=False, search_language=def_lang,
@rtype: list
"""
if not config.get_setting('tmdb_active') and not forced:
if not config.getSetting('tmdb_active') and not forced:
return
r_list = list()
@@ -406,7 +406,7 @@ def set_infoLabels_item(item, seekTmdb=True, search_language=def_lang):
otmdb = Tmdb(searched_text=searched_title, search_type=search_type, search_language=search_language,
filtro=item.infoLabels.get('filtro', {}), year=item.infoLabels['year'])
if otmdb is not None:
if otmdb.get_id() and config.get_setting("tmdb_plus_info", default=False):
if otmdb.get_id() and config.getSetting("tmdb_plus_info", default=False):
# If the search has been successful and you are not looking for a list of items,
# carry out another search to expand the information
if search_type == 'multi':
@@ -457,11 +457,11 @@ def find_and_set_infoLabels(item):
if item.contentType == "movie":
search_type = "movie"
content_type = config.get_localized_string(60247)
content_type = config.getLocalizedString(60247)
title = item.contentTitle
else:
search_type = "tv"
content_type = config.get_localized_string(60298)
content_type = config.getLocalizedString(60298)
title = item.contentSerieName
# If the title includes the (year) we will remove it
@@ -483,7 +483,7 @@ def find_and_set_infoLabels(item):
# select tmdb_id at the first position
if item.infoLabels['selected_tmdb_id']:
results.insert(0, results.pop([r.get('id') for r in results].index(int(item.infoLabels['selected_tmdb_id']))))
tmdb_result = platformtools.show_video_info(results, item=item, caption= content_type % title)
tmdb_result = platformtools.showVideoInfo(results, item=item, caption= content_type % title)
elif len(results) > 0:
tmdb_result = results[0]
@@ -519,7 +519,7 @@ def get_nfo(item, search_groups=False):
if search_groups:
from platformcode.autorenumber import RENUMBER, GROUP
path = filetools.join(config.get_data_path(), "settings_channels", item.channel + "_data.json")
path = filetools.join(config.getDataPath(), "settings_channels", item.channel + "_data.json")
if filetools.exists(path):
g = jsontools.load(filetools.read(path)).get(RENUMBER,{}).get(item.fulltitle.strip(),{}).get(GROUP,'')
if g:
@@ -577,7 +577,7 @@ def select_group(groups, item):
selections.append([group.get('name',''), group.get('group_count',0), group.get('episode_count',0), group.get('description',''), item.thumbnail])
ids.append(ID)
if selections and ids:
selected = platformtools.dialog_select_group(config.get_localized_string(70831), selections)
selected = platformtools.dialogSelectGroup(config.getLocalizedString(70831), selections)
if selected > -1:
return ids[selected]
return ''
@@ -1040,7 +1040,7 @@ class Tmdb(object):
self.result = ResultDictDefault(self.results[index_results])
# self.result['mediatype'] = self.result['media_type']
if not config.get_setting('tmdb_plus_info'):
if not config.getSetting('tmdb_plus_info'):
self.result = self.get_mpaa(self.result)
return len(self.results)
@@ -1369,7 +1369,7 @@ class Tmdb(object):
if "status_code" in self.season[seasonNumber]:
# An error has occurred
msg = config.get_localized_string(70496) + searching + config.get_localized_string(70497)
msg = config.getLocalizedString(70496) + searching + config.getLocalizedString(70497)
msg += "\nTmdb error: %s %s" % (
self.season[seasonNumber]["status_code"], self.season[seasonNumber]["status_message"])
logger.debug(msg)
+40 -40
View File
@@ -15,12 +15,12 @@ else: from concurrent_py2 import futures
host = 'https://api.trakt.tv'
client_id = '502bd1660b833c1ae69828163c0848e84e9850061e5529f30930e7356cae73b1'
client_secret = '1d30d5b24acf223a5e1ab6c61d08b69992d98ed5b0c7e26b052b5e6a592035a4'
token_auth = config.get_setting("token_trakt", "trakt")
token_auth = config.getSetting("token_trakt", "trakt")
def auth_trakt():
item = Item()
folder = (config.get_platform() == 'plex')
folder = (config.getXBMCPlatform() == 'plex')
item.folder = folder
# Autentificación de cuenta Trakt
headers = {'Content-Type': 'application/json', 'trakt-api-key': client_id, 'trakt-api-version': '2'}
@@ -39,11 +39,11 @@ def auth_trakt():
else:
itemlist = []
title = config.get_localized_string(60248) % item.verify_url
title = config.getLocalizedString(60248) % item.verify_url
itemlist.append(item.clone(title=title, action=''))
title = config.get_localized_string(60249) % item.user_code
title = config.getLocalizedString(60249) % item.user_code
itemlist.append(item.clone(title=title, action=''))
title = config.get_localized_string(60250)
title = config.getLocalizedString(60250)
itemlist.append(item.clone(title=title, action='token_trakt'))
return itemlist
except:
@@ -57,7 +57,7 @@ def token_trakt(item):
headers = {'Content-Type': 'application/json', 'trakt-api-key': client_id, 'trakt-api-version': '2'}
try:
if item.extra == 'renew':
refresh = config.get_setting('refresh_token_trakt', 'trakt')
refresh = config.getSetting('refresh_token_trakt', 'trakt')
url = host + '/oauth/device/token'
post = {'refresh_token': refresh, 'client_id': client_id, 'client_secret': client_secret,
'redirect_uri': 'urn:ietf:wg:oauth:2.0:oob', 'grant_type': 'refresh_token'}
@@ -71,17 +71,17 @@ def token_trakt(item):
data = jsontools.load(data)
else:
import time
dialog_auth = platformtools.dialog_progress(config.get_localized_string(60251),
config.get_localized_string(60252) % item.verify_url + '\n' +
config.get_localized_string(60253) % item.user_code + '\n' +
config.get_localized_string(60254))
dialog_auth = platformtools.dialogProgress(config.getLocalizedString(60251),
config.getLocalizedString(60252) % item.verify_url + '\n' +
config.getLocalizedString(60253) % item.user_code + '\n' +
config.getLocalizedString(60254))
# Generalmente cada 5 segundos se intenta comprobar si el usuario ha introducido el código
while True:
time.sleep(item.intervalo)
try:
if dialog_auth.iscanceled():
config.set_setting('trakt_sync', False)
config.setSetting('trakt_sync', False)
return
url = host + '/oauth/device/token'
@@ -103,10 +103,10 @@ def token_trakt(item):
token = data['access_token']
refresh = data['refresh_token']
config.set_setting('token_trakt', token, 'trakt')
config.set_setting('refresh_token_trakt', refresh, 'trakt')
config.setSetting('token_trakt', token, 'trakt')
config.setSetting('refresh_token_trakt', refresh, 'trakt')
if not item.folder:
platformtools.dialog_notification(config.get_localized_string(60255), config.get_localized_string(60256))
platformtools.dialogNotification(config.getLocalizedString(60255), config.getLocalizedString(60256))
if config.is_xbmc():
import xbmc
xbmc.executebuiltin('Container.Refresh')
@@ -116,14 +116,14 @@ def token_trakt(item):
import traceback
logger.error(traceback.format_exc())
if not item.folder:
return platformtools.dialog_notification(config.get_localized_string(60527), config.get_localized_string(60258))
return platformtools.dialogNotification(config.getLocalizedString(60527), config.getLocalizedString(60258))
token = ''
itemlist = []
if token:
itemlist.append(item.clone(title=config.get_localized_string(60256), action=''))
itemlist.append(item.clone(title=config.getLocalizedString(60256), action=''))
else:
itemlist.append(item.clone(title=config.get_localized_string(60260), action=''))
itemlist.append(item.clone(title=config.getLocalizedString(60260), action=''))
return itemlist
@@ -146,23 +146,23 @@ def get_trakt_watched(id_type, mediatype, update=False):
id_list = []
id_dict = dict()
token_auth = config.get_setting('token_trakt', 'trakt')
token_auth = config.getSetting('token_trakt', 'trakt')
if token_auth:
sync_path = os.path.join(config.get_data_path(), 'settings_channels', 'trakt')
sync_path = os.path.join(config.getDataPath(), 'settings_channels', 'trakt')
if os.path.exists(sync_path) and not update:
trakt_node = jsontools.get_node_from_file('trakt', 'TRAKT')
trakt_node = jsontools.getNodeFromFile('trakt', 'TRAKT')
if mediatype == 'shows':
return trakt_node['shows']
if mediatype == 'movies':
return trakt_node['movies']
else:
token_auth = config.get_setting('token_trakt', 'trakt')
token_auth = config.getSetting('token_trakt', 'trakt')
if token_auth:
try:
token_auth = config.get_setting('token_trakt', 'trakt')
token_auth = config.getSetting('token_trakt', 'trakt')
headers = [['Content-Type', 'application/json'], ['trakt-api-key', client_id],
['trakt-api-version', '2']]
if token_auth:
@@ -232,24 +232,24 @@ def trakt_check(itemlist):
def get_sync_from_file():
logger.debug()
sync_path = os.path.join(config.get_data_path(), 'settings_channels', 'trakt_data.json')
sync_path = os.path.join(config.getDataPath(), 'settings_channels', 'trakt_data.json')
trakt_node = {}
if os.path.exists(sync_path):
trakt_node = jsontools.get_node_from_file('trakt', 'TRAKT')
trakt_node = jsontools.getNodeFromFile('trakt', 'TRAKT')
trakt_node['movies'] = get_trakt_watched('tmdb', 'movies')
trakt_node['shows'] = get_trakt_watched('tmdb', 'shows')
jsontools.update_node(trakt_node, 'trakt', 'TRAKT')
jsontools.updateNode(trakt_node, 'trakt', 'TRAKT')
def update_trakt_data(mediatype, trakt_data):
logger.debug()
sync_path = os.path.join(config.get_data_path(), 'settings_channels', 'trakt_data.json')
sync_path = os.path.join(config.getDataPath(), 'settings_channels', 'trakt_data.json')
if os.path.exists(sync_path):
trakt_node = jsontools.get_node_from_file('trakt', 'TRAKT')
trakt_node = jsontools.getNodeFromFile('trakt', 'TRAKT')
trakt_node[mediatype] = trakt_data
jsontools.update_node(trakt_node, 'trakt', 'TRAKT')
jsontools.updateNode(trakt_node, 'trakt', 'TRAKT')
def ask_install_script():
@@ -257,12 +257,12 @@ def ask_install_script():
from platformcode import platformtools
respuesta = platformtools.dialog_yesno(config.get_localized_string(20000), config.get_localized_string(70521))
respuesta = platformtools.dialogYesNo(config.getLocalizedString(20000), config.getLocalizedString(70521))
if respuesta:
xbmc.executebuiltin('InstallAddon(script.trakt)')
return
else:
config.set_setting('install_trakt', False)
config.setSetting('install_trakt', False)
return
@@ -288,7 +288,7 @@ def update_all():
def context(item):
Type = item.contentType.replace("tv", "") + "s"
item.action = 'traktResults'
title = config.get_localized_string(30122 if item.contentType == 'movie' else 30123)
title = config.getLocalizedString(30122 if item.contentType == 'movie' else 30123)
context = []
commands = []
condition = "'tmdb': " + item.infoLabels["tmdb_id"]
@@ -296,10 +296,10 @@ def context(item):
result = execute(item.clone(url="/sync/watched/" + Type))
post = {Type: [{"ids": {"tmdb": item.infoLabels["tmdb_id"]}}]}
if condition in str(result):
context.append(config.get_localized_string(60016 if item.contentType == 'movie' else 60020))
context.append(config.getLocalizedString(60016 if item.contentType == 'movie' else 60020))
commands.append(item.clone(url="/sync/history/remove", post=post))
else:
context.append(config.get_localized_string(60017 if item.contentType == 'movie' else 60021))
context.append(config.getLocalizedString(60017 if item.contentType == 'movie' else 60021))
commands.append(item.clone(url="/sync/history", post=post))
except:
pass
@@ -308,10 +308,10 @@ def context(item):
result = execute(item.clone(url="/sync/watchlist/" + Type))
post = {Type: [{"ids": {"tmdb": item.infoLabels["tmdb_id"]}}]}
if condition in str(result):
context.append(config.get_localized_string(70343) % title)
context.append(config.getLocalizedString(70343) % title)
commands.append(item.clone(url="/sync/watchlist/remove", post=post))
else:
context.append(config.get_localized_string(70344) % title)
context.append(config.getLocalizedString(70344) % title)
commands.append(item.clone(url="/sync/watchlist", post=post))
except:
pass
@@ -320,10 +320,10 @@ def context(item):
result = execute(item.clone(url="/sync/collection/" + Type))
post = {Type: [{"ids": {"tmdb": item.infoLabels["tmdb_id"]}}]}
if condition in str(result):
context.append(config.get_localized_string(70345) % title)
context.append(config.getLocalizedString(70345) % title)
commands.append(item.clone(url="/sync/collection/remove", post=post))
else:
context.append(config.get_localized_string(70346) % title)
context.append(config.getLocalizedString(70346) % title)
commands.append(item.clone(url="/sync/collection", post=post))
except:
pass
@@ -335,7 +335,7 @@ def context(item):
execute(commands[index])
def execute(item):
from platformcode.platformtools import dialog_notification
from platformcode.platformtools import dialogNotification
url = host + item.url
headers = [['Content-Type', 'application/json'], ['trakt-api-key', client_id], ['trakt-api-version', '2']]
@@ -349,5 +349,5 @@ def execute(item):
if not post:
return data
else:
if 'not_found' in data: return dialog_notification('Trakt', config.get_localized_string(70347))
else: return dialog_notification('Trakt', config.get_localized_string(70348))
if 'not_found' in data: return dialogNotification('Trakt', config.getLocalizedString(70347))
else: return dialogNotification('Trakt', config.getLocalizedString(70348))
+17 -17
View File
@@ -27,9 +27,9 @@ from platformcode import platformtools
HOST = "https://api.thetvdb.com"
HOST_IMAGE = "http://thetvdb.com/banners/"
TOKEN = config.get_setting("tvdb_token", default="")
TOKEN = config.getSetting("tvdb_token", default="")
info_language = ["de", "en", "es", "fr", "it", "pt"] # from videolibrary.json
DEFAULT_LANG = info_language[config.get_setting("info_language", "videolibrary")]
DEFAULT_LANG = info_language[config.getSetting("info_language", "videolibrary")]
DEFAULT_HEADERS = {
'Content-Type': 'application/json',
'Accept': 'application/json, application/vnd.thetvdb.v2.1.1',
@@ -82,7 +82,7 @@ def find_and_set_infoLabels(item):
p_dialog = None
if not item.contentSeason:
p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(60296), config.get_localized_string(60293))
p_dialog = platformtools.dialogProgressBg(config.getLocalizedString(60296), config.getLocalizedString(60293))
global otvdb_global
tvdb_result = None
@@ -106,24 +106,24 @@ def find_and_set_infoLabels(item):
otvdb_global = Tvdb(tvdb_id=item.infoLabels['tvdb_id'])
if not item.contentSeason:
p_dialog.update(50, config.get_localized_string(60296) + '\n' + config.get_localized_string(60295))
p_dialog.update(50, config.getLocalizedString(60296) + '\n' + config.getLocalizedString(60295))
results, info_load = otvdb_global.get_list_results()
logger.debug("results: %s" % results)
if not item.contentSeason:
p_dialog.update(100, config.get_localized_string(60296) + '\n' + config.get_localized_string(60297) % len(results))
p_dialog.update(100, config.getLocalizedString(60296) + '\n' + config.getLocalizedString(60297) % len(results))
p_dialog.close()
if len(results) > 1:
tvdb_result = platformtools.show_video_info(results, item=item, scraper=Tvdb, caption=config.get_localized_string(60298) % title)
tvdb_result = platformtools.showVideoInfo(results, item=item, scraper=Tvdb, caption=config.getLocalizedString(60298) % title)
# if not tvdb_result:
# res = platformtools.dialog_info(item, 'tvdb')
# res = platformtools.dialogInfo(item, 'tvdb')
# if not res.exit: return find_and_set_infoLabels(res)
elif len(results) > 0:
tvdb_result = results[0]
# else:
# res = platformtools.dialog_info(item, 'tvdb')
# res = platformtools.dialogInfo(item, 'tvdb')
# if not res.exit: return find_and_set_infoLabels(res)
# todo revisar
@@ -355,18 +355,18 @@ class Tvdb(object):
if kwargs.get('tvdb_id', ''):
# Search by tvdb identifier
self.__get_by_id(kwargs.get('tvdb_id', ''))
if not self.list_results and config.get_setting("tvdb_retry_eng", "videolibrary"):
if not self.list_results and config.getSetting("tvdb_retry_eng", "videolibrary"):
from platformcode import platformtools
platformtools.dialog_notification(config.get_localized_string(60299) % DEFAULT_LANG, config.get_localized_string(60302), sound=False)
platformtools.dialogNotification(config.getLocalizedString(60299) % DEFAULT_LANG, config.getLocalizedString(60302), sound=False)
self.__get_by_id(kwargs.get('tvdb_id', ''), "en")
self.lang = "en"
elif self.search_name:
# BUsqueda by text
self.__search(kwargs.get('search', ''), kwargs.get('imdb_id', ''), kwargs.get('zap2it_id', ''))
if not self.list_results and config.get_setting("tvdb_retry_eng", "videolibrary"):
if not self.list_results and config.getSetting("tvdb_retry_eng", "videolibrary"):
from platformcode import platformtools
platformtools.dialog_notification(config.get_localized_string(60299) % DEFAULT_LANG, config.get_localized_string(60302))
platformtools.dialogNotification(config.getLocalizedString(60299) % DEFAULT_LANG, config.getLocalizedString(60302))
self.__search(kwargs.get('search', ''), kwargs.get('imdb_id', ''), kwargs.get('zap2it_id', ''), "en")
self.lang = "en"
@@ -376,7 +376,7 @@ class Tvdb(object):
buscando = kwargs.get('tvdb_id', '')
else:
buscando = kwargs.get('search', '')
msg = config.get_localized_string(70266) % buscando
msg = config.getLocalizedString(70266) % buscando
logger.debug(msg)
@classmethod
@@ -389,10 +389,10 @@ class Tvdb(object):
from time import gmtime, strftime
current_date = strftime("%Y-%m-%d", gmtime())
if config.get_setting("tvdb_token_date", "") != current_date:
if config.getSetting("tvdb_token_date", "") != current_date:
# if the token has been renewed we save the new date
if cls.__refresh_token():
config.set_setting("tvdb_token_date", current_date)
config.setSetting("tvdb_token_date", current_date)
@staticmethod
def __login():
@@ -418,7 +418,7 @@ class Tvdb(object):
token = dict_html["token"]
DEFAULT_HEADERS["Authorization"] = "Bearer " + token
TOKEN = config.set_setting("tvdb_token", token)
TOKEN = config.setSetting("tvdb_token", token)
@classmethod
def __refresh_token(cls):
@@ -449,7 +449,7 @@ class Tvdb(object):
if "token" in dict_html:
token = dict_html["token"]
DEFAULT_HEADERS["Authorization"] = "Bearer " + token
TOKEN = config.set_setting("tvdb_token", token)
TOKEN = config.setSetting("tvdb_token", token)
is_success = True
else:
cls.__login()
+46 -46
View File
@@ -19,14 +19,14 @@ from platformcode import config, dbconverter, logger, platformtools
from platformcode.autorenumber import RENUMBER
from core import videolibrarydb
FOLDER_MOVIES = config.get_setting("folder_movies")
FOLDER_TVSHOWS = config.get_setting("folder_tvshows")
VIDEOLIBRARY_PATH = config.get_videolibrary_path()
FOLDER_MOVIES = config.getSetting("folder_movies")
FOLDER_TVSHOWS = config.getSetting("folder_tvshows")
VIDEOLIBRARY_PATH = config.getVideolibraryPath()
MOVIES_PATH = filetools.join(VIDEOLIBRARY_PATH, FOLDER_MOVIES)
TVSHOWS_PATH = filetools.join(VIDEOLIBRARY_PATH, FOLDER_TVSHOWS)
if not FOLDER_MOVIES or not FOLDER_TVSHOWS or not VIDEOLIBRARY_PATH or not filetools.exists(MOVIES_PATH) or not filetools.exists(TVSHOWS_PATH):
config.verify_directories_created()
config.verifyDirectoriesCreated()
addon_name = "plugin://plugin.video.%s/" % config.PLUGIN_NAME
@@ -92,7 +92,7 @@ def save_movie(item, silent=False):
return 0, 0, -1, path
# progress dialog
if not silent: p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(60062))
if not silent: p_dialog = platformtools.dialogProgressBg(config.getLocalizedString(20000), config.getLocalizedString(60062))
base_name = set_base_name(item, _id)
path = filetools.join(MOVIES_PATH, base_name)
@@ -121,7 +121,7 @@ def save_movie(item, silent=False):
# get extra info from fanart tv
# logger.dbg()
extra_info = get_fanart_tv(item)
extra_info = getFanart_tv(item)
if not item.infoLabels.get('posters', []): item.infoLabels['posters'] = []
item.infoLabels['posters'] += extra_info['poster']
if not item.infoLabels.get('fanarts', []): item.infoLabels['fanarts'] = []
@@ -204,7 +204,7 @@ def save_movie(item, silent=False):
if not item.contentLanguage in movie_item.lang_list: movie_item.lang_list.append(item.contentLanguage)
if len(movie_item.lang_list) > 1:
movie_item.prefered_lang = movie_item.lang_list[platformtools.dialog_select(config.get_localized_string(70246), movie_item.lang_list)]
movie_item.prefered_lang = movie_item.lang_list[platformtools.dialogSelect(config.getLocalizedString(70246), movie_item.lang_list)]
else:
movie_item.prefered_lang = movie_item.lang_list[0]
@@ -216,7 +216,7 @@ def save_movie(item, silent=False):
# create strm file if it does not exist
if not strm_exists and not local_files:
logger.debug("Creating .strm: " + strm_path)
item_strm = Item(channel='videolibrary', action='play_from_library', strm_path=movie_item.strm_path, contentType='movie', contentTitle=item.contentTitle, videolibrary_id=movie_item.videolibrary_id)
item_strm = Item(channel='videolibrary', action='playFromLibrary', strm_path=movie_item.strm_path, contentType='movie', contentTitle=item.contentTitle, videolibrary_id=movie_item.videolibrary_id)
strm_exists = filetools.write(filetools.join(MOVIES_PATH, movie_item.strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
# checks if the content already exists
@@ -260,11 +260,11 @@ def save_movie(item, silent=False):
if not silent:
p_dialog.update(100, item.contentTitle)
p_dialog.close()
if config.is_xbmc() and config.get_setting("videolibrary_kodi") and not item.not_add:
if config.is_xbmc() and config.getSetting("videolibrary_kodi") and not item.not_add:
# Update Kodi Library
from platformcode.dbconverter import add_video
add_video(movie_item)
# if config.is_xbmc() and config.get_setting("videolibrary_kodi") and not silent and inserted:
# if config.is_xbmc() and config.getSetting("videolibrary_kodi") and not silent and inserted:
# from platformcode.xbmc_videolibrary import update
# update(MOVIES_PATH)
return inserted, overwritten, failed, path
@@ -357,7 +357,7 @@ def save_tvshow(item, episodelist, silent=False):
head_nfo = scraper.get_nfo(item)
if not head_nfo: return 0, 0, -1, ''
extra_info = get_fanart_tv(item)
extra_info = getFanart_tv(item)
if not item.infoLabels.get('posters'):item.infoLabels['posters'] = []
item.infoLabels['posters'] += extra_info['poster'].get('all',[])
if not item.infoLabels.get('fanarts'): item.infoLabels['fanarts'] = []
@@ -425,7 +425,7 @@ def save_tvshow(item, episodelist, silent=False):
logger.debug()
inserted, overwritten, failed = save_episodes(tvshow_item, episodelist, extra_info, item.host, local_files, silent=silent)
videolibrarydb.close()
if config.is_xbmc() and config.get_setting("videolibrary_kodi") and not item.not_add:
if config.is_xbmc() and config.getSetting("videolibrary_kodi") and not item.not_add:
from platformcode.dbconverter import add_video
add_video(tvshow_item)
@@ -528,11 +528,11 @@ def save_episodes(item, episodelist, extra_info, host, local_files, silent=False
# if not filetools.exists(filetools.join(TVSHOWS_PATH, strm_path)):
if season_episode not in local_files.get('db',{}).keys():
logger.debug("Creating .strm: " + episode_item.strm_path)
item_strm = Item(channel='videolibrary', action='play_from_library', strm_path=episode_item.strm_path, contentType='episode', videolibrary_id=episode_item.videolibrary_id, contentSeason = episode_item.contentSeason, contentEpisodeNumber = episode_item.contentEpisodeNumber,)
item_strm = Item(channel='videolibrary', action='playFromLibrary', strm_path=episode_item.strm_path, contentType='episode', videolibrary_id=episode_item.videolibrary_id, contentSeason = episode_item.contentSeason, contentEpisodeNumber = episode_item.contentEpisodeNumber,)
filetools.write(filetools.join(TVSHOWS_PATH, episode_item.strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
# update db if episode added
# if failed == 0 and config.get_setting('kod_scraper'):
# if failed == 0 and config.getSetting('kod_scraper'):
# add_video(episode_item)
return item, episode, season_episode, e.contentLanguage, inserted, overwritten, failed
@@ -585,7 +585,7 @@ def save_episodes(item, episodelist, extra_info, host, local_files, silent=False
# Silent is to show no progress (for service)
if not silent:
# progress dialog
p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(60064) ,'')
p_dialog = platformtools.dialogProgressBg(config.getLocalizedString(60064) ,'')
inserted = 0
overwritten = 0
@@ -650,14 +650,14 @@ def save_episodes(item, episodelist, extra_info, host, local_files, silent=False
seasons[s] = season_item
# Add to Kodi DB if Kod is set to add information
# if config.get_setting('kod_scraper'):
# if config.getSetting('kod_scraper'):
# add_video(season_item)
if not silent:
# update tvshow info if forced
if len(item.lang_list) > 1:
item.prefered_lang = item.lang_list[platformtools.dialog_select(config.get_localized_string(70246), item.lang_list)]
item.prefered_lang = item.lang_list[platformtools.dialogSelect(config.getLocalizedString(70246), item.lang_list)]
else:
item.prefered_lang = item.lang_list[0]
@@ -684,7 +684,7 @@ def save_episodes(item, episodelist, extra_info, host, local_files, silent=False
# return add_movie(item)
# else:
# videolibrarydb.close()
# platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(70838) % item.contentTitle)
# platformtools.dialogOk(config.getLocalizedString(30131), config.getLocalizedString(70838) % item.contentTitle)
def add_to_videolibrary(item, channel):
@@ -733,10 +733,10 @@ def add_movie(item):
inserted, overwritten, failed, path = save_movie(new_item)
if failed == 0:
platformtools.dialog_notification(config.get_localized_string(30131), config.get_localized_string(30135) % new_item.contentTitle) # 'has been added to the video library'
platformtools.dialogNotification(config.getLocalizedString(30131), config.getLocalizedString(30135) % new_item.contentTitle) # 'has been added to the video library'
else:
filetools.rmdirtree(path)
platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(60066) % new_item.contentTitle) # "ERROR, the movie has NOT been added to the video library")
platformtools.dialogOk(config.getLocalizedString(30131), config.getLocalizedString(60066) % new_item.contentTitle) # "ERROR, the movie has NOT been added to the video library")
movies = videolibrarydb['movie']
_id = get_id(item)
if _id in list(movies.keys()):
@@ -782,7 +782,7 @@ def add_tvshow(item, channel=None, itemlist=[]):
item.__dict__["channel"] = item.__dict__.pop("from_channel")
if not channel:
channel = platformtools.channel_import(item.channel)
channel = platformtools.channelImport(item.channel)
# To disambiguate titles, TMDB is caused to ask for the really desired title
# The user can select the title among those offered on the first screen
@@ -825,29 +825,29 @@ def add_tvshow(item, channel=None, itemlist=[]):
elif not inserted and not overwritten and not failed:
filetools.rmdirtree(path)
platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(60067) % item.contentTitle)
platformtools.dialogOk(config.getLocalizedString(30131), config.getLocalizedString(60067) % item.contentTitle)
logger.error("The string %s could not be added to the video library. Could not get any episode" % item.contentTitle)
elif failed == -1:
filetools.rmdirtree(path)
platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(60068) % item.contentTitle)
platformtools.dialogOk(config.getLocalizedString(30131), config.getLocalizedString(60068) % item.contentTitle)
logger.error("The string %s could not be added to the video library" % item.contentTitle)
elif failed == -2:
filetools.rmdirtree(path)
elif failed > 0:
platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(60069) % item.contentTitle)
platformtools.dialogOk(config.getLocalizedString(30131), config.getLocalizedString(60069) % item.contentTitle)
logger.error("Could not add %s episodes of series %s to the video library" % (failed, item.contentTitle))
else:
platformtools.dialog_notification(config.get_localized_string(30131), config.get_localized_string(60070) % item.contentTitle)
platformtools.dialogNotification(config.getLocalizedString(30131), config.getLocalizedString(60070) % item.contentTitle)
logger.debug("%s episodes of series %s have been added to the video library" % (inserted, item.contentTitle))
if config.is_xbmc():
if config.get_setting("sync_trakt_new_tvshow", "videolibrary"):
if config.getSetting("sync_trakt_new_tvshow", "videolibrary"):
import xbmc
from platformcode import xbmc_videolibrary
if config.get_setting("sync_trakt_new_tvshow_wait", "videolibrary"):
if config.getSetting("sync_trakt_new_tvshow_wait", "videolibrary"):
# Check that you are not looking for content in the Kodi video library
while xbmc.getCondVisibility('Library.IsScanningVideo()'):
xbmc.sleep(1000)
@@ -868,7 +868,7 @@ def get_id(item):
return item.infoLabels.get('tmdb_id')
def get_fanart_tv(item, set='', ret={}):
def getFanart_tv(item, set='', ret={}):
def set_dict(l):
d = {}
for k in l:
@@ -906,7 +906,7 @@ def get_fanart_tv(item, set='', ret={}):
ret[set + 'disc'] = [k.get('url') for k in res.get('moviedisc', [])]
if item.infoLabels.get('setid'):
it = item.clone(infoLabels = {'tmdb_id':item.infoLabels['setid']})
get_fanart_tv(it, 'set', ret)
getFanart_tv(it, 'set', ret)
return ret
@@ -958,9 +958,9 @@ def get_local_files(path, item):
def select_local_path(item):
if not item.local_episodes_path and config.get_setting('local_episodes'):
if platformtools.dialog_yesno(config.get_localized_string(30131), config.get_localized_string(80044) % item.title):
local_episodes_path = platformtools.dialog_browse(0, config.get_localized_string(80046))
if not item.local_episodes_path and config.getSetting('local_episodes'):
if platformtools.dialogYesNo(config.getLocalizedString(30131), config.getLocalizedString(80044) % item.title):
local_episodes_path = platformtools.dialogBrowse(0, config.getLocalizedString(80046))
if local_episodes_path:
item.local_episodes_path = local_episodes_path
return item
@@ -969,7 +969,7 @@ def select_local_path(item):
def update_renumber_options(item):
from core import jsontools
filename = filetools.join(config.get_data_path(), "settings_channels", item.channel + '_data.json')
filename = filetools.join(config.getDataPath(), "settings_channels", item.channel + '_data.json')
if filetools.isfile(filename):
json_file = jsontools.load(filetools.read(filename))
json = json_file.get(RENUMBER,{}).get(item.fulltitle,{})
@@ -982,7 +982,7 @@ def update_renumber_options(item):
def add_renumber_options(item):
from core import jsontools
ret = None
filename = filetools.join(config.get_data_path(), "settings_channels", item.channel + '_data.json')
filename = filetools.join(config.getDataPath(), "settings_channels", item.channel + '_data.json')
json_file = jsontools.load(filetools.read(filename))
if item.renumber and not json_file.get(RENUMBER,{}).get(item.fulltitle):
check_renumber_options(item)
@@ -1046,12 +1046,12 @@ def set_base_name(item, _id):
# set base_name for videolibrary
logger.debug()
if item.contentType == 'movie':
if config.get_setting("original_title_folder", "videolibrary") and item.infoLabels['originaltitle']:
if config.getSetting("original_title_folder", "videolibrary") and item.infoLabels['originaltitle']:
base_name = item.infoLabels['originaltitle']
else:
base_name = item.contentTitle
else:
if config.get_setting("original_title_folder", "videolibrary") and item.infoLabels['originaltitle']:
if config.getSetting("original_title_folder", "videolibrary") and item.infoLabels['originaltitle']:
base_name = item.infoLabels['originaltitle']
elif item.infoLabels['tvshowtitle']:
base_name = item.infoLabels['tvshowtitle']
@@ -1065,7 +1065,7 @@ def set_base_name(item, _id):
else:
base_name = filetools.validate_path(base_name.replace('/', '-'))
if config.get_setting("lowerize_title", "videolibrary"):
if config.getSetting("lowerize_title", "videolibrary"):
base_name = base_name.lower()
return '{} [{}]'.format(base_name, _id)
@@ -1076,7 +1076,7 @@ def restore_videolibrary():
tvshows = [x['item'] for x in dict(videolibrarydb['tvshow']).values()]
total = len(movies) + len(tvshows)
progress = 0
dialog = platformtools.dialog_progress(config.get_localized_string(20000), 'Ripristino videoteca in corso')
dialog = platformtools.dialogProgress(config.getLocalizedString(20000), 'Ripristino videoteca in corso')
try: os.mkdir(MOVIES_PATH)
except: pass
try: os.mkdir(TVSHOWS_PATH)
@@ -1100,7 +1100,7 @@ def restore_videolibrary():
filetools.write(filetools.join(MOVIES_PATH, item.nfo_path), item.head_nfo)
if not "{}.strm".format(base_name) in movie_files and not local:
item_strm = Item(channel='videolibrary', action='play_from_library', strm_path=item.strm_path, contentType='movie', contentTitle=item.contentTitle, videolibrary_id=item.videolibrary_id)
item_strm = Item(channel='videolibrary', action='playFromLibrary', strm_path=item.strm_path, contentType='movie', contentTitle=item.contentTitle, videolibrary_id=item.videolibrary_id)
filetools.write(filetools.join(MOVIES_PATH, item.strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
progress += 1
@@ -1131,7 +1131,7 @@ def restore_videolibrary():
local = True if 'local' in videolibrarydb['episode'][item.videolibrary_id][season_episode]['channels'] else False
if not '{}.strm'.format(season_episode) in episode_files and not local:
logger.debug("Creating .strm: " + strm_path)
item_strm = Item(channel='videolibrary', action='play_from_library', strm_path=strm_path, contentType='episode', videolibrary_id=e.videolibrary_id, contentSeason = e.contentSeason, contentEpisodeNumber = e.contentEpisodeNumber,)
item_strm = Item(channel='videolibrary', action='playFromLibrary', strm_path=strm_path, contentType='episode', videolibrary_id=e.videolibrary_id, contentSeason = e.contentSeason, contentEpisodeNumber = e.contentEpisodeNumber,)
filetools.write(filetools.join(TVSHOWS_PATH, strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
progress += 1
dialog.update(int(progress / total * 100), item.title)
@@ -1144,15 +1144,15 @@ def convert_videolibrary():
from platformcode import xbmc_videolibrary
from core import jsontools
dialog = platformtools.dialog_progress(config.get_localized_string(20000), 'Conversione videoteca in corso')
dialog = platformtools.dialogProgress(config.getLocalizedString(20000), 'Conversione videoteca in corso')
path_to_delete = []
film_lst = glob.glob(filetools.join(MOVIES_PATH, '*/*.json'))
tvshow_lst = glob.glob((filetools.join(TVSHOWS_PATH, '*/tvshow.nfo')))
total = len(film_lst) + len(tvshow_lst)
progress = 0
tvPath = filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_tvshows'))
moviePath = filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_movies'))
tvPath = filetools.join(config.getSetting('videolibrarypath'), config.getSetting('folder_tvshows'))
moviePath = filetools.join(config.getSetting('videolibrarypath'), config.getSetting('folder_movies'))
# set local info only
xbmc_videolibrary.execute_sql_kodi('update path set strScraper="metadata.local", strSettings="" where strPath = "{}{}"'.format(tvPath, '/' if '/' in tvPath else '\\'))
@@ -1170,12 +1170,12 @@ def convert_videolibrary():
for tvshow in tvshow_lst:
if not dialog:
dialog = platformtools.dialog_progress(config.get_localized_string(20000), 'Conversione videoteca in corso')
dialog = platformtools.dialogProgress(config.getLocalizedString(20000), 'Conversione videoteca in corso')
js = jsontools.load('\n'.join(filetools.read(tvshow).splitlines()[1:]))
channels_dict = js.get('library_urls')
if channels_dict:
for ch, url in channels_dict.items():
dir = filetools.listdir(xbmc.translatePath(filetools.join(config.get_setting('videolibrarypath'), config.get_setting('folder_tvshows'), js['path'])))
dir = filetools.listdir(xbmc.translatePath(filetools.join(config.getSetting('videolibrarypath'), config.getSetting('folder_tvshows'), js['path'])))
json_files = [f for f in dir if f.endswith('.json')]
if json_files:
path_to_delete.append(filetools.dirname(tvshow))
@@ -1186,7 +1186,7 @@ def convert_videolibrary():
it.url = channels_dict[ch]
remove_host(it)
tmdb.find_and_set_infoLabels(it)
channel = platformtools.channel_import(ch)
channel = platformtools.channelImport(ch)
it.host = channel.host
it.url = channel.host + it.url
episodes = getattr(channel, 'episodes')(it)
+2 -2
View File
@@ -53,13 +53,13 @@ class ziptools(object):
try:
if filetools.exists(outfilename) and overwrite_question:
from platformcode import platformtools
dyesno = platformtools.dialog_yesno("File already exists "," File %s to unzip already exists, do you want to overwrite it?" % filetools.basename(outfilename))
dyesno = platformtools.dialogYesNo("File already exists "," File %s to unzip already exists, do you want to overwrite it?" % filetools.basename(outfilename))
if not dyesno:
break
if backup:
import time
hora_folder = "Backup [%s]" % time.strftime("%d-%m_%H-%M", time.localtime())
backup = filetools.join(config.get_data_path(), 'backups', hora_folder, folder_to_extract)
backup = filetools.join(config.getDataPath(), 'backups', hora_folder, folder_to_extract)
if not filetools.exists(backup):
filetools.mkdir(backup)
filetools.copy(outfilename, filetools.join(backup, filetools.basename(outfilename)))
+1 -1
View File
@@ -20,7 +20,7 @@ from platformcode import config, logger
logger.info("init...")
librerias = xbmc.translatePath(os.path.join(config.get_runtime_path(), 'lib'))
librerias = xbmc.translatePath(os.path.join(config.getRuntimePath(), 'lib'))
sys.path.insert(0, librerias)
from platformcode import launcher
+2 -2
View File
@@ -46,10 +46,10 @@ def toStringCases(txt_result):
if "+(" in txt_result:
m3 = True
sum_base = "+" + find_single_match(txt_result, ".toString...(\d+).")
txt_pre_temp = find_multiple_matches(txt_result, "..(\d),(\d+).")
txt_pre_temp = findMultipleMatches(txt_result, "..(\d),(\d+).")
txt_temp = [(n, b) for b, n in txt_pre_temp]
else:
txt_temp = find_multiple_matches(txt_result, '(\d+)\.0.\w+.([^\)]+).')
txt_temp = findMultipleMatches(txt_result, '(\d+)\.0.\w+.([^\)]+).')
for numero, base in txt_temp:
code = toString(int(numero), eval(base + sum_base))
if m3:
+5 -5
View File
@@ -80,7 +80,7 @@ class ChromeOSImage:
"""Extracts the file from the image"""
self.progress = progress
self.progress.update(2, config.get_localized_string(70813))
self.progress.update(2, config.getLocalizedString(70813))
self.part_offset = self.chromeos_offset()
self.sb_dict = self.superblock()
self.blk_groups = self.block_groups()
@@ -88,7 +88,7 @@ class ChromeOSImage:
bin_filename = filename.encode('ascii')
chunksize = 4 * 1024**2
percent8 = 40
self.progress.update(int(percent8 / 8), config.get_localized_string(70814))
self.progress.update(int(percent8 / 8), config.getLocalizedString(70814))
chunk1 = self.read_stream(chunksize)
while True:
chunk2 = self.read_stream(chunksize)
@@ -107,7 +107,7 @@ class ChromeOSImage:
percent8 += 1
self.progress.update(int(percent8 / 8))
self.progress.update(32, config.get_localized_string(70815))
self.progress.update(32, config.getLocalizedString(70815))
blk_group_num = (dir_dict['inode'] - 1) // self.sb_dict['s_inodes_per_group']
blk_group = self.blk_groups[blk_group_num]
@@ -199,7 +199,7 @@ class ChromeOSImage:
@staticmethod
def dir_entry(chunk):
"""Returns the directory entry found in chunk"""
dir_names = ('inode', 'rec_len', 'name_len', 'file_type', 'name')
dir_names = ('inode', 'rec_len', 'name_len', 'fileType', 'name')
dir_fmt = '<IHBB' + str(len(chunk) - 8) + 's'
dir_dict = dict(zip(dir_names, unpack(dir_fmt, chunk)))
@@ -284,7 +284,7 @@ class ChromeOSImage:
block_dict = {}
for block_id in block_ids:
percent = int(35 + 60 * block_ids.index(block_id) / len(block_ids))
self.progress.update(percent, config.get_localized_string(70816))
self.progress.update(percent, config.getLocalizedString(70816))
seek_pos = self.part_offset + self.blocksize * block_id
self.seek_stream(seek_pos)
block_dict[block_id] = self.read_stream(self.blocksize)
+2 -2
View File
@@ -28,7 +28,7 @@ class Mailbox:
def waitForMail(self, timeout=50):
info = 'verifica tramite mail richiesta dal sito, sono in attesa di nuove mail sulla casella ' + self.address
# info += '\nTimeout tra ' + str(timeout) + ' secondi'
dialog = platformtools.dialog_progress(config.get_localized_string(20000), info)
dialog = platformtools.dialogProgress(config.getLocalizedString(20000), info)
secs = 0
while secs < timeout:
msg = self.readLast()
@@ -113,7 +113,7 @@ class Gmailnator(Mailbox):
if e.success and e.data:
return e.data
else:
platformtools.dialog_ok(config.get_localized_string(20000), 'Impossibile ottenere una mail temporanea')
platformtools.dialogOk(config.getLocalizedString(20000), 'Impossibile ottenere una mail temporanea')
def inbox(self):
#[{"content":"\n\t\t\t\t<a href=\"https:\/\/gmailnator.com\/jonathanmichaeltmp\/messageid\/#174f933a17b5f625\">\n\t\t\t\t\t<table class=\"message_container\">\n\t\t\t\t\t\t<tbody>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>dsds<\/td>\n\t\t\t\t\t\t\t\t<td>body<\/td>\n\t\t\t\t\t\t\t\t<td class=\"text-right\">one minute ago<\/td>\n\t\t\t\t\t\t\t<\/tr>\n\t\t\t\t\t\t<\/tbody>\n\t\t\t\t\t<\/table>\n\t\t\t\t<\/a>"}]
+36 -36
View File
@@ -153,7 +153,7 @@ def update_title(item):
item.channel = new_item.channel # Restoring the name of the channel, in case we had changed it
if item.tmdb_stat == True:
if new_item.contentSerieName: # If it's serial ...
filter_languages = config.get_setting("filter_languages", item.channel)
filter_languages = config.getSetting("filter_languages", item.channel)
if filter_languages and filter_languages >= 0:
item.title_from_channel = new_item.contentSerieName # I keep the initial title for Filtertools
item.contentSerieName = new_item.contentSerieName # I keep the initial title for Filtertools
@@ -223,7 +223,7 @@ def refresh_screen(item):
import xbmcgui
xlistitem = xbmcgui.ListItem(path=item.url) # We create xlistitem for compatibility with Kodi 18
if config.get_platform(True)['num_version'] >= 16.0:
if config.getXBMCPlatform(True)['num_version'] >= 16.0:
xlistitem.setArt({"thumb": item.contentThumbnail}) # We load the thumb
else:
xlistitem.setThumbnailImage(item.contentThumbnail)
@@ -234,7 +234,7 @@ def refresh_screen(item):
except:
logger.error(traceback.format_exc())
platformtools.itemlist_update(item) # we refresh the screen with the new Item
platformtools.itemlistUpdate(item) # we refresh the screen with the new Item
return xlistitem
@@ -328,7 +328,7 @@ def post_tmdb_listado(item, itemlist):
except:
logger.error(traceback.format_exc())
__modo_grafico__ = config.get_setting('modo_grafico', item.channel)
__modo_grafico__ = config.getSetting('modo_grafico', item.channel)
# If TMDB has not found the video we clean the year
if item_local.infoLabels['year'] == "-":
@@ -431,7 +431,7 @@ def post_tmdb_listado(item, itemlist):
title += title_add # Additional tags are added, if any
# Now we make up the titles a bit depending on whether smart titles have been selected or not
if not config.get_setting("unify"): # If Smart Titles NOT selected:
if not config.getSetting("unify"): # If Smart Titles NOT selected:
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, str(item_local.infoLabels['year']), rating, item_local.quality, str(item_local.language))
else: # If Smart Titles YES selected:
@@ -512,7 +512,7 @@ def post_tmdb_seasons(item, itemlist):
itemlist_temporadas = []
itemlist_fo = []
if config.get_setting("no_pile_on_seasons", 'videolibrary') == 2: # If you do not want to show seasonally, we are leaving ...
if config.getSetting("no_pile_on_seasons", 'videolibrary') == 2: # If you do not want to show seasonally, we are leaving ...
if item.season_colapse: # We remove the indicator from the list by Seasons
del item.season_colapse
return (item, itemlist)
@@ -558,13 +558,13 @@ def post_tmdb_seasons(item, itemlist):
if rating and rating == 0.0:
rating = ''
if not config.get_setting("unify"): # If Smart Titles NOT selected:
if not config.getSetting("unify"): # If Smart Titles NOT selected:
title = '%s [COLOR yellow][%s][/COLOR] [%s] [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (title, str(item_season.infoLabels['year']), rating, item_season.quality, str(item_season.language))
else: # We fixed it a bit for Unify
title = title.replace('[', '-').replace(']', '-').replace('.', ',').strip()
title = title.replace("--", "").replace("[]", "").replace("()", "").replace("(/)", "").replace("[/]", "").strip()
if config.get_setting("show_all_seasons", 'videolibrary'):
if config.getSetting("show_all_seasons", 'videolibrary'):
itemlist_temporadas.append(item_season.clone(title=title, from_title_season_colapse=item.title))
# We review all the episodes to detect the different seasons
@@ -577,7 +577,7 @@ def post_tmdb_seasons(item, itemlist):
itemlist_temporadas.append(item_season.clone(from_title_season_colapse=item.title))
# If there is more than one season it is followed, or it has been forced to list by seasons, if the original Itemlist is not returned
if len(itemlist_temporadas) > 2 or config.get_setting("no_pile_on_seasons", 'videolibrary') == 0:
if len(itemlist_temporadas) > 2 or config.getSetting("no_pile_on_seasons", 'videolibrary') == 0:
for item_local in itemlist_temporadas:
if "** Todas las Temporadas" in item_local.title: # If it's the title of ALL Seasons, we ignore it
continue
@@ -604,7 +604,7 @@ def post_tmdb_seasons(item, itemlist):
if item_local.infoLabels['temporada_num_episodes']: # No. of Temp Episodes
item_local.title += ' [%s epi]' % str(item_local.infoLabels['temporada_num_episodes'])
if not config.get_setting("unify"): # If Smart Titles NOT selected:
if not config.getSetting("unify"): # If Smart Titles NOT selected:
item_local.title = '%s [COLOR limegreen][%s][/COLOR] [COLOR red]%s[/COLOR]' % (item_local.title, item_local.quality, str(item_local.language))
else: # We fixed it a bit for Unify
item_local.title = item_local.title.replace("[", "-").replace("]", "-").replace(".", ",").replace("GB", "G B").replace("Gb", "G b").replace("gb", "g b").replace("MB", "M B").replace("Mb", "M b").replace("mb", "m b")
@@ -667,11 +667,11 @@ def post_tmdb_episodes(item, itemlist):
# logger.debug(item)
modo_serie_temp = ''
if config.get_setting('seleccionar_serie_temporada', item.channel) >= 0:
modo_serie_temp = config.get_setting('seleccionar_serie_temporada', item.channel)
if config.getSetting('seleccionar_serie_temporada', item.channel) >= 0:
modo_serie_temp = config.getSetting('seleccionar_serie_temporada', item.channel)
modo_ultima_temp = ''
if config.get_setting('seleccionar_ult_temporadda_activa', item.channel) is True or config.get_setting('seleccionar_ult_temporadda_activa', item.channel) is False:
modo_ultima_temp = config.get_setting('seleccionar_ult_temporadda_activa', item.channel)
if config.getSetting('seleccionar_ult_temporadda_activa', item.channel) is True or config.getSetting('seleccionar_ult_temporadda_activa', item.channel) is False:
modo_ultima_temp = config.getSetting('seleccionar_ult_temporadda_activa', item.channel)
# Initiates variables to control the number of episodes per season
num_episodes = 1
@@ -1015,16 +1015,16 @@ def post_tmdb_findvideos(item, itemlist):
# logger.debug(item)
# Know if we are in a popup window launched from a bullet in the main menu,
# with the function "play_from_library"
# with the function "playFromLibrary"
item.unify = False
Window_IsMedia = False
try:
import xbmc
if xbmc.getCondVisibility('Window.IsMedia') == 1:
Window_IsMedia = True
item.unify = config.get_setting("unify")
item.unify = config.getSetting("unify")
except:
item.unify = config.get_setting("unify")
item.unify = config.getSetting("unify")
logger.error(traceback.format_exc())
if item.contentSeason_save: # We restore the num. seasonal
@@ -1097,7 +1097,7 @@ def post_tmdb_findvideos(item, itemlist):
tiempo = 0
if item.infoLabels['duration']:
try:
if config.get_platform(True)['num_version'] < 18 or not Window_IsMedia:
if config.getXBMCPlatform(True)['num_version'] < 18 or not Window_IsMedia:
tiempo = item.infoLabels['duration']
elif xbmc.getCondVisibility('Window.IsMedia') == 1:
item.quality = re.sub(r'\s?\[\d+:\d+\ h]', '', item.quality)
@@ -1176,7 +1176,7 @@ def post_tmdb_findvideos(item, itemlist):
if item.channel_alt:
title_gen = '[COLOR yellow]%s [/COLOR][ALT]: %s' % (item.category.capitalize(), title_gen)
# elif (config.get_setting("quit_channel_name", "videolibrary") == 1 or item.channel == channel_py) and item.contentChannel == "videolibrary":
# elif (config.getSetting("quit_channel_name", "videolibrary") == 1 or item.channel == channel_py) and item.contentChannel == "videolibrary":
else:
title_gen = '[COLOR white]%s: %s' % (item.category.capitalize(), title_gen)
@@ -1230,10 +1230,10 @@ def get_field_from_kodi_DB(item, from_fields='*', files='file'):
"""
FOLDER_MOVIES = config.get_setting("folder_movies")
FOLDER_TVSHOWS = config.get_setting("folder_tvshows")
VIDEOLIBRARY_PATH = config.get_videolibrary_config_path()
VIDEOLIBRARY_REAL_PATH = config.get_videolibrary_path()
FOLDER_MOVIES = config.getSetting("folder_movies")
FOLDER_TVSHOWS = config.getSetting("folder_tvshows")
VIDEOLIBRARY_PATH = config.getVideolibraryConfigPath()
VIDEOLIBRARY_REAL_PATH = config.getVideolibraryPath()
if item.contentType == 'movie': # I add the folder corresponding to the path of the Video Library
path = filetools.join(VIDEOLIBRARY_REAL_PATH, FOLDER_MOVIES)
@@ -1324,7 +1324,7 @@ def fail_over_newpct1(item, patron, patron2=None, timeout=None):
# logger.debug(item)
if timeout == None:
timeout = config.get_setting('clonenewpct1_timeout_downloadpage', channel_py) # Timeout downloadpage
timeout = config.getSetting('clonenewpct1_timeout_downloadpage', channel_py) # Timeout downloadpage
if timeout == 0: timeout = None
if item.action == "search" or item.action == "listado_busqueda": timeout = timeout * 2 # More time for searches
@@ -1563,9 +1563,9 @@ def web_intervenida(item, data, desactivar=True):
# We save the changes made in the .json
try:
if item.channel != channel_py:
disabled = config.set_setting('enabled', False, item.channel) # We deactivate the channel
disabled = config.set_setting('include_in_global_search', False, item.channel) # We get it out of global searches
channel_path = filetools.join(config.get_runtime_path(), "channels", item.channel + ".json")
disabled = config.setSetting('enabled', False, item.channel) # We deactivate the channel
disabled = config.setSetting('include_in_global_search', False, item.channel) # We get it out of global searches
channel_path = filetools.join(config.getRuntimePath(), "channels", item.channel + ".json")
with open(channel_path, 'w') as outfile: # We record the updated .json
json.dump(json_data, outfile, sort_keys = True, indent = 2, ensure_ascii = False)
except:
@@ -1590,20 +1590,20 @@ def regenerate_clones():
try:
# Find the paths where to leave the control .json file, and the Video Library
json_path = filetools.exists(filetools.join(config.get_runtime_path(), 'verify_cached_torrents.json'))
json_path = filetools.exists(filetools.join(config.getRuntimePath(), 'verify_cached_torrents.json'))
if json_path:
logger.debug('Previously repaired video library: WE ARE GOING')
return False
json_path = filetools.join(config.get_runtime_path(), 'verify_cached_torrents.json')
json_path = filetools.join(config.getRuntimePath(), 'verify_cached_torrents.json')
filetools.write(json_path, json.dumps({"CINE_verify": True})) # Prevents another simultaneous process from being launched
json_error_path = filetools.join(config.get_runtime_path(), 'error_cached_torrents.json')
json_error_path_BK = filetools.join(config.get_runtime_path(), 'error_cached_torrents_BK.json')
json_error_path = filetools.join(config.getRuntimePath(), 'error_cached_torrents.json')
json_error_path_BK = filetools.join(config.getRuntimePath(), 'error_cached_torrents_BK.json')
videolibrary_path = config.get_videolibrary_path() # We calculate the absolute path from the Video Library
movies = config.get_setting("folder_movies")
series = config.get_setting("folder_tvshows")
torrents_movies = filetools.join(videolibrary_path, config.get_setting("folder_movies")) # path of CINE
torrents_series = filetools.join(videolibrary_path, config.get_setting("folder_tvshows")) # path the SERIES
videolibrary_path = config.getVideolibraryPath() # We calculate the absolute path from the Video Library
movies = config.getSetting("folder_movies")
series = config.getSetting("folder_tvshows")
torrents_movies = filetools.join(videolibrary_path, config.getSetting("folder_movies")) # path of CINE
torrents_series = filetools.join(videolibrary_path, config.getSetting("folder_tvshows")) # path the SERIES
# We load in .json from Newpct1 to see the lists of values in settings
fail_over_list = channeltools.get_channel_json(channel_py)
+5 -5
View File
@@ -21,14 +21,14 @@ class Client(object):
'.m4v': 'video/mp4', '.mov': 'video/quicktime', '.mpg': 'video/mpeg','.ogv': 'video/ogg',
'.ogg': 'video/ogg', '.webm': 'video/webm', '.ts': 'video/mp2t', '.3gp': 'video/3gpp'}
def __init__(self, url, port=None, ip=None, auto_shutdown=True, wait_time=20, timeout=5, is_playing_fnc=None):
def __init__(self, url, port=None, ip=None, auto_shutdown=True, wait_time=20, timeout=5, isPlaying_fnc=None):
self.port = port if port else random.randint(8000,8099)
self.ip = ip if ip else "127.0.0.1"
self.connected = False
self.start_time = None
self.last_connect = None
self.is_playing_fnc = is_playing_fnc
self.isPlaying_fnc = isPlaying_fnc
self.auto_shutdown = auto_shutdown
self.wait_time = wait_time
self.timeout = timeout
@@ -55,12 +55,12 @@ class Client(object):
if self.file and self.file.cursor:
self.last_connect = time.time()
if self.is_playing_fnc and self.is_playing_fnc():
if self.isPlaying_fnc and self.isPlaying_fnc():
self.last_connect = time.time()
if self.auto_shutdown:
#shudown por haber cerrado el reproductor
if self.connected and self.last_connect and self.is_playing_fnc and not self.is_playing_fnc():
if self.connected and self.last_connect and self.isPlaying_fnc and not self.isPlaying_fnc():
if time.time() - self.last_connect - 1 > self.timeout:
self.stop()
@@ -70,7 +70,7 @@ class Client(object):
self.stop()
#shutdown tras la ultima conexion
if (not self.file or not self.file.cursor) and self.timeout and self.connected and self.last_connect and not self.is_playing_fnc:
if (not self.file or not self.file.cursor) and self.timeout and self.connected and self.last_connect and not self.isPlaying_fnc:
if time.time() - self.last_connect - 1 > self.timeout:
self.stop()
+4 -4
View File
@@ -218,22 +218,22 @@ class MultipartEncoder(object):
_fields = list(self.fields.items())
for k, v in _fields:
file_name = None
file_type = None
fileType = None
file_headers = None
if isinstance(v, (list, tuple)):
if len(v) == 2:
file_name, file_pointer = v
elif len(v) == 3:
file_name, file_pointer, file_type = v
file_name, file_pointer, fileType = v
else:
file_name, file_pointer, file_type, file_headers = v
file_name, file_pointer, fileType, file_headers = v
else:
file_pointer = v
field = fields.RequestField(name=k, data=file_pointer,
filename=file_name,
headers=file_headers)
field.make_multipart(content_type=file_type)
field.make_multipart(content_type=fileType)
yield field
def _prepare_parts(self):
+10 -10
View File
@@ -19,14 +19,14 @@ from lib.streamingcommunity.server import Server
class Client(object):
def __init__(self, url, port=None, ip=None, auto_shutdown=True, wait_time=20, timeout=5, is_playing_fnc=None, video_id=None):
def __init__(self, url, port=None, ip=None, auto_shutdown=True, wait_time=20, timeout=5, isPlaying_fnc=None, video_id=None):
self.port = port if port else random.randint(8000,8099)
self.ip = ip if ip else "127.0.0.1"
self.connected = False
self.start_time = None
self.last_connect = None
self.is_playing_fnc = is_playing_fnc
self.isPlaying_fnc = isPlaying_fnc
self.auto_shutdown = auto_shutdown
self.wait_time = wait_time
self.timeout = timeout
@@ -71,12 +71,12 @@ class Client(object):
if self.file and self.file.cursor:
self.last_connect = time.time()
if self.is_playing_fnc and self.is_playing_fnc():
if self.isPlaying_fnc and self.isPlaying_fnc():
self.last_connect = time.time()
if self.auto_shutdown:
#shudown por haber cerrado el reproductor
if self.connected and self.last_connect and self.is_playing_fnc and not self.is_playing_fnc():
if self.connected and self.last_connect and self.isPlaying_fnc and not self.isPlaying_fnc():
if time.time() - self.last_connect - 1 > self.timeout:
self.stop()
@@ -86,7 +86,7 @@ class Client(object):
self.stop()
#shutdown tras la ultima conexion
if (not self.file or not self.file.cursor) and self.timeout and self.connected and self.last_connect and not self.is_playing_fnc:
if (not self.file or not self.file.cursor) and self.timeout and self.connected and self.last_connect and not self.isPlaying_fnc:
if time.time() - self.last_connect - 1 > self.timeout:
self.stop()
@@ -124,11 +124,11 @@ class Client(object):
for match in r_video.finditer(m3u8_original):
line = match.groups()[0]
res = match.groups()[1]
video_url = "/video/" + res + ".m3u8"
videoUrl = "/video/" + res + ".m3u8"
# logger.info('replace', match.groups(), line, res, video_url)
# logger.info('replace', match.groups(), line, res, videoUrl)
m3u8_original = m3u8_original.replace( line, video_url )
m3u8_original = m3u8_original.replace( line, videoUrl )
for match in r_audio.finditer(m3u8_original):
@@ -146,10 +146,10 @@ class Client(object):
# m_audio = re.search(r'\.\/audio\/(\d+k)\/playlist.m3u8', m3u8_original)
# self._audio_res = m_audio.group(1)
# video_url = "/video/" + self._video_res + ".m3u8"
# videoUrl = "/video/" + self._video_res + ".m3u8"
# audio_url = "/audio/" + self._audio_res + ".m3u8"
# m3u8_original = m3u8_original.replace( m_video.group(0), video_url )
# m3u8_original = m3u8_original.replace( m_video.group(0), videoUrl )
# m3u8_original = m3u8_original.replace( m_audio.group(0), audio_url )
return m3u8_original
+1 -1
View File
@@ -427,7 +427,7 @@ class PyOpenSSLContext(object):
@options.setter
def options(self, value):
self._options = value
self._ctx.set_options(value)
self._ctx.setOptions(value)
@property
def verify_mode(self):
+1 -1
View File
@@ -11,7 +11,7 @@ try:
except:
pass
librerias = xbmc.translatePath(os.path.join(config.get_runtime_path(), 'lib'))
librerias = xbmc.translatePath(os.path.join(config.getRuntimePath(), 'lib'))
sys.path.insert(0, librerias)
+22 -22
View File
@@ -39,7 +39,7 @@ def check(item, itemlist=None):
def filename(item):
logger.debug()
name_file = item.channel + "_data.json"
path = filetools.join(config.get_data_path(), "settings_channels")
path = filetools.join(config.getDataPath(), "settings_channels")
fname = filetools.join(path, name_file)
return fname
@@ -70,7 +70,7 @@ def b64(json, mode = 'encode'):
def find_episodes(item):
logger.debug()
ch = platformtools.channel_import(item.channel)
ch = platformtools.channelImport(item.channel)
itemlist = getattr(ch, item.action)(item)
return itemlist
@@ -113,7 +113,7 @@ class autorenumber():
from core.videolibrarytools import check_renumber_options
check_renumber_options(self.item)
self.renumberdict = load(item)
self.auto = config.get_setting('autorenumber', item.channel)
self.auto = config.getSetting('autorenumber', item.channel)
self.title = self.item.fulltitle.strip()
if item.contentSeason:
item.exit = True
@@ -137,7 +137,7 @@ class autorenumber():
self.renumberdict = {}
for item in self.itemlist:
if item.contentType != 'movie':
item.context = [{"title": typo(config.get_localized_string(70585), 'bold'),
item.context = [{"title": typo(config.getLocalizedString(70585), 'bold'),
"action": "start",
"channel": "autorenumber",
"from_channel": item.channel,
@@ -161,7 +161,7 @@ class autorenumber():
while not self.item.exit:
tmdb.find_and_set_infoLabels(self.item)
if self.item.infoLabels['tmdb_id']: self.item.exit = True
else:self.item = platformtools.dialog_info(self.item, 'tmdb')
else:self.item = platformtools.dialogInfo(self.item, 'tmdb')
# Rinumerazione Automatica
if (not self.id and self.auto) or self.item.setrenumber:
@@ -313,7 +313,7 @@ def SelectreNumeration(opt, itemlist, manual=False):
def onInit(self):
# Compatibility with Kodi 18
if config.get_platform(True)['num_version'] < 18: self.setCoordinateResolution(2)
if config.getXBMCPlatform(True)['num_version'] < 18: self.setCoordinateResolution(2)
fanart = self.item.fanart
thumb = self.item.thumbnail
self.getControl(SELECT).setVisible(False)
@@ -324,7 +324,7 @@ def SelectreNumeration(opt, itemlist, manual=False):
self.getControl(MANUAL).setVisible(True)
self.getControl(MPOSTER).setImage(thumb)
if fanart: self.getControl(MBACKGROUND).setImage(fanart)
self.getControl(INFO).setLabel(typo(config.get_localized_string(70822) + self.title, 'bold'))
self.getControl(INFO).setLabel(typo(config.getLocalizedString(70822) + self.title, 'bold'))
self.manual = True
@@ -366,7 +366,7 @@ def SelectreNumeration(opt, itemlist, manual=False):
if fanart:
self.getControl(BACKGROUND).setImage(fanart)
self.getControl(MBACKGROUND).setImage(fanart)
self.getControl(INFO).setLabel(typo(config.get_localized_string(70824) + self.title, 'bold'))
self.getControl(INFO).setLabel(typo(config.getLocalizedString(70824) + self.title, 'bold'))
self.getControl(LIST).addItems(self.items)
self.getControl(SELECTED).addItems(self.selected)
@@ -383,19 +383,19 @@ def SelectreNumeration(opt, itemlist, manual=False):
def onFocus(self, focus):
if focus in [S]:
self.getControl(108).setLabel(typo(config.get_localized_string(70825), 'bold'))
self.getControl(108).setLabel(typo(config.getLocalizedString(70825), 'bold'))
elif focus in [E]:
self.getControl(108).setLabel(typo(config.get_localized_string(70826), 'bold'))
self.getControl(108).setLabel(typo(config.getLocalizedString(70826), 'bold'))
elif focus in [O]:
self.getControl(108).setLabel(typo(config.get_localized_string(70001), 'bold'))
self.getControl(108).setLabel(typo(config.getLocalizedString(70001), 'bold'))
elif focus in [SS]:
self.getControl(108).setLabel(typo(config.get_localized_string(70827), 'bold'))
self.getControl(108).setLabel(typo(config.getLocalizedString(70827), 'bold'))
elif focus in [M]:
self.getControl(108).setLabel(typo(config.get_localized_string(70828), 'bold'))
self.getControl(108).setLabel(typo(config.getLocalizedString(70828), 'bold'))
elif focus in [D]:
self.getControl(108).setLabel(typo(config.get_localized_string(70829) + self.title, 'bold'))
self.getControl(108).setLabel(typo(config.getLocalizedString(70829) + self.title, 'bold'))
elif focus in [C]:
self.getControl(108).setLabel(typo(config.get_localized_string(70002), 'bold'))
self.getControl(108).setLabel(typo(config.getLocalizedString(70002), 'bold'))
def onAction(self, action):
action = action.getId()
@@ -470,11 +470,11 @@ def SelectreNumeration(opt, itemlist, manual=False):
def onClick(self, control_id):
## FIRST SECTION
if control_id in [S]:
selected = platformtools.dialog_numeric(0, config.get_localized_string(70825),
selected = platformtools.dialogNumeric(0, config.getLocalizedString(70825),
self.getControl(S).getLabel())
if selected: s = self.getControl(S).setLabel(selected)
elif control_id in [E]:
selected = platformtools.dialog_numeric(0, config.get_localized_string(70826),
selected = platformtools.dialogNumeric(0, config.getLocalizedString(70826),
self.getControl(E).getLabel())
if selected: e = self.getControl(E).setLabel(selected)
# OPEN SPECIALS OR OK
@@ -491,7 +491,7 @@ def SelectreNumeration(opt, itemlist, manual=False):
self.setFocusId(OK)
# OPEN MANUAL
elif control_id in [M]:
self.getControl(INFO).setLabel(typo(config.get_localized_string(70823) + self.title, 'bold'))
self.getControl(INFO).setLabel(typo(config.getLocalizedString(70823) + self.title, 'bold'))
self.manual = True
if self.episodes:
items = []
@@ -588,7 +588,7 @@ def SelectreNumeration(opt, itemlist, manual=False):
self.getControl(SELECTED).selectItem(index)
# RELOAD SPECIALS
if control_id in [SELECTED]:
epnumber = platformtools.dialog_numeric(0, config.get_localized_string(60386))
epnumber = platformtools.dialogNumeric(0, config.getLocalizedString(60386))
if epnumber:
it = self.getControl(SELECTED).getSelectedItem()
it.setLabel(str(epnumber))
@@ -613,10 +613,10 @@ def SelectreNumeration(opt, itemlist, manual=False):
e = int(self.getControl(MLIST).getSelectedItem().getProperty('episode'))
pos = self.getControl(MLIST).getSelectedPosition()
if control_id in [MS]:
selected = platformtools.dialog_numeric(0, config.get_localized_string(70825), str(s))
selected = platformtools.dialogNumeric(0, config.getLocalizedString(70825), str(s))
if selected: s = int(selected)
elif control_id in [ME]:
selected = platformtools.dialog_numeric(0, config.get_localized_string(70826), str(e))
selected = platformtools.dialogNumeric(0, config.getLocalizedString(70826), str(e))
if selected: e = int(selected)
if s != self.season or e != self.episode:
self.season = s
@@ -740,4 +740,4 @@ DOWN = 4
EXIT = 10
BACKSPACE = 92
path = config.get_runtime_path()
path = config.getRuntimePath()
+10 -10
View File
@@ -25,12 +25,12 @@ videolibrary_tvshows_path = unicode(videolibrarytools.TVSHOWS_PATH)
def export_videolibrary(item):
logger.info()
zip_file_folder = platformtools.dialog_browse(3, config.get_localized_string(80002))
zip_file_folder = platformtools.dialogBrowse(3, config.getLocalizedString(80002))
if zip_file_folder == "":
return
zip_file = unicode(xbmc.translatePath(zip_file_folder + "KoD_video_library-" + str(datetime.date.today()) + ".zip"))
p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(80003))
p_dialog = platformtools.dialogProgressBg(config.getLocalizedString(20000), config.getLocalizedString(80003))
# p_dialog.update(0)
if filetools.exists(videolibrary_temp_path):
@@ -50,19 +50,19 @@ def export_videolibrary(item):
p_dialog.update(100)
xbmc.sleep(1000)
p_dialog.close()
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(80004), time=5000, sound=False)
platformtools.dialogNotification(config.getLocalizedString(20000), config.getLocalizedString(80004), time=5000, sound=False)
def import_videolibrary(item):
logger.info()
zip_file = unicode(platformtools.dialog_browse(1, config.get_localized_string(80005), mask=".zip"))
zip_file = unicode(platformtools.dialogBrowse(1, config.getLocalizedString(80005), mask=".zip"))
if zip_file == "":
return
if not platformtools.dialog_yesno(config.get_localized_string(20000), config.get_localized_string(80006)):
if not platformtools.dialogYesNo(config.getLocalizedString(20000), config.getLocalizedString(80006)):
return
p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(80007))
p_dialog = platformtools.dialogProgressBg(config.getLocalizedString(20000), config.getLocalizedString(80007))
# p_dialog.update(0)
if filetools.exists(temp_path):
@@ -72,14 +72,14 @@ def import_videolibrary(item):
unzip(videolibrary_temp_path, zip_file)
p_dialog.update(20)
if config.is_xbmc() and config.get_setting("videolibrary_kodi"):
if config.is_xbmc() and config.getSetting("videolibrary_kodi"):
xbmc_videolibrary.clean()
p_dialog.update(30)
shutil.rmtree(videolibrary_movies_path)
shutil.rmtree(videolibrary_tvshows_path)
p_dialog.update(50)
config.verify_directories_created()
config.verifyDirectoriesCreated()
if filetools.exists(movies_path):
copy_tree(movies_path, videolibrary_movies_path)
p_dialog.update(70)
@@ -91,10 +91,10 @@ def import_videolibrary(item):
p_dialog.update(100)
xbmc.sleep(1000)
p_dialog.close()
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(80008), time=5000, sound=False)
platformtools.dialogNotification(config.getLocalizedString(20000), config.getLocalizedString(80008), time=5000, sound=False)
videolibrary.update_videolibrary()
if config.is_xbmc() and config.get_setting("videolibrary_kodi"):
if config.is_xbmc() and config.getSetting("videolibrary_kodi"):
xbmc_videolibrary.update()
+8 -8
View File
@@ -184,13 +184,13 @@ class Kdicc():
txt += '\nIP: %s' % self.ip_addr
dialog = xbmcgui.Dialog()
if config.get_setting('checkdns'):
risposta= dialog.yesno(addonname, txt, nolabel=config.get_localized_string(707403), yeslabel=config.get_localized_string(707404))
if config.getSetting('checkdns'):
risposta= dialog.yesno(addonname, txt, nolabel=config.getLocalizedString(707403), yeslabel=config.getLocalizedString(707404))
if risposta == False:
config.set_setting('checkdns', False)
dialog.textviewer(addonname+' '+config.get_localized_string(707405), config.get_localized_string(707406))
config.setSetting('checkdns', False)
dialog.textviewer(addonname+' '+config.getLocalizedString(707405), config.getLocalizedString(707406))
else:
txt = config.get_localized_string(707402)
txt = config.getLocalizedString(707402)
dialog.notification(addonname, txt, xbmcgui.NOTIFICATION_INFO, 10000)
"""
def called in launcher.py
@@ -204,20 +204,20 @@ def test_conn(is_exit, check_dns, view_msg,
# I don't let you get into the addon
# enter language code
if view_msg == True:
ktest.view_Advise(config.get_localized_string(70720))
ktest.view_Advise(config.getLocalizedString(70720))
if ktest.is_exit == True:
exit()
# if it has no ADSL connection, I will communicate it to the user
if not ktest.check_Adsl():
if view_msg == True:
ktest.view_Advise(config.get_localized_string(70721))
ktest.view_Advise(config.getLocalizedString(70721))
if ktest.is_exit == True:
exit()
# if it has DNS filtered, I will communicate it to the user
if check_dns == True:
if not ktest.check_Dns():
if view_msg == True:
ktest.view_Advise(config.get_localized_string(70722))
ktest.view_Advise(config.getLocalizedString(70722))
logger.info("############ Start Check DNS ############")
logger.info("## IP: %s" % (ktest.ip_addr))
+127 -74
View File
@@ -12,33 +12,35 @@ PLUGIN_NAME = "kod"
__settings__ = xbmcaddon.Addon(id="plugin.video." + PLUGIN_NAME)
__language__ = __settings__.getLocalizedString
__version_fix = None
__dev_mode = None
__devMode = None
channels_data = dict()
channelsData = dict()
changelogFile = xbmc.translatePath("special://profile/addon_data/plugin.video.kod/changelog.txt")
addonIcon = os.path.join(__settings__.getAddonInfo( "path" ),'resources', 'media', "logo.png" )
def get_addon_core():
def getAddonCore():
return __settings__
def get_addon_version(with_fix=True):
def getAddonVersion(with_fix=True):
'''
Returns the version number of the addon, and optionally fix number if there is one
'''
if with_fix:
return __settings__.getAddonInfo('version') + " " + get_addon_version_fix()
return __settings__.getAddonInfo('version') + " " + getAddonVersionFix()
else:
return __settings__.getAddonInfo('version')
def get_addon_version_fix():
def getAddonVersionFix():
global __version_fix
ret = __version_fix
if not ret:
if not dev_mode():
if not devMode():
try:
sha = open(os.path.join(get_runtime_path(), 'last_commit.txt')).readline()
sha = open(os.path.join(getRuntimePath(), 'last_commit.txt')).readline()
ret = sha[:7]
except:
ret = '??'
@@ -47,14 +49,14 @@ def get_addon_version_fix():
return ret
def dev_mode():
global __dev_mode
if not __dev_mode:
__dev_mode = os.path.isdir(get_runtime_path() + '/.git')
return __dev_mode
def devMode():
global __devMode
if not __devMode:
__devMode = os.path.isdir(getRuntimePath() + '/.git')
return __devMode
def get_platform(full_version=False):
def getXBMCPlatform(full_version=False):
"""
Returns the information the version of xbmc or kodi on which the plugin is run
@@ -95,6 +97,57 @@ def get_platform(full_version=False):
else:
return ret['platform']
def getPlatform():
import platform
build = xbmc.getInfoLabel("System.BuildVersion")
kodi_version = int(build.split()[0][:2])
ret = {
"auto_arch": sys.maxsize > 2 ** 32 and "64-bit" or "32-bit",
"arch": sys.maxsize > 2 ** 32 and "x64" or "ia32",
"os": "",
"version": platform.release(),
"kodi": kodi_version,
"build": build
}
if xbmc.getCondVisibility("system.platform.android"):
ret["os"] = "android"
if "arm" in platform.machine() or "aarch" in platform.machine():
ret["arch"] = "arm"
if "64" in platform.machine() and ret["auto_arch"] == "64-bit":
ret["arch"] = "arm64"
elif xbmc.getCondVisibility("system.platform.linux"):
ret["os"] = "linux"
if "aarch" in platform.machine() or "arm64" in platform.machine():
if xbmc.getCondVisibility("system.platform.linux.raspberrypi"):
ret["arch"] = "armv7"
elif ret["auto_arch"] == "32-bit":
ret["arch"] = "armv7"
elif ret["auto_arch"] == "64-bit":
ret["arch"] = "arm64"
elif platform.architecture()[0].startswith("32"):
ret["arch"] = "arm"
else:
ret["arch"] = "arm64"
elif "armv7" in platform.machine():
ret["arch"] = "armv7"
elif "arm" in platform.machine():
ret["arch"] = "arm"
elif xbmc.getCondVisibility("system.platform.xbox"):
ret["os"] = "win"
ret["arch"] = "x64"
elif xbmc.getCondVisibility("system.platform.windows"):
ret["os"] = "win"
if platform.machine().endswith('64'):
ret["arch"] = "x64"
elif xbmc.getCondVisibility("system.platform.osx"):
ret["os"] = "mac"
ret["arch"] = "x64"
elif xbmc.getCondVisibility("system.platform.ios"):
ret["os"] = "ios"
ret["arch"] = "arm"
return ret
def is_xbmc():
return True
@@ -108,26 +161,26 @@ def get_channel_url(findhostMethod=None, name=None, forceFindhost=False):
from core import jsontools
import inspect
LOCAL_FILE = os.path.join(get_runtime_path(), "channels.json")
global channels_data
if not channels_data:
LOCAL_FILE = os.path.join(getRuntimePath(), "channels.json")
global channelsData
if not channelsData:
with open(LOCAL_FILE) as f:
channels_data = jsontools.load(f.read())
channelsData = jsontools.load(f.read())
frame = inspect.stack()[1]
if not name:
name = os.path.basename(frame[0].f_code.co_filename).replace('.py', '')
if findhostMethod:
url = jsontools.get_node_from_file(name, 'url')
url = jsontools.getNodeFromFile(name, 'url')
if not url or forceFindhost:
url = findhostMethod(channels_data['findhost'][name])
jsontools.update_node(url, name, 'url')
url = findhostMethod(channelsData['findhost'][name])
jsontools.updateNode(url, name, 'url')
return url
else:
return channels_data['direct'][name]
return channelsData['direct'][name]
def get_system_platform():
def getSystemPlatform():
""" function: to recover the platform that xbmc is running """
platform = "unknown"
if xbmc.getCondVisibility("system.platform.linux"):
@@ -139,35 +192,35 @@ def get_system_platform():
return platform
def get_all_settings_addon():
def getAllSettingsAddon():
# Read the settings.xml file and return a dictionary with {id: value}
from core import scrapertools
with open(os.path.join(get_data_path(), "settings.xml"), "rb") as infile:
with open(os.path.join(getDataPath(), "settings.xml"), "rb") as infile:
data = infile.read().decode('utf-8')
ret = {}
matches = scrapertools.find_multiple_matches(data, '<setting id=\"([^\"]+)\"[^>]*>')
matches = scrapertools.findMultipleMatches(data, '<setting id=\"([^\"]+)\"[^>]*>')
for _id in matches:
ret[_id] = get_setting(_id)
ret[_id] = getSetting(_id)
return ret
def open_settings():
def openSettings():
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.%s)' % PLUGIN_NAME)
def get_setting(name, channel="", server="", default=None):
def getSetting(name, channel="", server="", default=None):
"""
Returns the configuration value of the requested parameter.
Returns the value of the parameter 'name' in the global configuration, in the own configuration of the channel 'channel' or in that of the server 'server'.
The channel and server parameters should not be used simultaneously. If the channel name is specified it will be returned
the result of calling channeltools.get_channel_setting (name, channel, default). If the name of the
server will return the result of calling servertools.get_channel_setting (name, server, default). If I dont know
the result of calling channeltools.getChannelSetting (name, channel, default). If the name of the
server will return the result of calling servertools.getChannelSetting (name, server, default). If I dont know
Specify none of the above will return the value of the parameter in the global configuration if it exists or
the default value otherwise.
@@ -187,23 +240,23 @@ def get_setting(name, channel="", server="", default=None):
# Specific channel setting
if channel:
# logger.info("get_setting reading channel setting '"+name+"' from channel json")
# logger.info("getSetting reading channel setting '"+name+"' from channel json")
from core import channeltools
value = channeltools.get_channel_setting(name, channel, default)
# logger.info("get_setting -> '"+repr(value)+"'")
value = channeltools.getChannelSetting(name, channel, default)
# logger.info("getSetting -> '"+repr(value)+"'")
return value
# Specific server setting
elif server:
# logger.info("get_setting reading server setting '"+name+"' from server json")
# logger.info("getSetting reading server setting '"+name+"' from server json")
from core import servertools
value = servertools.get_server_setting(name, server, default)
# logger.info("get_setting -> '"+repr(value)+"'")
value = servertools.getServerSetting(name, server, default)
# logger.info("getSetting -> '"+repr(value)+"'")
return value
# Global setting
else:
# logger.info("get_setting reading main setting '"+name+"'")
# logger.info("getSetting reading main setting '"+name+"'")
value = __settings__.getSetting(name)
if not value:
return default
@@ -225,7 +278,7 @@ def get_setting(name, channel="", server="", default=None):
return value
def set_setting(name, value, channel="", server=""):
def setSetting(name, value, channel="", server=""):
"""
Sets the configuration value of the indicated parameter.
@@ -249,10 +302,10 @@ def set_setting(name, value, channel="", server=""):
"""
if channel:
from core import channeltools
return channeltools.set_channel_setting(name, value, channel)
return channeltools.setChannelSetting(name, value, channel)
elif server:
from core import servertools
return servertools.set_server_setting(name, value, server)
return servertools.setServerSetting(name, value, server)
else:
try:
if isinstance(value, bool):
@@ -274,7 +327,7 @@ def set_setting(name, value, channel="", server=""):
return value
def get_localized_string(code):
def getLocalizedString(code):
dev = __language__(code)
try:
@@ -295,43 +348,43 @@ def get_localized_string(code):
return dev
def get_localized_category(categ):
categories = {'movie': get_localized_string(30122), 'tvshow': get_localized_string(30123),
'anime': get_localized_string(30124), 'documentary': get_localized_string(30125),
'vos': get_localized_string(30136), 'sub': get_localized_string(30136),
'direct': get_localized_string(30137), 'torrent': get_localized_string(70015),
'live': get_localized_string(30138), 'music': get_localized_string(30139)
def getLocalizedCategory(categ):
categories = {'movie': getLocalizedString(30122), 'tvshow': getLocalizedString(30123),
'anime': getLocalizedString(30124), 'documentary': getLocalizedString(30125),
'vos': getLocalizedString(30136), 'sub': getLocalizedString(30136),
'direct': getLocalizedString(30137), 'torrent': getLocalizedString(70015),
'live': getLocalizedString(30138), 'music': getLocalizedString(30139)
}
return categories[categ] if categ in categories else categ
def get_localized_language(lang):
def getLocalizedLanguage(lang):
languages = {'ita': 'ITA', 'sub-ita': 'Sub-ITA'}
return languages[lang] if lang in languages else lang
def get_videolibrary_config_path():
value = get_setting("videolibrarypath")
def getVideolibraryConfigPath():
value = getSetting("videolibrarypath")
if value == "":
verify_directories_created()
value = get_setting("videolibrarypath")
verifyDirectoriesCreated()
value = getSetting("videolibrarypath")
return value
def get_videolibrary_path():
return xbmc.translatePath(get_videolibrary_config_path())
def getVideolibraryPath():
return xbmc.translatePath(getVideolibraryConfigPath())
def get_temp_file(filename):
def getTempFile(filename):
return xbmc.translatePath(os.path.join("special://temp/", filename))
def get_runtime_path():
def getRuntimePath():
return xbmc.translatePath(__settings__.getAddonInfo('Path'))
def get_data_path():
def getDataPath():
dev = xbmc.translatePath(__settings__.getAddonInfo('Profile'))
# Create the directory if it doesn't exist
@@ -341,17 +394,17 @@ def get_data_path():
return dev
def get_icon():
def getIcon():
return xbmc.translatePath(__settings__.getAddonInfo('icon'))
def get_fanart():
def getFanart():
return xbmc.translatePath(__settings__.getAddonInfo('fanart'))
def get_cookie_data():
def getCookieData():
import os
ficherocookies = os.path.join(get_data_path(), 'cookies.dat')
ficherocookies = os.path.join(getDataPath(), 'cookies.dat')
cookiedatafile = open(ficherocookies, 'r')
cookiedata = cookiedatafile.read()
@@ -361,7 +414,7 @@ def get_cookie_data():
# Test if all the required directories are created
def verify_directories_created():
def verifyDirectoriesCreated():
from platformcode import logger
from core import filetools
from platformcode import xbmc_videolibrary
@@ -372,18 +425,18 @@ def verify_directories_created():
["settings_path", "settings_channels"]]
for path, default in config_paths:
saved_path = get_setting(path)
saved_path = getSetting(path)
# video store
if path == "videolibrarypath":
if not saved_path:
saved_path = xbmc_videolibrary.search_library_path()
if saved_path:
set_setting(path, saved_path)
setSetting(path, saved_path)
if not saved_path:
saved_path = "special://profile/addon_data/plugin.video." + PLUGIN_NAME + "/" + default
set_setting(path, saved_path)
setSetting(path, saved_path)
saved_path = xbmc.translatePath(saved_path)
if not filetools.exists(saved_path):
@@ -394,13 +447,13 @@ def verify_directories_created():
["folder_tvshows", "Serie TV"]]
for path, default in config_paths:
saved_path = get_setting(path)
saved_path = getSetting(path)
if not saved_path:
saved_path = default
set_setting(path, saved_path)
setSetting(path, saved_path)
content_path = filetools.join(get_videolibrary_path(), saved_path)
content_path = filetools.join(getVideolibraryPath(), saved_path)
if not filetools.exists(content_path):
logger.debug("Creating %s: %s" % (path, content_path))
@@ -408,8 +461,8 @@ def verify_directories_created():
filetools.mkdir(content_path)
from platformcode import xbmc_videolibrary
xbmc_videolibrary.update_sources(get_setting("videolibrarypath"))
xbmc_videolibrary.update_sources(get_setting("downloadpath"))
xbmc_videolibrary.update_sources(getSetting("videolibrarypath"))
xbmc_videolibrary.update_sources(getSetting("downloadpath"))
try:
from core import scrapertools
@@ -419,14 +472,14 @@ def verify_directories_created():
# We extract the name of the default resolution folder
folder = ""
data = filetools.read(skindir)
res = scrapertools.find_multiple_matches(data, '(<res .*?>)')
res = scrapertools.findMultipleMatches(data, '(<res .*?>)')
for r in res:
if 'default="true"' in r:
folder = scrapertools.find_single_match(r, 'folder="([^"]+)"')
break
# We check if it exists in the addon and if not, we create it
default = filetools.join(get_runtime_path(), 'resources', 'skins', 'Default')
default = filetools.join(getRuntimePath(), 'resources', 'skins', 'Default')
if folder and not filetools.exists(filetools.join(default, folder)):
filetools.mkdir(filetools.join(default, folder))
@@ -442,5 +495,5 @@ def verify_directories_created():
logger.error(traceback.format_exc())
def get_online_server_thumb(server):
def getOnlineServerThumb(server):
return "https://raw.github.com/kodiondemand/media/master/resources/servers/" + server.lower().replace('_server','') + '.png'
+5 -5
View File
@@ -2,14 +2,14 @@ import xbmc, sys, os
from platformcode import config, logger
import re
# incliuding folder libraries
librerias = xbmc.translatePath(os.path.join(config.get_runtime_path(), 'lib'))
librerias = xbmc.translatePath(os.path.join(config.getRuntimePath(), 'lib'))
sys.path.insert(0, librerias)
from core import tmdb
from core.item import Item
addon_id = config.get_addon_core().getAddonInfo('id')
addon_id = config.getAddonCore().getAddonInfo('id')
global item_is_coming_from_kod
@@ -26,10 +26,10 @@ def check_condition():
logger.debug('listitem mediatype:',mediatype )
logger.debug('filenamepath:', fileNameAndPath )
logger.info('filepath:', filePath )
item_is_coming_from_kod = addon_id in filePath
if not item_is_coming_from_kod:
videolibpath = config.get_setting("videolibrarypath")
videolibpath = config.getSetting("videolibrarypath")
if filePath.startswith(videolibpath):
pattern = re.compile("\[.*\][\\\/]?$")
item_is_coming_from_kod = pattern.search(filePath)
@@ -43,7 +43,7 @@ def check_condition():
def get_menu_items():
logger.debug('get menu item')
if check_condition():
return [(config.get_localized_string(90003 if item_is_coming_from_kod else 90005), execute)]
return [(config.getLocalizedString(90003 if item_is_coming_from_kod else 90005), execute)]
else:
return []
+1 -1
View File
@@ -5,7 +5,7 @@ from platformcode import config
def get_menu_items():
return [(config.get_localized_string(60359), execute)]
return [(config.getLocalizedString(60359), execute)]
def execute():
+8 -8
View File
@@ -2,7 +2,7 @@
import xbmc, sys, xbmcgui, os, xbmcvfs, traceback
from platformcode import config, logger
librerias = xbmc.translatePath(os.path.join(config.get_runtime_path(), 'lib'))
librerias = xbmc.translatePath(os.path.join(config.getRuntimePath(), 'lib'))
sys.path.insert(0, librerias)
from core.item import Item
@@ -52,7 +52,7 @@ def search_paths(Id):
for record in records:
path_records = execute_sql('SELECT strPath FROM path WHERE idPath LIKE "%s"' % record[0])
for path in path_records:
if config.get_setting('videolibrarypath') in path[0] and exists(join(path[0], 'tvshow.nfo')):
if config.getSetting('videolibrarypath') in path[0] and exists(join(path[0], 'tvshow.nfo')):
return path[0]
return ''
@@ -63,7 +63,7 @@ def execute_sql(sql):
records = None
# We look for the archive of the video database according to the version of kodi
video_db = config.get_platform(True)['video_db']
video_db = config.getXBMCPlatform(True)['video_db']
if video_db:
file_db = os.path.join(xbmc.translatePath("special://userdata/Database"), video_db)
@@ -130,7 +130,7 @@ def check_condition():
def get_menu_items():
logger.debug('get menu item')
if check_condition():
items = [(config.get_localized_string(70269), update)]
items = [(config.getLocalizedString(70269), update)]
from core.videolibrarytools import read_nfo
nfo = path + 'tvshow.nfo'
item = read_nfo(nfo)[1]
@@ -139,16 +139,16 @@ def get_menu_items():
item_url = item.tourl()
# Context menu: Automatically search for new episodes or not
if item.active and int(item.active) > 0:
update_text = config.get_localized_string(60022)
update_text = config.getLocalizedString(60022)
value = 0
else:
update_text = config.get_localized_string(60023)
update_text = config.getLocalizedString(60023)
value = 1
items.append((update_text, lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?{}&title={}&action=mark_tvshow_as_updatable&channel=videolibrary&active={})".format(item_url, update_text, str(value)))))
if item.local_episodes_path == "":
items.append((config.get_localized_string(80048), lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?{}&action=add_local_episodes&channel=videolibrary&path={})".format(item_url, path))))
items.append((config.getLocalizedString(80048), lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?{}&action=add_local_episodes&channel=videolibrary&path={})".format(item_url, path))))
else:
items.append((config.get_localized_string(80049), lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?{}&action=remove_local_episodes&channel=videolibrary&path={})".format(item_url, path))))
items.append((config.getLocalizedString(80049), lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?{}&action=remove_local_episodes&channel=videolibrary&path={})".format(item_url, path))))
return items
else:
+4 -4
View File
@@ -52,7 +52,7 @@ def reload():
def add_video(item):
global conn
conn = sqlite3.connect(get_file_db())
progress = platformtools.dialog_progress_bg('Sincronizzazione Libreria', item.title)
progress = platformtools.dialogProgressBg('Sincronizzazione Libreria', item.title)
progress.update(0)
if item.contentType == 'movie':
start = time()
@@ -70,10 +70,10 @@ def add_video(item):
def get_path(item):
logger.debug()
p = item.strm_path if item.strm_path else item.nfo_path
path = filetools.join(config.get_videolibrary_config_path(), config.get_setting("folder_{}s".format(item.contentType)), p.split('\\')[0].split('/')[0])
parent = filetools.join(config.get_videolibrary_config_path(), config.get_setting("folder_{}s".format(item.contentType)))
path = filetools.join(config.getVideolibraryConfigPath(), config.getSetting("folder_{}s".format(item.contentType)), p.split('\\')[0].split('/')[0])
parent = filetools.join(config.getVideolibraryConfigPath(), config.getSetting("folder_{}s".format(item.contentType)))
if item.contentType == 'movie':
filepath = filetools.join(config.get_videolibrary_config_path(), config.get_setting("folder_{}s".format(item.contentType)), p)
filepath = filetools.join(config.getVideolibraryConfigPath(), config.getSetting("folder_{}s".format(item.contentType)), p)
file = item.strm_path.split('\\')[-1].split('/')[-1]
return process_path(path), process_path(parent), file, filepath
else:
+7 -7
View File
@@ -37,14 +37,14 @@ def download_and_play(url, file_name, download_path):
while True:
cancelled = False
dialog = xbmcgui.DialogProgress()
dialog.create(config.get_localized_string(60200), config.get_localized_string(60312))
dialog.create(config.getLocalizedString(60200), config.getLocalizedString(60312))
dialog.update(0)
while not cancelled and download_thread.is_alive():
dialog.update(download_thread.get_progress(), config.get_localized_string(60313) + '\n' +
config.get_localized_string(60314) + str(int(old_div(download_thread.get_speed(), 1024))) + " KB/s " + str(
download_thread.get_actual_size()) + config.get_localized_string(60316) + str( download_thread.get_total_size()) + "MB",
config.get_localized_string(60202) % (str(downloadtools.sec_to_hms(download_thread.get_remaining_time()))))
dialog.update(download_thread.get_progress(), config.getLocalizedString(60313) + '\n' +
config.getLocalizedString(60314) + str(int(old_div(download_thread.get_speed(), 1024))) + " KB/s " + str(
download_thread.get_actual_size()) + config.getLocalizedString(60316) + str( download_thread.get_total_size()) + "MB",
config.getLocalizedString(60202) % (str(downloadtools.sec_to_hms(download_thread.get_remaining_time()))))
xbmc.sleep(1000)
if dialog.iscanceled():
@@ -189,7 +189,7 @@ class DownloadThread(threading.Thread):
oldcwd = os.getcwd()
logger.info("oldcwd= " + oldcwd)
cwd = os.path.join(config.get_runtime_path(), "tools")
cwd = os.path.join(config.getRuntimePath(), "tools")
logger.info("cwd= " + cwd)
os.chdir(cwd)
logger.info("directory changed to= " + os.getcwd())
@@ -286,7 +286,7 @@ class DownloadThread(threading.Thread):
logger.info("Force_stop file detected, download is interrupted")
f.close()
xbmc.executebuiltin("Notification(%s,%s,300)" % (config.get_localized_string(60319),config.get_localized_string(60320)))
xbmc.executebuiltin("Notification(%s,%s,300)" % (config.getLocalizedString(60319),config.getLocalizedString(60320)))
return
+6 -6
View File
@@ -5,7 +5,7 @@ import xbmc, xbmcaddon, sys, platform
host = 'https://github.com'
elementum_url = host + '/elgatito/plugin.video.elementum/releases'
filename = filetools.join(config.get_data_path(),'elementum.zip')
filename = filetools.join(config.getDataPath(),'elementum.zip')
addon_path = xbmc.translatePath('special://home/addons/')
setting_path = xbmc.translatePath('special://profile/addon_data/')
elementum_path = filetools.join(addon_path,'plugin.video.elementum')
@@ -17,16 +17,16 @@ kod_setting_file = filetools.join(addon_path,'plugin.video.kod', 'resources', 's
def download(item=None):
if filetools.exists(elementum_path):
if platformtools.dialog_yesno(config.get_localized_string(70784), config.get_localized_string(70783)):
if platformtools.dialogYesNo(config.getLocalizedString(70784), config.getLocalizedString(70783)):
addon_file = filetools.file_open(filetools.join(elementum_path,'addon.xml')).read()
required = support.match(addon_file, patron=r'addon="([^"]+)').matches
for r in required: xbmc.executebuiltin('InstallAddon(' + r + ')', wait=True)
setting()
platformtools.dialog_ok('Elementum', config.get_localized_string(70783))
platformtools.dialogOk('Elementum', config.getLocalizedString(70783))
else:
if platformtools.dialog_yesno(config.get_localized_string(70784), config.get_localized_string(70782)):
pform = get_platform()
if platformtools.dialogYesNo(config.getLocalizedString(70784), config.getLocalizedString(70782)):
pform = getPlatform()
url = support.match(elementum_url, patronBlock=r'<div class="release-entry">(.*?)<!-- /.release-body -->', patron=r'<a href="([a-zA-Z0-9/\.-]+%s.zip)' % pform).match
logger.debug('OS:', pform)
logger.debug('Extract IN:', elementum_path)
@@ -90,7 +90,7 @@ def setting():
filetools.remove(filename)
def get_platform():
def getPlatform():
build = xbmc.getInfoLabel("System.BuildVersion")
kodi_version = int(build.split()[0][:2])
ret = {
+26 -26
View File
@@ -32,7 +32,7 @@ def get_environment():
import base64
import ast
environment = config.get_platform(full_version=True)
environment = config.getXBMCPlatform(full_version=True)
environment['num_version'] = str(environment['num_version'])
environment['python_version'] = str(platform.python_version())
@@ -128,7 +128,7 @@ def get_environment():
except:
pass
environment['userdata_path'] = str(xbmc.translatePath(config.get_data_path()))
environment['userdata_path'] = str(xbmc.translatePath(config.getDataPath()))
try:
if environment['os_name'].lower() == 'windows':
free_bytes = ctypes.c_ulonglong(0)
@@ -145,21 +145,21 @@ def get_environment():
environment['videolab_series'] = '?'
environment['videolab_episodes'] = '?'
environment['videolab_pelis'] = '?'
environment['videolab_path'] = str(xbmc.translatePath(config.get_videolibrary_path()))
if filetools.exists(filetools.join(environment['videolab_path'], config.get_setting("folder_tvshows"))):
environment['videolab_series'] = str(len(filetools.listdir(filetools.join(environment['videolab_path'], config.get_setting("folder_tvshows")))))
environment['videolab_path'] = str(xbmc.translatePath(config.getVideolibraryPath()))
if filetools.exists(filetools.join(environment['videolab_path'], config.getSetting("folder_tvshows"))):
environment['videolab_series'] = str(len(filetools.listdir(filetools.join(environment['videolab_path'], config.getSetting("folder_tvshows")))))
counter = 0
for root, folders, files in filetools.walk(filetools.join(environment['videolab_path'], config.get_setting("folder_tvshows"))):
for root, folders, files in filetools.walk(filetools.join(environment['videolab_path'], config.getSetting("folder_tvshows"))):
for file in files:
if file.endswith('.strm'): counter += 1
environment['videolab_episodes'] = str(counter)
if filetools.exists(filetools.join(environment['videolab_path'], config.get_setting("folder_movies"))):
environment['videolab_pelis'] = str(len(filetools.listdir(filetools.join(environment['videolab_path'], config.get_setting("folder_movies")))))
if filetools.exists(filetools.join(environment['videolab_path'], config.getSetting("folder_movies"))):
environment['videolab_pelis'] = str(len(filetools.listdir(filetools.join(environment['videolab_path'], config.getSetting("folder_movies")))))
except:
pass
try:
video_updates = ['No', 'Inicio', 'Una vez', 'Inicio+Una vez']
environment['videolab_update'] = str(video_updates[config.get_setting("update", "videolibrary")])
environment['videolab_update'] = str(video_updates[config.getSetting("update", "videolibrary")])
except:
environment['videolab_update'] = '?'
try:
@@ -177,14 +177,14 @@ def get_environment():
# environment['torrent_list'] = []
# environment['torrentcli_option'] = ''
# environment['torrent_error'] = ''
# environment['torrentcli_rar'] = config.get_setting("mct_rar_unpack", server="torrent", default=True)
# environment['torrentcli_backgr'] = config.get_setting("mct_background_download", server="torrent", default=True)
# environment['torrentcli_lib_path'] = config.get_setting("libtorrent_path", server="torrent", default="")
# environment['torrentcli_rar'] = config.getSetting("mct_rar_unpack", server="torrent", default=True)
# environment['torrentcli_backgr'] = config.getSetting("mct_background_download", server="torrent", default=True)
# environment['torrentcli_lib_path'] = config.getSetting("libtorrent_path", server="torrent", default="")
# if environment['torrentcli_lib_path']:
# lib_path = 'Activo'
# else:
# lib_path = 'Inactivo'
# environment['torrentcli_unrar'] = config.get_setting("unrar_path", server="torrent", default="")
# environment['torrentcli_unrar'] = config.getSetting("unrar_path", server="torrent", default="")
# if environment['torrentcli_unrar']:
# if xbmc.getCondVisibility("system.platform.Android"):
# unrar = 'Android'
@@ -196,33 +196,33 @@ def get_environment():
# unrar = scrapertools.find_single_match(unrar, '\/([^\/]+)\/$').capitalize()
# else:
# unrar = 'Inactivo'
# torrent_id = config.get_setting("torrent_client", server="torrent", default=0)
# torrent_id = config.getSetting("torrent_client", server="torrent", default=0)
# environment['torrentcli_option'] = str(torrent_id)
# torrent_options = platformtools.torrent_client_installed()
# torrentOptions = platformtools.torrentClientInstalled()
# if lib_path == 'Activo':
# torrent_options = ['MCT'] + torrent_options
# torrent_options = ['BT'] + torrent_options
# torrentOptions = ['MCT'] + torrentOptions
# torrentOptions = ['BT'] + torrentOptions
# environment['torrent_list'].append({'Torrent_opt': str(torrent_id), 'Libtorrent': lib_path, \
# 'RAR_Auto': str(environment['torrentcli_rar']), \
# 'RAR_backgr': str(environment['torrentcli_backgr']), \
# 'UnRAR': unrar})
# environment['torrent_error'] = config.get_setting("libtorrent_error", server="torrent", default="")
# environment['torrent_error'] = config.getSetting("libtorrent_error", server="torrent", default="")
# if environment['torrent_error']:
# environment['torrent_list'].append({'Libtorrent_error': environment['torrent_error']})
# for torrent_option in torrent_options:
# for torrent_option in torrentOptions:
# cliente = dict()
# cliente['D_load_Path'] = ''
# cliente['Libre'] = '?'
# cliente['Plug_in'] = torrent_option.replace('Plugin externo: ', '')
# if cliente['Plug_in'] == 'BT':
# cliente['D_load_Path'] = str(config.get_setting("bt_download_path", server="torrent", default=''))
# cliente['D_load_Path'] = str(config.getSetting("bt_download_path", server="torrent", default=''))
# if not cliente['D_load_Path']: continue
# cliente['Buffer'] = str(config.get_setting("bt_buffer", server="torrent", default=50))
# cliente['Buffer'] = str(config.getSetting("bt_buffer", server="torrent", default=50))
# elif cliente['Plug_in'] == 'MCT':
# cliente['D_load_Path'] = str(config.get_setting("mct_download_path", server="torrent", default=''))
# cliente['D_load_Path'] = str(config.getSetting("mct_download_path", server="torrent", default=''))
# if not cliente['D_load_Path']: continue
# cliente['Buffer'] = str(config.get_setting("mct_buffer", server="torrent", default=50))
# cliente['Buffer'] = str(config.getSetting("mct_buffer", server="torrent", default=50))
# elif xbmc.getCondVisibility('System.HasAddon("plugin.video.%s")' % cliente['Plug_in']):
# __settings__ = xbmcaddon.Addon(id="plugin.video.%s" % cliente['Plug_in'])
# cliente['Plug_in'] = cliente['Plug_in'].capitalize()
@@ -258,7 +258,7 @@ def get_environment():
environment['proxy_active'] = ''
try:
proxy_channel_bloqued_str = base64.b64decode(config.get_setting('proxy_channel_bloqued')).decode('utf-8')
proxy_channel_bloqued_str = base64.b64decode(config.getSetting('proxy_channel_bloqued')).decode('utf-8')
proxy_channel_bloqued = dict()
proxy_channel_bloqued = ast.literal_eval(proxy_channel_bloqued_str)
for channel_bloqued, proxy_active in list(proxy_channel_bloqued.items()):
@@ -289,8 +289,8 @@ def get_environment():
environment['log_size_bytes'] = ''
environment['log_size'] = ''
environment['debug'] = str(config.get_setting('debug'))
environment['addon_version'] = str(config.get_addon_version())
environment['debug'] = str(config.getSetting('debug'))
environment['addon_version'] = str(config.getAddonVersion())
except:
logger.error(traceback.format_exc())
+13 -13
View File
@@ -39,7 +39,7 @@ BACKSPACE = 92
def start(item):
xbmc.executebuiltin('Dialog.Close(all)')
InfoPlus('InfoPlus.xml', config.get_runtime_path(), item=item)
InfoPlus('InfoPlus.xml', config.getRuntimePath(), item=item)
class InfoPlus(xbmcgui.WindowXML):
def __init__(self, *args, **kwargs):
@@ -57,7 +57,7 @@ class InfoPlus(xbmcgui.WindowXML):
self.fanarts = []
self.collection = []
if not self.item.focus: self.item.focus = {}
platformtools.dialog_busy(True)
platformtools.dialogBusy(True)
if self.item:
# Find Video Info
@@ -88,7 +88,7 @@ class InfoPlus(xbmcgui.WindowXML):
self.listitem.setProperty('info',info)
# Set infoLabels
platformtools.set_infolabels(self.listitem, self.item)
platformtools.setInfolabels(self.listitem, self.item)
# Add Cast Info
for cast in self.info.get('castandrole',[]):
@@ -128,9 +128,9 @@ class InfoPlus(xbmcgui.WindowXML):
self.get_trailers()
# Add Fanart
self.get_fanarts()
self.getFanarts()
platformtools.dialog_busy(False)
platformtools.dialogBusy(False)
self.doModal()
@@ -199,10 +199,10 @@ class InfoPlus(xbmcgui.WindowXML):
self.item.text = self.item.contentTitle
titles = [self.item.text] + [original] if original else []
if original and original != self.item.text:
selection = platformtools.dialog_select(config.get_localized_string(90010), titles)
selection = platformtools.dialogSelect(config.getLocalizedString(90010), titles)
if selection > -1:
self.item.text = titles[selection]
self.item.mode = 'search_' + self.item.contentType
self.item.mode = 'search/' + self.item.contentType
item = self.item.clone(channel='globalsearch', action='new_search')
xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?" + item.tourl() + ")")
# new_search(self.item.clone())
@@ -263,7 +263,7 @@ class InfoPlus(xbmcgui.WindowXML):
traileitem.setArt({'thumb':'http://img.youtube.com/vi/' + trailer['url'].split('=')[-1] + '/0.jpg'})
self.trailers.append(traileitem)
def get_fanarts(self):
def getFanarts(self):
_id = self.info.get('tmdb_id')
res = {}
fanarts = self.info.get('fanarts',[])
@@ -284,7 +284,7 @@ class InfoPlus(xbmcgui.WindowXML):
def showCast(item):
xbmc.executebuiltin('Dialog.Close(all)')
CastWindow('CastWindow.xml', config.get_runtime_path(), item=item)
CastWindow('CastWindow.xml', config.getRuntimePath(), item=item)
class CastWindow(xbmcgui.WindowXML):
def __init__(self, *args, **kwargs):
self.item = kwargs.get('item')
@@ -296,10 +296,10 @@ class CastWindow(xbmcgui.WindowXML):
self.tvshowItems = []
if not self.item.focus: self.item.focus = {}
if self.item:
platformtools.dialog_busy(True)
platformtools.dialogBusy(True)
self.get_person_info()
self.get_credits()
platformtools.dialog_busy(False)
platformtools.dialogBusy(False)
self.doModal()
def get_person_info(self):
@@ -413,7 +413,7 @@ class CastWindow(xbmcgui.WindowXML):
rating = video.get('vote_average', 'N/A')
color = 'FFFFFFFF' if rating == 'N/A' else 'FFDB2360' if rating < 4 else 'FFD2D531' if rating < 7 else 'FF21D07A'
videoitem.setProperties({'rating':str(int(video.get('vote_average',10) * 10)), 'color':color})
platformtools.set_infolabels(videoitem, item)
platformtools.setInfolabels(videoitem, item)
if video.get('media_type') == 'movie':
self.movies.append(videoitem)
self.movieItems.append(item)
@@ -424,7 +424,7 @@ class CastWindow(xbmcgui.WindowXML):
def showImages(images, position):
xbmc.executebuiltin('Dialog.Close(all)')
return ImagesWindow('imageWindow.xml', config.get_runtime_path()).start(images=images, position=position)
return ImagesWindow('imageWindow.xml', config.getRuntimePath()).start(images=images, position=position)
class ImagesWindow(xbmcgui.WindowXMLDialog):
def start(self, *args, **kwargs):
self.images = []
+20 -20
View File
@@ -7,13 +7,12 @@ from platformcode import config, logger, platformtools, launcher
from core import filetools
from core.item import Item
import channelselector
addon_icon = filetools.join( config.__settings__.getAddonInfo( "path" ),'resources', 'media', 'logo.png' )
background = 'FF232323'
overlay = '77232323'
text = 'FFFFFFFF'
select = 'FF0082C2'
if config.get_setting('icon_set') == 'dark':
if config.getSetting('icon_set') == 'dark':
background = 'FFDCDCDC'
overlay = '77DCDCDC'
text = 'FF232323'
@@ -37,13 +36,13 @@ class KeyListener(xbmcgui.WindowXMLDialog):
def onInit(self):
try:
self.getControl(400).setImage(addon_icon)
self.getControl(401).addLabel(config.get_localized_string(70698))
self.getControl(402).addLabel(config.get_localized_string(70699) % self.TIMEOUT)
self.getControl(400).setImage(config.addonIcon)
self.getControl(401).addLabel(config.getLocalizedString(70698))
self.getControl(402).addLabel(config.getLocalizedString(70699) % self.TIMEOUT)
except AttributeError:
self.getControl(400).setImage(addon_icon)
self.getControl(401).setLabel(config.get_localized_string(70698))
self.getControl(402).setLabel(config.get_localized_string(70699) % self.TIMEOUT)
self.getControl(400).setImage(config.addonIcon)
self.getControl(401).setLabel(config.getLocalizedString(70698))
self.getControl(402).setLabel(config.getLocalizedString(70699) % self.TIMEOUT)
def onAction(self, action):
@@ -68,7 +67,7 @@ class KeyListener(xbmcgui.WindowXMLDialog):
def set_key():
saved_key = config.get_setting("shortcut_key")
saved_key = config.getSetting("shortcut_key")
new_key = KeyListener().record_key()
if new_key and saved_key != new_key:
@@ -76,13 +75,14 @@ def set_key():
from platformcode import platformtools
import xbmc
file_xml = "special://profile/keymaps/kod.xml"
data = '<keymap><global><keyboard><key id="%s">' % new_key + 'runplugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAia2V5bWFwIiwNCiAgICAib3BlbiI6IHRydWUNCn0=)</key></keyboard></global></keymap>'
data = '<keymap><global><keyboard><key id="%s">' % new_key + 'runplugin(plugin://plugin.video.kod/?channel=shortcuts&action=shortcut_menu)</key></keyboard></global></keymap>'
filetools.write(xbmc.translatePath(file_xml), data)
# platformtools.dialog_notification(config.get_localized_string(70700),config.get_localized_string(70702),4)
# platformtools.dialogNotification(config.getLocalizedString(70700),config.getLocalizedString(70702),4)
config.set_setting("shortcut_key", new_key)
config.setSetting("shortcut_key", new_key)
xbmc.executebuiltin('Action(reloadkeymaps)')
return
# return
def delete_key():
@@ -91,9 +91,9 @@ def delete_key():
import xbmc
filetools.remove(xbmc.translatePath( "special://profile/keymaps/kod.xml"))
# platformtools.dialog_notification(config.get_localized_string(70701),config.get_localized_string(70702),4)
# platformtools.dialogNotification(config.getLocalizedString(70701),config.getLocalizedString(70702),4)
config.set_setting("shortcut_key", '')
config.setSetting("shortcut_key", '')
xbmc.executebuiltin('Action(reloadkeymaps)')
LEFT = 1
@@ -113,7 +113,7 @@ class Main(xbmcgui.WindowXMLDialog):
self.MENU = self.getControl(1)
self.SUBMENU = self.getControl(2)
#### Compatibility with Kodi 18 ####
if config.get_platform(True)['num_version'] < 18:
if config.getXBMCPlatform(True)['num_version'] < 18:
self.setCoordinateResolution(2)
itemlist = self.menulist(channelselector.getmainlist())
@@ -160,7 +160,7 @@ class Main(xbmcgui.WindowXMLDialog):
def onAction(self, action):
if action.getButtonCode() == config.get_setting('shortcut_key'):
if action.getButtonCode() == config.getSetting('shortcut_key'):
self.close()
action = action.getId()
@@ -186,7 +186,7 @@ class Main(xbmcgui.WindowXMLDialog):
import channelselector
itemlist = self.menulist(channelselector.getchanneltypes())
elif channel_name not in ['downloads', 'setting', 'help']:
channel = platformtools.channel_import(channel_name)
channel = platformtools.channelImport(channel_name)
itemlist = self.menulist(channel.mainlist(Item().fromurl(self.MENU.getSelectedItem().getProperty('run'))))
self.SUBMENU.reset()
self.SUBMENU.addItems(itemlist)
@@ -196,7 +196,7 @@ class Main(xbmcgui.WindowXMLDialog):
focus = self.getFocusId()
item_url = self.MENU.getSelectedItem().getProperty('run')
item = Item().fromurl(item_url)
commands = platformtools.set_context_commands(item, item_url, Item())
commands = platformtools.setContextCommands(item, item_url, Item())
context = [c[0] for c in commands]
context_commands = [c[1].replace('Container.Refresh', 'RunPlugin').replace('Container.Update', 'RunPlugin') for c in commands]
index = xbmcgui.Dialog().contextmenu(context)
@@ -205,5 +205,5 @@ class Main(xbmcgui.WindowXMLDialog):
def open_shortcut_menu():
if xbmcgui.getCurrentWindowDialogId() == 9999:
main = Main('ShortCutMenu.xml', config.get_runtime_path())
main = Main('ShortCutMenu.xml', config.getRuntimePath())
main.doModal()
+221 -392
View File
@@ -3,33 +3,28 @@
# XBMC Launcher (xbmc / kodi)
# ------------------------------------------------------------
from specials import videolibrary
import sys, os
PY3 = False
if sys.version_info[0] >= 3:PY3 = True; unicode = str; unichr = chr; long = int
import sys
from core.item import Item
from core import filetools, videolibrarydb
from core import filetools
from platformcode import config, logger, platformtools
from platformcode.logger import WebErrorException
temp_search_file = config.get_temp_file('temp-search')
def start():
""" First function that is executed when entering the plugin.
'''
First function that is executed when entering the plugin.
Within this function all calls should go to
functions that we want to execute as soon as we open the plugin.
"""
'''
logger.debug()
if not config.dev_mode():
if not config.devMode():
try:
with open(config.changelogFile, 'r') as fileC:
changelog = fileC.read()
if changelog.strip():
platformtools.dialog_ok('Kodi on Demand', 'Aggiornamenti applicati:\n' + changelog)
os.remove(config.changelogFile)
platformtools.dialogOk('Kodi on Demand', 'Aggiornamenti applicati:\n' + changelog)
filetools.remove(config.changelogFile)
except:
pass
@@ -37,297 +32,57 @@ def start():
def run(item=None):
logger.debug()
if not item:
# Extract item from sys.argv
if sys.argv[2]:
sp = sys.argv[2].split('&')
url = sp[0]
item = Item().fromurl(url)
if len(sp) > 1:
for e in sp[1:]:
key, val = e.split('=')
if val.lower() == 'false': val = False
elif val.lower() == 'true': val = True
item.__setattr__(key, val)
# If no item, this is mainlist
else:
item = Item(channel="channelselector", action="getmainlist", viewmode="movie")
if not config.get_setting('show_once'):
if not config.get_all_settings_addon():
logger.error('corrupted settings.xml!!')
settings_xml = os.path.join(config.get_data_path(), "settings.xml")
settings_bak = os.path.join(config.get_data_path(), "settings.bak")
if filetools.exists(settings_bak):
filetools.copy(settings_bak, settings_xml, True)
logger.info('restored settings.xml from backup')
else:
filetools.write(settings_xml, '<settings version="2">\n</settings>') # resetted settings
else:
from platformcode import xbmc_videolibrary
xbmc_videolibrary.ask_set_content(silent=False)
config.set_setting('show_once', True)
# Extract item from sys.argv
if not item: item = makeItem()
logger.info(item.tostring())
# Load or Repare Settings
if not config.getSetting('show_once'): showOnce()
# Acrions
logger.debug(item.tostring())
try:
if not config.get_setting('tmdb_active'):
config.set_setting('tmdb_active', True)
# Active tmdb
if not config.getSetting('tmdb_active'):
config.setSetting('tmdb_active', True)
# If item has no action, stops here
if item.action == "":
logger.debug("Item without action")
if item.action == '':
logger.debug('Item without action')
return
# Action for main menu in channelselector
elif item.action == "getmainlist":
# Channel Selector
if item.channel == 'channelselector':
itemlist = []
import channelselector
if item.action == 'getmainlist': # Action for main menu in channelselector
itemlist = channelselector.getmainlist()
elif item.action == 'getchanneltypes': # Action for channel types on channelselector: movies, series, etc.
itemlist = channelselector.getchanneltypes()
elif item.action == 'filterchannels': # Action for channel listing on channelselector
itemlist = channelselector.filterchannels(item.channel_type)
platformtools.renderItems(itemlist, item)
itemlist = channelselector.getmainlist()
platformtools.render_items(itemlist, item)
# Action for channel types on channelselector: movies, series, etc.
elif item.action == "getchanneltypes":
import channelselector
itemlist = channelselector.getchanneltypes()
platformtools.render_items(itemlist, item)
# Action for channel listing on channelselector
elif item.action == "filterchannels":
import channelselector
itemlist = channelselector.filterchannels(item.channel_type)
platformtools.render_items(itemlist, item)
# Special action for playing a video from the library
elif item.action == "play_from_library":
play_from_library(item)
return
elif item.action in ['playFromLibrary', 'play_from_library']:
return playFromLibrary(item)
elif item.action == "keymap":
from platformcode import keymaptools
if item.open:
return keymaptools.open_shortcut_menu()
else:
return keymaptools.set_key()
# Special play action
elif item.action == 'play': play(item)
elif item.channel == "infoplus":
from platformcode import infoplus
return getattr(infoplus, item.action)(item)
# Special findvideos Action
elif item.action == 'findvideos': findvideos(item)
elif item.channel == 'trakt_tools':
from core import trakt_tools
action = getattr(trakt_tools, item.action)
return action(item)
# Special action for adding a movie or serie to the library
elif item.action == 'add_to_library': addToLibrary(item)
elif item.channel == "backup":
from platformcode import backup
return getattr(backup, item.action)(item)
# Special action for searching, first asks for the words then call the "search" function
elif item.action == 'search': search(item)
elif item.channel == "elementum_download":
from platformcode import elementum_download
return getattr(elementum_download, item.action)(item)
# For all other actions
else: actions(item)
elif item.channel == "shortcuts":
from platformcode import shortcuts
return getattr(shortcuts, item.action)(item)
elif item.channel == "autorenumber":
from platformcode import autorenumber
return getattr(autorenumber, item.action)(item)
elif item.action == "delete_key":
from platformcode import keymaptools
return keymaptools.delete_key()
elif item.action == "script":
from core import tmdb
tmdb.clean_cache()
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(60011), time=2000, sound=False)
elif item.action == "itemInfo":
platformtools.dialog_textviewer('Item info', item.parent)
elif item.action == "open_browser":
import webbrowser
if not webbrowser.open(item.url):
import xbmc
if xbmc.getCondVisibility('system.platform.linux') and xbmc.getCondVisibility('system.platform.android'): # android
xbmc.executebuiltin('StartAndroidActivity("", "android.intent.action.VIEW", "", "%s")' % item.url)
else:
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(70740) % "\n".join([item.url[j:j+57] for j in range(0, len(item.url), 57)]))
elif item.action == "gotopage":
from core import scrapertools
head = config.get_localized_string(70511)
scraped_page = scrapertools.find_single_match(item.url,'[=/]([0-9]+)')
if item.total_pages and (item.page or scraped_page.isdigit()):
pages = [str(p) for p in range(1, item.total_pages + 1)]
page = item.page if item.page else int(scraped_page)
page = platformtools.dialog_select(head, pages, page - 2) + 1
else:
page = platformtools.dialog_numeric(0, head)
if page and int(page) > -1:
import xbmc
item.action = item.real_action
item.page = int(page)
import re
item.url = re.sub('([=/])[0-9]+(/?)$', '\g<1>{}\g<2>'.format(page), item.url)
xbmc.executebuiltin("Container.Update(%s?%s)" % (sys.argv[0], item.tourl()))
elif item.action == "gotoseason":
head = 'Seleziona la stagione'
seasons = [str(s) for s in item.allSeasons]
season = platformtools.dialog_select(head, seasons, item.nextSeason - 1)
if int(season) > -1:
import xbmc
item.action = item.real_action
item.nextSeason = season
xbmc.executebuiltin("Container.Update(%s?%s)" % (sys.argv[0], item.tourl()))
else:
channel = platformtools.channel_import(item.channel)
if not channel:
return
logger.info("Running channel %s | %s" % (channel.__name__, channel.__file__))
# Special play action
if item.action == "play":
# define la info para trakt
try:
from core import trakt_tools
trakt_tools.set_trakt_info(item)
except:
pass
logger.debug("item.action=%s" % item.action.upper())
# logger.debug("item_toPlay: " + "\n" + item.tostring('\n'))
# First checks if channel has a "play" function
if hasattr(channel, 'play'):
logger.debug("Executing channel 'play' method")
itemlist = channel.play(item)
b_favourite = item.isFavourite
# Play should return a list of playable URLS
if len(itemlist) > 0 and isinstance(itemlist[0], Item):
item = itemlist[0]
if b_favourite:
item.isFavourite = True
platformtools.play_video(item)
# Permitir varias calidades desde play en el Channel
elif len(itemlist) > 0 and isinstance(itemlist[0], list):
item.video_urls = itemlist
platformtools.play_video(item)
# If not, shows user an error message
else:
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(60339))
# If player don't have a "play" function, not uses the standard play from platformtools
else:
logger.debug("Executing core 'play' method")
platformtools.play_video(item)
# Special action for findvideos, where the plugin looks for known urls
elif item.action == "findvideos":
# logger.dbg()
from core import servertools
p_dialog = None
if item.window:
p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(60683))
p_dialog.update(0)
# First checks if channel has a "findvideos" function
if hasattr(channel, 'findvideos'):
itemlist = getattr(channel, item.action)(item)
# If not, uses the generic findvideos function
else:
logger.debug("No channel 'findvideos' method, " "executing core method")
itemlist = servertools.find_video_items(item)
if config.get_setting("max_links", "videolibrary") != 0:
itemlist = limit_itemlist(itemlist)
if p_dialog:
p_dialog.update(100)
p_dialog.close()
platformtools.serverwindow(item, itemlist)
else:
platformtools.render_items(itemlist, item)
# Special action for adding a movie to the library
elif item.action == "add_movie_to_library":
from core import videolibrarytools
videolibrarytools.add_movie(item)
# Special action for adding a serie to the library
elif item.action == "add_serie_to_library":
from core import videolibrarytools
videolibrarytools.add_tvshow(item, channel)
# Special action for adding a serie to the library
elif item.action == "add_to_library":
from core import videolibrarytools
videolibrarytools.add_to_videolibrary(item, channel)
# Special action for downloading all episodes from a serie
elif item.action == "download_all_episodes":
from specials import downloads
item.action = item.extra
del item.extra
downloads.save_download(item)
# Special action for searching, first asks for the words then call the "search" function
elif item.action == "search":
if filetools.isfile(temp_search_file) and config.get_setting('videolibrary_kodi'):
itemlist = []
f = filetools.read(temp_search_file)
strList = f.split(',')
if strList[0] == '[V]' and strList[1] == item.channel:
for it in strList:
if it and it not in ['[V]', item.channel]:
itemlist.append(Item().fromurl(it))
filetools.write(temp_search_file, f[4:])
return platformtools.render_items(itemlist, item)
else:
filetools.remove(temp_search_file)
logger.debug("item.action=%s" % item.action.upper())
from core import channeltools
if config.get_setting('last_search'):
last_search = channeltools.get_channel_setting('Last_searched', 'search', '')
else:
last_search = ''
search_text = platformtools.dialog_input(last_search)
if search_text is not None:
channeltools.set_channel_setting('Last_searched', search_text, 'search')
itemlist = new_search(item.clone(text=search_text), channel)
else:
return
platformtools.render_items(itemlist, item)
# For all other actions
else:
# import web_pdb; web_pdb.set_trace()
logger.debug("Executing channel '%s' method" % item.action)
itemlist = getattr(channel, item.action)(item)
if config.get_setting('trakt_sync'):
from core import trakt_tools
token_auth = config.get_setting("token_trakt", "trakt")
if not token_auth:
trakt_tools.auth_trakt()
else:
import xbmc
if not xbmc.getCondVisibility('System.HasAddon(script.trakt)') and config.get_setting('install_trakt'):
trakt_tools.ask_install_script()
itemlist = trakt_tools.trakt_check(itemlist)
else:
config.set_setting('install_trakt', True)
platformtools.render_items(itemlist, item)
except WebErrorException as e:
@@ -336,27 +91,28 @@ def run(item=None):
logger.error(traceback.format_exc())
platformtools.dialog_ok(
config.get_localized_string(59985) % e.channel,
config.get_localized_string(60013) % e.url)
platformtools.dialogOk(
config.getLocalizedString(59985) % e.channel,
config.getLocalizedString(60013) % e.url)
except Exception as e:
import traceback
from core import scrapertools
logger.error(traceback.format_exc())
patron = 'File "' + os.path.join(config.get_runtime_path(), "channels", "").replace("\\", "\\\\") + r'([^.]+)\.py"'
patron = r'File "{}([^.]+)\.py"'.format(filetools.join(config.getRuntimePath(), 'channels', '').replace('\\', '\\\\'))
Channel = scrapertools.find_single_match(traceback.format_exc(), patron)
if Channel or e.__class__ == logger.ChannelScraperException:
if item.url:
if platformtools.dialog_yesno(config.get_localized_string(60087) % Channel, config.get_localized_string(60014), nolabel='ok', yeslabel=config.get_localized_string(70739)):
run(Item(action="open_browser", url=item.url))
if platformtools.dialogYesNo(config.getLocalizedString(60087) % Channel, config.getLocalizedString(60014), nolabel='ok', yeslabel=config.getLocalizedString(70739)):
run(Item(action='open_browser', url=item.url))
else:
platformtools.dialog_ok(config.get_localized_string(60087) % Channel, config.get_localized_string(60014))
platformtools.dialogOk(config.getLocalizedString(60087) % Channel, config.getLocalizedString(60014))
else:
if platformtools.dialog_yesno(config.get_localized_string(60038), config.get_localized_string(60015)):
platformtools.itemlist_update(Item(channel="setting", action="report_menu"), True)
if platformtools.dialogYesNo(config.getLocalizedString(60038), config.getLocalizedString(60015)):
platformtools.itemlistUpdate(Item(channel='setting', action='report_menu'), True)
finally:
# db need to be closed when not used, it will cause freezes
from core import db
@@ -374,112 +130,185 @@ def new_search(item, channel=None):
writelist = item.channel
for it in itemlist:
writelist += ',' + it.tourl()
filetools.write(temp_search_file, writelist)
# filetools.write(temp_search_file, writelist)
return itemlist
def set_search_temp(item):
if filetools.isfile(temp_search_file) and config.get_setting('videolibrary_kodi'):
f = '[V],' + filetools.read(temp_search_file)
filetools.write(temp_search_file, f)
# def set_search_temp(item):
# if filetools.isfile(temp_search_file) and config.getSetting('videolibrary_kodi'):
# f = '[V],' + filetools.read(temp_search_file)
# filetools.write(temp_search_file, f)
def reorder_itemlist(itemlist):
def limitItemlist(itemlist):
logger.debug()
# logger.debug("Inlet itemlist size: %i" % len(itemlist))
new_list = []
mod_list = []
not_mod_list = []
modified = 0
not_modified = 0
to_change = [[config.get_localized_string(60335), '[V]'], [config.get_localized_string(60336), '[D]']]
for item in itemlist:
if not PY3:
old_title = unicode(item.title, "utf8").lower().encode("utf8")
else:
old_title = item.title.lower()
for before, after in to_change:
if before in item.title:
item.title = item.title.replace(before, after)
break
if not PY3:
new_title = unicode(item.title, "utf8").lower().encode("utf8")
else:
new_title = item.title.lower()
if old_title != new_title:
mod_list.append(item)
modified += 1
else:
not_mod_list.append(item)
not_modified += 1
# logger.debug("OLD: %s | NEW: %s" % (old_title, new_title))
new_list.extend(mod_list)
new_list.extend(not_mod_list)
logger.debug("Modified Titles:%i |Unmodified:%i" % (modified, not_modified))
if len(new_list) == 0:
new_list = itemlist
# logger.debug("Outlet itemlist size: %i" % len(new_list))
return new_list
def limit_itemlist(itemlist):
logger.debug()
# logger.debug("Inlet itemlist size: %i" % len(itemlist))
try:
opt = config.get_setting("max_links", "videolibrary")
if opt == 0:
value = config.getSetting('max_links', 'videolibrary')
if value == 0:
new_list = itemlist
else:
i_max = 30 * opt
new_list = itemlist[:i_max]
# logger.debug("Outlet itemlist size: %i" % len(new_list))
new_list = itemlist[:value]
return new_list
except:
return itemlist
def play_from_library(item):
"""
The .strm files when played from kodi, this expects it to be a "playable" file so it cannot contain
more items, at most a selection dialog can be placed.
We solve this by "cheating kodi" and making him believe that something has been reproduced, so later by
"Container.Update ()" we load the strm as if an item from inside the addon were treated, removing all
the limitations and allowing to reproduce through the general function without having to create new methods to
the video library.
@type item: item
@param item: item with information
"""
import xbmc, xbmcgui, xbmcplugin
platformtools.window_type(item)
platformtools.prevent_busy(item)
item.action = item.next_action if item.next_action else 'findvideos'
if not item.videolibrary_id:
if item.window and item.action == 'findvideos':
return run(item)
else:
xbmc.executebuiltin("Container.Update(" + sys.argv[0] + "?" + item.tourl() + ")")
elif xbmc.getCondVisibility('Window.IsMedia') and not item.window:
if item.contentType == 'episode':
it = videolibrarydb[item.contentType][item.videolibrary_id]['{}x{:02d}'.format(item.infoLabels['season'], item.infoLabels['episode'])]['item']
else:
it = videolibrarydb[item.contentType][item.videolibrary_id]['item']
it.from_library = True
xbmc.executebuiltin("Container.Update(" + sys.argv[0] + "?" + it.tourl() + ")")
videolibrarydb.close()
def makeItem():
logger.debug()
if sys.argv[2]:
sp = sys.argv[2].split('&')
url = sp[0]
item = Item().fromurl(url)
if len(sp) > 1:
for e in sp[1:]:
key, val = e.split('=')
if val.lower() == 'false': val = False
elif val.lower() == 'true': val = True
item.__setattr__(key, val)
# If no item, this is mainlist
else:
item.window = True
return run(item)
item = Item(channel='channelselector', action='getmainlist', viewmode='movie')
return item
def showOnce():
if not config.getAllSettingsAddon():
logger.error('corrupted settings.xml!!')
settings_xml = filetools.join(config.getDataPath(), 'settings.xml')
settings_bak = filetools.join(config.getDataPath(), 'settings.bak')
if filetools.exists(settings_bak):
filetools.copy(settings_bak, settings_xml, True)
logger.info('restored settings.xml from backup')
else:
filetools.write(settings_xml, '<settings version="2">\n</settings>') # resetted settings
else:
from platformcode import xbmc_videolibrary
xbmc_videolibrary.ask_set_content(silent=False)
config.setSetting('show_once', True)
def play(item):
channel = importChannel(item)
# platformtools.fakeVideo()
# define la info para trakt
try:
from core import trakt_tools
trakt_tools.set_trakt_info(item)
except:
pass
logger.debug('item.action=', item.action.upper())
# First checks if channel has a "play" function
if hasattr(channel, 'play'):
logger.debug('Executing channel "play" method')
itemlist = channel.play(item)
# Play should return a list of playable URLS
if len(itemlist) > 0 and isinstance(itemlist[0], Item):
item = itemlist[0]
platformtools.playVideo(item)
# Allow several qualities from Play in El Channel
elif len(itemlist) > 0 and isinstance(itemlist[0], list):
item.videoUrls = itemlist
platformtools.playVideo(item)
# If not, shows user an error message
else:
platformtools.dialogOk(config.getLocalizedString(20000), config.getLocalizedString(60339))
# If player don't have a "play" function, not uses the standard play from platformtools
else:
logger.debug('Executing core "play" method')
platformtools.playVideo(item)
def findvideos(item):
logger.debug('Executing channel', item.channel, 'method', item.action)
channel = importChannel(item)
from core import servertools
p_dialog = platformtools.dialogProgressBg(config.getLocalizedString(20000), config.getLocalizedString(60683))
p_dialog.update(0)
# First checks if channel has a "findvideos" function
if hasattr(channel, 'findvideos'):
itemlist = getattr(channel, item.action)(item)
# If not, uses the generic findvideos function
else:
logger.debug('No channel "findvideos" method, executing core method')
itemlist = servertools.find_video_items(item)
itemlist = limitItemlist(itemlist)
p_dialog.update(100)
p_dialog.close()
# If there is only one server play it immediately
if len(itemlist) == 1 or len(itemlist) > 1 and not itemlist[1].server:
play(itemlist[0].clone(no_return=True))
else:
platformtools.serverWindow(item, itemlist)
def search(item):
channel = importChannel(item)
from core import channeltools
if config.getSetting('last_search'):
last_search = channeltools.getChannelSetting('Last_searched', 'search', '')
else:
last_search = ''
search_text = platformtools.dialogInput(last_search)
if search_text is not None:
channeltools.setChannelSetting('Last_searched', search_text, 'search')
itemlist = new_search(item.clone(text=search_text), channel)
else:
return
platformtools.renderItems(itemlist, item)
def addToLibrary(item):
channel = importChannel(item)
from core import videolibrarytools
videolibrarytools.add_to_videolibrary(item, channel)
def importChannel(item):
channel = platformtools.channelImport(item.channel)
if not channel:
logger.debug('Channel', item.channel, 'not exist!')
return
logger.debug('Running channel', channel.__name__, '|', channel.__file__)
return channel
def actions(item):
logger.debug('Executing channel', item.channel, 'method', item.action)
channel = importChannel(item)
itemlist = getattr(channel, item.action)(item)
if config.getSetting('trakt_sync'):
from core import trakt_tools
token_auth = config.getSetting('token_trakt', 'trakt')
if not token_auth:
trakt_tools.auth_trakt()
else:
import xbmc
if not xbmc.getCondVisibility('System.HasAddon(script.trakt)') and config.getSetting('install_trakt'):
trakt_tools.ask_install_script()
itemlist = trakt_tools.trakt_check(itemlist)
else:
config.setSetting('install_trakt', True)
platformtools.renderItems(itemlist, item)
def playFromLibrary(item):
platformtools.fakeVideo()
item.action = item.next_action if item.next_action else 'findvideos'
logger.debug('Executing channel', item.channel, 'method', item.action)
return run(item)
+2 -2
View File
@@ -16,7 +16,7 @@ try:
except:
testMode = False
LOG_FORMAT = '{addname}[{filename}.{function}:{line}]{sep} {message}'
DEBUG_ENABLED = config.get_setting("debug")
DEBUG_ENABLED = config.getSetting("debug")
DEF_LEVEL = xbmc.LOGINFO if sys.version_info[0] >= 3 else xbmc.LOGNOTICE
@@ -52,7 +52,7 @@ def log(*args, **kwargs):
message=msg), kwargs.get('level', DEF_LEVEL))
def dbg(open=True):
if config.dev_mode():
if config.devMode():
try:
import web_pdb
if not web_pdb.WebPdb.active_instance and open:
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -21,7 +21,7 @@ class Recaptcha(xbmcgui.WindowXMLDialog):
self.doModal()
# Reload
if self.result == {}:
self.result = Recaptcha("Recaptcha.xml", config.get_runtime_path()).Start(self.key, self.referer)
self.result = Recaptcha("Recaptcha.xml", config.getRuntimePath()).Start(self.key, self.referer)
return self.result
@@ -43,7 +43,7 @@ class Recaptcha(xbmcgui.WindowXMLDialog):
def onInit(self):
#### Kodi 18 compatibility ####
if config.get_platform(True)['num_version'] < 18:
if config.getXBMCPlatform(True)['num_version'] < 18:
self.setCoordinateResolution(2)
self.update_window()
@@ -68,7 +68,7 @@ class Recaptcha(xbmcgui.WindowXMLDialog):
logger.debug(data)
self.result = scrapertools.find_single_match(data, '<div class="fbc-verification-token">.*?>([^<]+)<')
if self.result:
platformtools.dialog_notification("Captcha corretto", "Verifica conclusa")
platformtools.dialogNotification("Captcha corretto", "Verifica conclusa")
self.close()
else:
self.result = {}
+160 -113
View File
@@ -1,150 +1,197 @@
# -*- coding: utf-8 -*-
from platformcode import logger, platformtools
import sys
from platformcode import logger, platformtools, config
def context():
from platformcode import config
context = []
# original
# if config.get_setting('quick_menu'): context.append((config.get_localized_string(60360).upper(), "RunPlugin(plugin://plugin.video.kod/?%s)" % Item(channel='shortcuts', action="shortcut_menu").tourl()))
# if config.get_setting('kod_menu'): context.append((config.get_localized_string(60026), "RunPlugin(plugin://plugin.video.kod/?%s)" % Item(channel='shortcuts', action="settings_menu").tourl()))
from platformcode import config
context = []
# original
# if config.getSetting('quick_menu'): context.append((config.getLocalizedString(60360).upper(), "RunPlugin(plugin://plugin.video.kod/?%s)" % Item(channel='shortcuts', action="shortcut_menu").tourl()))
# if config.getSetting('kod_menu'): context.append((config.getLocalizedString(60026), "RunPlugin(plugin://plugin.video.kod/?%s)" % Item(channel='shortcuts', action="settings_menu").tourl()))
# pre-serialised
if config.get_setting('quick_menu'): context.append((config.get_localized_string(60360), 'RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJzaG9ydGN1dF9tZW51IiwgCiAgICAiY2hhbm5lbCI6ICJzaG9ydGN1dHMiLCAKICAgICJpbmZvTGFiZWxzIjoge30KfQ%3D%3D)'))
# if config.get_setting('kod_menu'): context.append((config.get_localized_string(60026), 'RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJzZXR0aW5nc19tZW51IiwgCiAgICAiY2hhbm5lbCI6ICJzaG9ydGN1dHMiLCAKICAgICJpbmZvTGFiZWxzIjoge30KfQ%3D%3D)'))
# pre-serialised
if config.getSetting('quick_menu'): context.append((config.getLocalizedString(60360), 'RunPlugin(plugin://plugin.video.kod/?channel=shortcuts&action=shortcut_menu)'))
# if config.getSetting('kod_menu'): context.append((config.getLocalizedString(60026), 'RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJzZXR0aW5nc19tZW51IiwgCiAgICAiY2hhbm5lbCI6ICJzaG9ydGN1dHMiLCAKICAgICJpbmZvTGFiZWxzIjoge30KfQ%3D%3D)'))
return context
def open_browser(item):
import webbrowser
if not webbrowser.open(item.url):
import xbmc
if xbmc.getCondVisibility('system.platform.linux') and xbmc.getCondVisibility('system.platform.android'): # android
xbmc.executebuiltin('StartAndroidActivity("", "android.intent.action.VIEW", "", "%s")' % item.url)
else:
platformtools.dialogOk(config.getLocalizedString(20000), config.getLocalizedString(70740) % "\n".join([item.url[j:j+57] for j in range(0, len(item.url), 57)]))
def gotopage(item):
item.channel = item.from_cannel
from core import scrapertools
head = config.getLocalizedString(70511)
scraped_page = scrapertools.find_single_match(item.url,'[=/]([0-9]+)')
if item.total_pages and (item.page or scraped_page.isdigit()):
pages = [str(p) for p in range(1, item.total_pages + 1)]
page = item.page if item.page else int(scraped_page)
page = platformtools.dialogSelect(head, pages, page - 2) + 1
else:
page = platformtools.dialogNumeric(0, head)
if page and int(page) > -1:
import xbmc
item.action = item.real_action
item.page = int(page)
item.update = True
import re
item.url = re.sub('([=/])[0-9]+(/?)$', '\g<1>{}\g<2>'.format(page), item.url)
xbmc.executebuiltin("Container.Update(%s?%s)" % (sys.argv[0], item.tourl()))
def gotoseason(item):
item.channel = item.from_cannel
head = 'Seleziona la stagione'
seasons = [str(s) for s in item.allSeasons]
season = platformtools.dialogSelect(head, seasons, item.nextSeason - 1)
if int(season) > -1:
import xbmc
item.action = item.real_action
item.nextSeason = season
item.update = True
xbmc.executebuiltin("Container.Update(%s?%s)" % (sys.argv[0], item.tourl()))
return context
def shortcut_menu(item):
from platformcode import keymaptools
keymaptools.open_shortcut_menu()
from platformcode import keymaptools
if item.add:
keymaptools.set_key()
elif item.delete:
keymaptools.delete_key()
else:
keymaptools.open_shortcut_menu()
def settings_menu(item):
from platformcode import config
config.open_settings()
from platformcode import config
config.openSettings()
def servers_menu(item):
from core import servertools
from core.item import Item
from platformcode import config, platformtools
from specials import setting
from core import servertools
from core.item import Item
from platformcode import config, platformtools
from specials import setting
names = []
ids = []
names = []
ids = []
if item.type == 'debriders':
action = 'server_debrid_config'
server_list = list(servertools.get_debriders_list().keys())
for server in server_list:
server_parameters = servertools.get_server_parameters(server)
if server_parameters['has_settings'] and server_parameters['active']:
names.append(server_parameters['name'])
ids.append(server)
if item.type == 'debriders':
action = 'server_debrid_config'
server_list = list(servertools.get_debriders_list().keys())
for server in server_list:
server_parameters = servertools.get_server_parameters(server)
if server_parameters['has_settings'] and server_parameters['active']:
names.append(server_parameters['name'])
ids.append(server)
select = platformtools.dialog_select(config.get_localized_string(60552), names)
if select != -1:
ID = ids[select]
select = platformtools.dialogSelect(config.getLocalizedString(60552), names)
if select != -1:
ID = ids[select]
it = Item(channel = 'settings',
action = action,
config = ID)
setting.server_debrid_config(it)
else:
action = 'server_config'
server_list = list(servertools.get_servers_list().keys())
for server in sorted(server_list):
server_parameters = servertools.get_server_parameters(server)
if server_parameters["has_settings"] and [x for x in server_parameters["settings"]] and server_parameters['active']:
names.append(server_parameters['name'])
ids.append(server)
it = Item(channel = 'settings',
action = action,
config = ID)
setting.server_debrid_config(it)
else:
action = 'server_config'
server_list = list(servertools.get_servers_list().keys())
for server in sorted(server_list):
server_parameters = servertools.get_server_parameters(server)
if server_parameters["has_settings"] and [x for x in server_parameters["settings"]] and server_parameters['active']:
names.append(server_parameters['name'])
ids.append(server)
select = platformtools.dialog_select(config.get_localized_string(60538), names)
if select != -1:
ID = ids[select]
select = platformtools.dialogSelect(config.getLocalizedString(60538), names)
if select != -1:
ID = ids[select]
it = Item(channel = 'settings',
action = action,
config = ID)
it = Item(channel = 'settings',
action = action,
config = ID)
setting.server_config(it)
if select != -1:
servers_menu(item)
setting.server_config(it)
if select != -1:
servers_menu(item)
def channels_menu(item):
import channelselector
from core import channeltools
from core.item import Item
from platformcode import config, platformtools
from specials import setting
import channelselector
from core import channeltools
from core.item import Item
from platformcode import config, platformtools
from specials import setting
names = []
ids = []
names = []
ids = []
channel_list = channelselector.filterchannels("all")
for channel in channel_list:
if not channel.channel:
continue
channel_parameters = channeltools.get_channel_parameters(channel.channel)
if channel_parameters["has_settings"]:
names.append(channel.title)
ids.append(channel.channel)
channel_list = channelselector.filterchannels("all")
for channel in channel_list:
if not channel.channel:
continue
channel_parameters = channeltools.get_channel_parameters(channel.channel)
if channel_parameters["has_settings"]:
names.append(channel.title)
ids.append(channel.channel)
select = platformtools.dialog_select(config.get_localized_string(60537), names)
if select != -1:
ID = ids[select]
select = platformtools.dialogSelect(config.getLocalizedString(60537), names)
if select != -1:
ID = ids[select]
it = Item(channel='settings',
action="channel_config",
config=ID)
it = Item(channel='settings',
action="channel_config",
config=ID)
setting.channel_config(it)
return channels_menu(item)
setting.channel_config(it)
return channels_menu(item)
def check_channels(item):
from specials import setting
from platformcode import config, platformtools
item.channel = 'setting'
item.extra = 'lib_check_datajson'
itemlist = setting.conf_tools(item)
text = ''
for item in itemlist:
text += item.title + '\n'
platformtools.dialog_textviewer(config.get_localized_string(60537), text)
from specials import setting
from platformcode import config, platformtools
item.channel = 'setting'
item.extra = 'lib_check_datajson'
itemlist = setting.conf_tools(item)
text = ''
for item in itemlist:
text += item.title + '\n'
platformtools.dialogTextviewer(config.getLocalizedString(60537), text)
def SettingOnPosition(item):
# addonId is the Addon ID
# item.category is the Category (Tab) offset (0=first, 1=second, 2...etc)
# item.setting is the Setting (Control) offse (0=first, 1=second, 2...etc)
# This will open settings dialog focusing on fourth setting (control) inside the third category (tab)
# addonId is the Addon ID
# item.category is the Category (Tab) offset (0=first, 1=second, 2...etc)
# item.setting is the Setting (Control) offse (0=first, 1=second, 2...etc)
# This will open settings dialog focusing on fourth setting (control) inside the third category (tab)
import xbmc
from platformcode import config
config.open_settings()
category = item.category if item.category else 0
setting = item.setting if item.setting else 0
logger.debug('SETTING= ' + str(setting))
xbmc.executebuiltin('SetFocus(%i)' % (category - 100))
xbmc.executebuiltin('SetFocus(%i)' % (setting - 80))
import xbmc
from platformcode import config
config.openSettings()
category = item.category if item.category else 0
setting = item.setting if item.setting else 0
logger.debug('SETTING= ' + str(setting))
xbmc.executebuiltin('SetFocus(%i)' % (category - 100))
xbmc.executebuiltin('SetFocus(%i)' % (setting - 80))
def select(item):
from platformcode import config, platformtools
# item.id = setting ID
# item.type = labels or values
# item.values = values separeted by |
# item.label = string or string id
from platformcode import config, platformtools
# item.id = setting ID
# item.type = labels or values
# item.values = values separeted by |
# item.label = string or string id
label = config.get_localized_string(int(item.label)) if item.label.isdigit() else item.label
values = []
label = config.getLocalizedString(int(item.label)) if item.label.isdigit() else item.label
values = []
if item.type == 'labels':
for val in item.values.split('|'):
values.append(config.get_localized_string(int(val)))
else:
values = item.values.split('|')
ID = config.get_setting(item.id) if config.get_setting(item.id) else 0
select = platformtools.dialog_select(label, values, ID)
if item.type == 'labels':
for val in item.values.split('|'):
values.append(config.getLocalizedString(int(val)))
else:
values = item.values.split('|')
ID = config.getSetting(item.id) if config.getSetting(item.id) else 0
select = platformtools.dialogSelect(label, values, ID)
config.set_setting(item.id, values[select])
config.setSetting(item.id, values[select])
+5 -5
View File
@@ -224,8 +224,8 @@ def set_color(title, category):
# logger.info()
from core import jsontools
styles_path = os.path.join(config.get_runtime_path(), 'resources', 'color_styles.json')
preset = config.get_setting("preset_style", default="Estilo 1")
styles_path = os.path.join(config.getRuntimePath(), 'resources', 'color_styles.json')
preset = config.getSetting("preset_style", default="Estilo 1")
color_setting = jsontools.load((open(styles_path, "r").read()))[preset]
color_scheme = {'otro': 'white', 'dual': 'white'}
@@ -238,14 +238,14 @@ def set_color(title, category):
'vos', 'vo', 'server', 'library', 'update', 'no_update']
# Check the status of the custom colors options
custom_colors = config.get_setting('title_color')
custom_colors = config.getSetting('title_color')
# The color dictionary is formed for each element, the option is active uses the user's configuration, if it does not leave the title blank.
if title not in ['', ' ']:
for element in color_list:
if custom_colors:
color_scheme[element] = remove_format(config.get_setting('%s_color' % element))
color_scheme[element] = remove_format(config.getSetting('%s_color' % element))
else:
color_scheme[element] = remove_format(color_setting.get(element, 'white'))
# color_scheme[element] = 'white'
@@ -570,7 +570,7 @@ def thumbnail_type(item):
# logger.info()
# Check what type of thumbnail will be used in findvideos, Poster or Logo of the server
thumb_type = config.get_setting('video_thumbnail_type')
thumb_type = config.getSetting('video_thumbnail_type')
info = item.infoLabels
if not item.contentThumbnail:
item.contentThumbnail = item.thumbnail
+9 -9
View File
@@ -42,7 +42,7 @@ def loadCommits(page=1):
except:
xbmc.sleep(1000)
else:
platformtools.dialog_notification(addonname, config.get_localized_string(70675))
platformtools.dialogNotification(addonname, config.getLocalizedString(70675))
ret = None
return ret
@@ -158,7 +158,7 @@ def check(background=False):
if addon.getSetting("addon_update_message"):
if background:
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(80040) % commits[0]['sha'][:7], time=3000, sound=False)
platformtools.dialogNotification(config.getLocalizedString(20000), config.getLocalizedString(80040) % commits[0]['sha'][:7], time=3000, sound=False)
try:
with open(config.changelogFile, 'a+') as fileC:
fileC.write(changelog)
@@ -166,7 +166,7 @@ def check(background=False):
import traceback
logger.error(traceback.format_exc())
elif changelog:
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(80041) + changelog)
platformtools.dialogOk(config.getLocalizedString(20000), config.getLocalizedString(80041) + changelog)
else:
logger.info('Nessun nuovo aggiornamento')
@@ -221,8 +221,8 @@ def getShaStr(str):
def updateFromZip(message=config.get_localized_string(80050)):
dp = platformtools.dialog_progress_bg(config.get_localized_string(20000), message)
def updateFromZip(message=config.getLocalizedString(80050)):
dp = platformtools.dialogProgressBg(config.getLocalizedString(20000), message)
dp.update(0)
remotefilename = 'https://github.com/' + user + "/" + repo + "/archive/" + branch + ".zip"
@@ -242,7 +242,7 @@ def updateFromZip(message=config.get_localized_string(80050)):
urllib.urlretrieve(remotefilename, localfilename,
lambda nb, bs, fs, url=remotefilename: _pbhook(nb, bs, fs, url, dp))
except Exception as e:
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(80031))
platformtools.dialogOk(config.getLocalizedString(20000), config.getLocalizedString(80031))
logger.info('Non sono riuscito a scaricare il file zip')
logger.info(e)
dp.close()
@@ -255,7 +255,7 @@ def updateFromZip(message=config.get_localized_string(80050)):
if os.path.isfile(localfilename):
logger.info('il file esiste')
dp.update(80, config.get_localized_string(20000) + '\n' + config.get_localized_string(80032))
dp.update(80, config.getLocalizedString(20000) + '\n' + config.getLocalizedString(80032))
import zipfile
try:
@@ -297,7 +297,7 @@ def updateFromZip(message=config.get_localized_string(80050)):
dp.update(100)
xbmc.sleep(1000)
dp.close()
if message != config.get_localized_string(80050):
if message != config.getLocalizedString(80050):
xbmc.executebuiltin("UpdateLocalAddons")
refreshLang()
@@ -306,7 +306,7 @@ def updateFromZip(message=config.get_localized_string(80050)):
def refreshLang():
from platformcode import config
language = config.get_localized_string(20001)
language = config.getLocalizedString(20001)
if language == 'eng':
xbmc.executebuiltin("SetGUILanguage(resource.language.it_it)")
xbmc.executebuiltin("SetGUILanguage(resource.language.en_en)")
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -19,7 +19,7 @@ BACKSPACE = 92
def imagepath(image):
if len(image.split('.')) == 1: image += '.png'
path = filetools.join(config.get_runtime_path(), 'resources', 'skins' , 'Default', 'media', 'Infoplus', image)
path = filetools.join(config.getRuntimePath(), 'resources', 'skins' , 'Default', 'media', 'Infoplus', image)
return path
class InfoWindow(xbmcgui.WindowXMLDialog):
@@ -48,7 +48,7 @@ class InfoWindow(xbmcgui.WindowXMLDialog):
return it
def onInit(self):
if config.get_platform(True)['num_version'] < 18:
if config.getXBMCPlatform(True)['num_version'] < 18:
self.setCoordinateResolution(2)
results = []
with futures.ThreadPoolExecutor() as executor:
+89 -78
View File
@@ -18,15 +18,16 @@ from core import scrapertools
from xml.dom import minidom
def mark_auto_as_watched(item):
def mark_auto_as_watched():
def mark_as_watched_subThread(item):
logger.debug()
# logger.dbg()
actual_time = 0
total_time = 0
time_limit = time.time() + 10
while not platformtools.is_playing() and time.time() < time_limit:
time.sleep(1)
# time_limit = time.time() + 10
# while not platformtools.isPlaying() and time.time() < time_limit:
# time.sleep(1)
marked = False
sync = False
@@ -34,48 +35,46 @@ def mark_auto_as_watched(item):
show_server = True
mark_time = 100
percentage = float(config.get_setting("watched_setting")) / 100
time_from_end = config.get_setting('next_ep_seconds')
percentage = float(config.getSetting("watched_setting")) / 100
time_from_end = config.getSetting('next_ep_seconds')
if item.contentType != 'movie' and 0 < config.get_setting('next_ep') < 3:
if item.contentType != 'movie' and 0 < config.getSetting('next_ep') < 3:
next_dialogs = ['NextDialog.xml', 'NextDialogExtended.xml', 'NextDialogCompact.xml']
next_ep_type = config.get_setting('next_ep_type')
next_ep_type = config.getSetting('next_ep_type')
ND = next_dialogs[next_ep_type]
try: next_episode = next_ep(item)
except: next_episode = False
logger.debug(next_episode)
while not xbmc.Monitor().abortRequested():
if not platformtools.is_playing(): break
if not platformtools.isPlaying(): break
try: actual_time = xbmc.Player().getTime()
except: actual_time = 0
try: total_time = xbmc.Player().getTotalTime()
except: total_time = 0
if item.played_time and xbmcgui.getCurrentWindowId() == 12005:
if actual_time and item.played_time and xbmcgui.getCurrentWindowId() == 12005:
logger.debug('VAI A', item.played_time)
xbmc.Player().seekTime(item.played_time)
item.played_time = 0 # Fix for Slow Devices
item.played_time = 0
mark_time = total_time * percentage
difference = total_time - actual_time
# Mark as Watched
if actual_time > mark_time and not marked:
if actual_time > mark_time and mark_time > 0 and not marked:
logger.info("Marked as Watched")
item.playcount = 1
marked = True
item.played_time = 0
platformtools.set_played_time(item)
platformtools.setPlayedTime(item)
if item.options['strm'] : sync = True
show_server = False
# from specials import videolibrary
# videolibrary.mark_content_as_watched(item)
if not next_episode:
break
# check for next Episode
if next_episode and marked and time_from_end >= difference:
nextdialog = NextDialog(ND, config.get_runtime_path(), item=next_episode)
while platformtools.is_playing() and not nextdialog.is_exit():
nextdialog = NextDialog(ND, config.getRuntimePath(), item=next_episode)
while platformtools.isPlaying() and not nextdialog.is_exit():
xbmc.sleep(100)
if nextdialog.continuewatching:
next_episode.next_ep = True
@@ -83,27 +82,32 @@ def mark_auto_as_watched(item):
nextdialog.close()
break
# if item.options['continue']:
if actual_time < mark_time:
item.played_time = actual_time
else: item.played_time = 0
platformtools.set_played_time(item)
if mark_time:
logger.debug('Set Played Time', item.played_time)
platformtools.setPlayedTime(item)
# Silent sync with Trakt
if sync and config.get_setting("trakt_sync"): sync_trakt_kodi()
if sync and config.getSetting("trakt_sync"): sync_trakt_kodi()
while platformtools.is_playing():
xbmc.sleep(100)
while platformtools.isPlaying():
xbmc.sleep(10)
if not show_server and not item.no_return and not item.window:
xbmc.sleep(700)
xbmc.executebuiltin('Action(ParentDir)')
if not show_server and not item.no_return:
if item.window:
# xbmc.executebuiltin('ActivateWindow({})'.format(filetools.join(config.getRuntimePath(), 'resources', 'skins', 'Default', '720p', 'Servers.xml')))
xbmc.executebuiltin('Action(BackSpace)')
else:
xbmc.sleep(700)
xbmc.executebuiltin('Action(ParentDir)')
if marked:
from specials import videolibrary
videolibrary.mark_content_as_watched(item)
if next_episode and next_episode.next_ep and config.get_setting('next_ep') == 1:
if next_episode and next_episode.next_ep and config.getSetting('next_ep') == 1:
from platformcode.launcher import run
run(next_episode)
@@ -112,8 +116,15 @@ def mark_auto_as_watched(item):
db.close()
# If it is configured to mark as seen
if config.get_setting("mark_as_watched", "videolibrary"):
threading.Thread(target=mark_as_watched_subThread, args=[item]).start()
if config.getSetting("mark_as_watched", "videolibrary"):
from core import db
item = db['playitem'].get('item')
db.close()
imdb_id = xbmc.Player().getVideoInfoTag().getIMDBNumber()
if item.infoLabels['imdb_id'] == imdb_id:
# mark_as_watched_subThread(item)
threading.Thread(target=mark_as_watched_subThread, args=[item]).start()
logger.debug('EXIT MONITOR')
def sync_trakt_addon(path_folder):
@@ -242,14 +253,14 @@ def sync_trakt_kodi(silent=True):
# So that the synchronization is not silent it is worth with silent = False
if xbmc.getCondVisibility('System.HasAddon("script.trakt")'):
notificacion = True
if not config.get_setting("sync_trakt_notification", "videolibrary") and platformtools.is_playing():
if platformtools.isPlaying():
notificacion = False
xbmc.executebuiltin('RunScript(script.trakt,action=sync,silent=%s)' % silent)
logger.debug("Synchronization with Trakt started")
if notificacion:
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(60045), sound=False, time=2000)
platformtools.dialogNotification(config.getLocalizedString(20000), config.getLocalizedString(60045), sound=False, time=2000)
def mark_content_as_watched_on_kodi(item, value=1):
@@ -261,7 +272,7 @@ def mark_content_as_watched_on_kodi(item, value=1):
@param value: > 0 for seen, 0 for not seen
"""
logger.debug()
logger.dbg()
# logger.dbg()
if item.contentType == 'movie':
path = '%{}%'.format(item.strm_path.split('\\')[0].split('/')[0] if item.strm_path else item.base_name)
@@ -369,14 +380,14 @@ def mark_content_as_watched_on_kod(path):
logger.debug()
#logger.debug("path: " + path)
FOLDER_MOVIES = config.get_setting("folder_movies")
FOLDER_TVSHOWS = config.get_setting("folder_tvshows")
VIDEOLIBRARY_PATH = config.get_videolibrary_config_path()
FOLDER_MOVIES = config.getSetting("folder_movies")
FOLDER_TVSHOWS = config.getSetting("folder_tvshows")
VIDEOLIBRARY_PATH = config.getVideolibraryConfigPath()
if not VIDEOLIBRARY_PATH:
return
# set_watched_on_kod
# We can only mark the content as a view in the Kodi database if the database is local, in case of sharing database this functionality will not work
# if config.get_setting("db_mode", "videolibrary"):
# if config.getSetting("db_mode", "videolibrary"):
# return
path2 = ''
@@ -465,14 +476,14 @@ def get_data(payload):
# Required header for XBMC JSON-RPC calls, otherwise you'll get a 415 HTTP response code - Unsupported media type
headers = {'content-type': 'application/json'}
if config.get_setting("db_mode", "videolibrary"):
if config.getSetting("db_mode", "videolibrary"):
try:
try:
xbmc_port = config.get_setting("xbmc_puerto", "videolibrary")
xbmc_port = config.getSetting("xbmc_puerto", "videolibrary")
except:
xbmc_port = 0
xbmc_json_rpc_url = "http://" + config.get_setting("xbmc_host", "videolibrary") + ":" + str(xbmc_port) + "/jsonrpc"
xbmc_json_rpc_url = "http://" + config.getSetting("xbmc_host", "videolibrary") + ":" + str(xbmc_port) + "/jsonrpc"
req = urllib2.Request(xbmc_json_rpc_url, data=jsontools.dump(payload), headers=headers)
f = urllib.urlopen(req)
response = f.read()
@@ -499,7 +510,7 @@ def get_data(payload):
return data
def update(folder_content=config.get_setting("folder_tvshows"), folder=""):
def update(folder_content=config.getSetting("folder_tvshows"), folder=""):
"""
Update the library depending on the type of content and the path passed to it.
@@ -518,7 +529,7 @@ def update(folder_content=config.get_setting("folder_tvshows"), folder=""):
if folder:
folder = str(folder)
videolibrarypath = config.get_videolibrary_config_path()
videolibrarypath = config.getVideolibraryConfigPath()
if folder.endswith('/') or folder.endswith('\\'):
folder = folder[:-1]
@@ -561,17 +572,17 @@ def search_local_path(item):
for record in records:
num_path, path_records = execute_sql_kodi('SELECT strPath FROM path WHERE idPath LIKE "%s"' % record[0])
for path in path_records:
if config.get_setting('videolibrarypath') not in path[0]:
if config.getSetting('videolibrarypath') not in path[0]:
return path[0]
return ''
def set_content(silent=False):
logger.debug()
videolibrarypath = config.get_setting("videolibrarypath")
videolibrarypath = config.getSetting("videolibrarypath")
sep = '/' if '/' in videolibrarypath else '\\'
paths = {'movie': filetools.join(videolibrarypath, config.get_setting('folder_movies')) + sep,
'tvshow': filetools.join(videolibrarypath, config.get_setting('folder_tvshows')) + sep}
paths = {'movie': filetools.join(videolibrarypath, config.getSetting('folder_movies')) + sep,
'tvshow': filetools.join(videolibrarypath, config.getSetting('folder_tvshows')) + sep}
for k, v in paths.items():
sql = 'SELECT idPath, strPath FROM path where strPath= "{}"'.format(v)
n, records = execute_sql_kodi(sql)
@@ -631,7 +642,7 @@ def update_db(old_path, new_path, old_movies_folder, new_movies_folder, old_tvsh
return
p = 80
progress.update(p, config.get_localized_string(20000), config.get_localized_string(80013))
progress.update(p, config.getLocalizedString(20000), config.getLocalizedString(80013))
for OldFolder, NewFolder in [[old_movies_folder, new_movies_folder], [old_tvshows_folder, new_tvshows_folder]]:
sql_old_folder = sql_old_path + OldFolder
@@ -694,7 +705,7 @@ def update_db(old_path, new_path, old_movies_folder, new_movies_folder, old_tvsh
logger.debug('sql: ' + sql)
nun_records, records = execute_sql_kodi(sql)
p += 5
progress.update(p, config.get_localized_string(20000), config.get_localized_string(80013))
progress.update(p, config.getLocalizedString(20000), config.getLocalizedString(80013))
progress.update(100)
xbmc.sleep(1000)
@@ -718,14 +729,14 @@ def clean(path_list=[]):
logger.debug()
progress = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(80025))
progress = platformtools.dialogProgressBg(config.getLocalizedString(20000), config.getLocalizedString(80025))
progress.update(0)
# if the path list is empty, clean the entire video library
if not path_list:
logger.debug('the path list is empty, clean the entire video library')
if not config.get_setting("videolibrary_kodi"):
sql_path, sep = sql_format(config.get_setting("videolibrarypath"))
if not config.getSetting("videolibrary_kodi"):
sql_path, sep = sql_format(config.getSetting("videolibrarypath"))
if not sql_path.endswith(sep): sql_path += sep
sql = 'SELECT idPath FROM path where strPath LIKE "%s"' % sql_path
logger.debug('sql: ' + sql)
@@ -742,13 +753,13 @@ def clean(path_list=[]):
from core import videolibrarytools
for path, folders, files in filetools.walk(videolibrarytools.MOVIES_PATH):
for folder in folders:
path_list.append(filetools.join(config.get_setting("videolibrarypath"), videolibrarytools.FOLDER_MOVIES, folder))
path_list.append(filetools.join(config.getSetting("videolibrarypath"), videolibrarytools.FOLDER_MOVIES, folder))
for path, folders, files in filetools.walk(videolibrarytools.TVSHOWS_PATH):
for folder in folders:
tvshow_nfo = filetools.join(path, folder, "tvshow.nfo")
if filetools.exists(tvshow_nfo):
path_list.append(filetools.join(config.get_setting("videolibrarypath"), videolibrarytools.FOLDER_TVSHOWS, folder))
path_list.append(filetools.join(config.getSetting("videolibrarypath"), videolibrarytools.FOLDER_TVSHOWS, folder))
logger.debug('path_list: ' + str(path_list))
if path_list: t = float(100) / len(path_list)
@@ -781,7 +792,7 @@ def clean(path_list=[]):
if records:
payload = {"jsonrpc": "2.0", "method": "VideoLibrary.RemoveTVShow", "id": 1, "params": {"tvshowid": records[0][0]}}
data = get_data(payload)
elif config.get_setting("folder_movies") in sql_path:
elif config.getSetting("folder_movies") in sql_path:
# search movie in the DB
sql = 'SELECT idMovie FROM movie where c22 LIKE "%s"' % sql_path
logger.debug('sql: ' + sql)
@@ -866,7 +877,7 @@ def get_file_db():
"""
file_db = ''
# We look for the archive of the video database according to the version of kodi
video_db = config.get_platform(True)['video_db']
video_db = config.getXBMCPlatform(True)['video_db']
if video_db:
file_db = filetools.join(xbmc.translatePath("special://userdata/Database"), video_db)
@@ -1067,71 +1078,71 @@ def update_sources(new='', old=''):
def ask_set_content(silent=False):
logger.debug()
logger.debug("videolibrary_kodi %s" % config.get_setting("videolibrary_kodi"))
logger.debug("videolibrary_kodi %s" % config.getSetting("videolibrary_kodi"))
def do_config(custom=False):
if set_content("movie", True, custom) and set_content("tvshow", True, custom):
platformtools.dialog_ok(config.get_localized_string(80026), config.get_localized_string(70104))
config.set_setting("videolibrary_kodi", True)
platformtools.dialogOk(config.getLocalizedString(80026), config.getLocalizedString(70104))
config.setSetting("videolibrary_kodi", True)
from specials import videolibrary
videolibrary.update_videolibrary()
update()
else:
platformtools.dialog_ok(config.get_localized_string(80026), config.get_localized_string(80024))
config.set_setting("videolibrary_kodi", False)
platformtools.dialogOk(config.getLocalizedString(80026), config.getLocalizedString(80024))
config.setSetting("videolibrary_kodi", False)
# configuration during installation
if not silent:
# ask to configure Kodi video library
if platformtools.dialog_yesno(config.get_localized_string(20000), config.get_localized_string(80015)):
if platformtools.dialogYesNo(config.getLocalizedString(20000), config.getLocalizedString(80015)):
# ask for custom or default settings
if not platformtools.dialog_yesno(config.get_localized_string(80026), config.get_localized_string(80016), config.get_localized_string(80017), config.get_localized_string(80018)):
if not platformtools.dialogYesNo(config.getLocalizedString(80026), config.getLocalizedString(80016), config.getLocalizedString(80017), config.getLocalizedString(80018)):
# input path and folders
path = platformtools.dialog_browse(3, config.get_localized_string(80019), config.get_setting("videolibrarypath"))
movies_folder = platformtools.dialog_input(config.get_setting("folder_movies"), config.get_localized_string(80020))
tvshows_folder = platformtools.dialog_input(config.get_setting("folder_tvshows"), config.get_localized_string(80021))
path = platformtools.dialogBrowse(3, config.getLocalizedString(80019), config.getSetting("videolibrarypath"))
movies_folder = platformtools.dialogInput(config.getSetting("folder_movies"), config.getLocalizedString(80020))
tvshows_folder = platformtools.dialogInput(config.getSetting("folder_tvshows"), config.getLocalizedString(80021))
if path != "" and movies_folder != "" and tvshows_folder != "":
movies_path, tvshows_path = check_sources(filetools.join(path, movies_folder), filetools.join(path, tvshows_folder))
# configure later
if movies_path or tvshows_path:
platformtools.dialog_ok(config.get_localized_string(80026), config.get_localized_string(80029))
platformtools.dialogOk(config.getLocalizedString(80026), config.getLocalizedString(80029))
# set path and folders
else:
update_sources(path, config.get_setting("videolibrarypath"))
config.set_setting("videolibrarypath", path)
config.set_setting("folder_movies", movies_folder)
config.set_setting("folder_tvshows", tvshows_folder)
config.verify_directories_created()
update_sources(path, config.getSetting("videolibrarypath"))
config.setSetting("videolibrarypath", path)
config.setSetting("folder_movies", movies_folder)
config.setSetting("folder_tvshows", tvshows_folder)
config.verifyDirectoriesCreated()
do_config(False)
# default path and folders
else:
platformtools.dialog_ok(config.get_localized_string(80026), config.get_localized_string(80030))
platformtools.dialogOk(config.getLocalizedString(80026), config.getLocalizedString(80030))
do_config(False)
# default settings
else:
platformtools.dialog_ok(config.get_localized_string(80026), config.get_localized_string(80027))
platformtools.dialogOk(config.getLocalizedString(80026), config.getLocalizedString(80027))
do_config(False)
# configure later
else:
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(80022))
platformtools.dialogOk(config.getLocalizedString(20000), config.getLocalizedString(80022))
# configuration from the settings menu
else:
platformtools.dialog_ok(config.get_localized_string(80026), config.get_localized_string(80023))
platformtools.dialogOk(config.getLocalizedString(80026), config.getLocalizedString(80023))
do_config(False)
def next_ep(item):
logger.debug(item)
episode = '{}x{:02d}'.format(item.contentSeason, item.contentEpisodeNumber)
episodes = sorted(videolibrarydb.videolibrarydb['episode'][item.videolibrary_id].items())
videolibrarydb.videolibrarydb.close()
episodes = sorted(videolibrarydb['episode'][item.videolibrary_id].items())
videolibrarydb.close()
nextIndex = [k for k, v in episodes].index(episode) + 1
if nextIndex == 0 or nextIndex == len(episodes):
it = None
else:
it = episodes[nextIndex][1]['item']
if item.from_library: it.action = 'play_from_library'
if item.from_library: it.action = 'playFromLibrary'
logger.debug('Next File:' + '{}x{:02d}. {}'.format(it.contentSeason, it.contentEpisodeNumber, it.title))
return it
@@ -1150,7 +1161,7 @@ class NextDialog(xbmcgui.WindowXMLDialog):
info = kwargs.get('item').infoLabels
if "fanart" in info: img = info["fanart"]
elif "thumbnail" in info: img = info["thumbnail"]
else: img = filetools.join(config.get_runtime_path(), "resources", "noimage.png")
else: img = filetools.join(config.getRuntimePath(), "resources", "noimage.png")
self.setProperty("next_img", img)
self.setProperty("title", info["tvshowtitle"])
self.setProperty("ep_title", "{}x{:02d}. {}".format(info["season"], info["episode"], info["title"]))
@@ -973,7 +973,7 @@ msgid "AutoPlay Language (Optional)"
msgstr ""
msgctxt "#60081"
msgid " Favorite servers"
msgid "Favorite servers"
msgstr ""
msgctxt "#60082"
@@ -981,7 +981,7 @@ msgid "Favorite server %s"
msgstr ""
msgctxt "#60083"
msgid " Preferred Qualities"
msgid "Preferred Qualities"
msgstr ""
msgctxt "#60084"
@@ -989,7 +989,7 @@ msgid "Preferred Quality %s"
msgstr ""
msgctxt "#60085"
msgid " Priority (Indicates the order for AutoPlay)"
msgid "Priority (Indicates the order for AutoPlay)"
msgstr ""
msgctxt "#60086"
@@ -1161,27 +1161,27 @@ msgid "Identifiers:"
msgstr ""
msgctxt "#60234"
msgid " The Movie Database ID"
msgid "The Movie Database ID"
msgstr ""
msgctxt "#60235"
msgid " URL Tmdb"
msgid "URL Tmdb"
msgstr ""
msgctxt "#60236"
msgid " The TVDB ID"
msgid "The TVDB ID"
msgstr ""
msgctxt "#60237"
msgid " URL TVDB"
msgid "URL TVDB"
msgstr ""
msgctxt "#60238"
msgid " IMDb ID"
msgid "IMDb ID"
msgstr ""
msgctxt "#60239"
msgid " Other ID"
msgid "Other ID"
msgstr ""
msgctxt "#60240"
@@ -1189,11 +1189,11 @@ msgid "Images"
msgstr ""
msgctxt "#60241"
msgid " Background"
msgid "Background"
msgstr ""
msgctxt "#60242"
msgid " Thumbnail"
msgid "Thumbnail"
msgstr ""
msgctxt "#60243"
@@ -1953,39 +1953,39 @@ msgid "Guide (opens the browser)"
msgstr ""
msgctxt "#60448"
msgid " - How do I report an error?"
msgid " - How do I report an error?"
msgstr ""
msgctxt "#60449"
msgid " - Is it possible to enable/disable channels?"
msgid " - Is it possible to enable/disable channels?"
msgstr ""
msgctxt "#60450"
msgid " - Is automatic synchronization with Trakt possible?"
msgid " - Is automatic synchronization with Trakt possible?"
msgstr ""
msgctxt "#60451"
msgid " - Is it possible to show all the results together in the global search?"
msgid " - Is it possible to show all the results together in the global search?"
msgstr ""
msgctxt "#60452"
msgid " - Links take too long to appear."
msgid " - Links take too long to appear."
msgstr ""
msgctxt "#60453"
msgid " - The content search is not performed correctly."
msgid " - The content search is not performed correctly."
msgstr ""
msgctxt "#60454"
msgid " - Some channels do not function properly."
msgid " - Some channels do not function properly."
msgstr ""
msgctxt "#60455"
msgid " - The library does not update correctly."
msgid " - The library does not update correctly."
msgstr ""
msgctxt "#60456"
msgid " - Links of interest"
msgid " - Links of interest"
msgstr ""
msgctxt "#60457"
@@ -2265,23 +2265,23 @@ msgid "Included channels by category"
msgstr ""
msgctxt "#60526"
msgid " - Movies "
msgid " - Movies "
msgstr ""
msgctxt "#60527"
msgid " - Kids"
msgid " - Kids"
msgstr ""
msgctxt "#60528"
msgid " - TV show episodes"
msgid " - TV show episodes"
msgstr ""
msgctxt "#60529"
msgid " - Anime episodes"
msgid " - Anime episodes"
msgstr ""
msgctxt "#60530"
msgid " - Documentaries"
msgid " - Documentaries"
msgstr ""
msgctxt "#60531"
@@ -2369,7 +2369,7 @@ msgid "Debriders settings"
msgstr ""
msgctxt "#60553"
msgid " Server configuration '%s'"
msgid "Server configuration '%s'"
msgstr ""
msgctxt "#60554"
@@ -2409,7 +2409,7 @@ msgid "Channel Options"
msgstr ""
msgctxt "#60565"
msgid " Check the files * _data.json"
msgid "Check the files * _data.json"
msgstr ""
msgctxt "#60566"
@@ -2445,7 +2445,7 @@ msgid "Order Servers"
msgstr ""
msgctxt "#60578"
msgid " Server #%s"
msgid "Server #%s"
msgstr ""
msgctxt "#60579"
@@ -2521,7 +2521,7 @@ msgid "Channels"
msgstr ""
msgctxt "#60597"
msgid " Server #%s"
msgid "Server #%s"
msgstr ""
msgctxt "#60598"
@@ -2557,7 +2557,7 @@ msgid "When Kodi starts and daily"
msgstr ""
msgctxt "#60606"
msgid " Update waiting time"
msgid "Update waiting time"
msgstr ""
msgctxt "#60607"
@@ -2581,11 +2581,11 @@ msgid "60 sec"
msgstr ""
msgctxt "#60613"
msgid " Update time"
msgid "Update time"
msgstr ""
msgctxt "#60614"
msgid " Search for new episodes"
msgid "Search for new episodes"
msgstr ""
msgctxt "#60615"
@@ -2601,7 +2601,7 @@ msgid "Based on airing"
msgstr ""
msgctxt "#60618"
msgid " Kodi video library update"
msgid "Kodi video library update"
msgstr ""
msgctxt "#60619"
@@ -2625,7 +2625,7 @@ msgid "Pop-up window"
msgstr ""
msgctxt "#60624"
msgid " Maximum number of links to display"
msgid "Maximum number of links to display"
msgstr ""
msgctxt "#60625"
@@ -2633,15 +2633,15 @@ msgid "All"
msgstr ""
msgctxt "#60626"
msgid " Sort by whitelist"
msgid "Sort by whitelist"
msgstr ""
msgctxt "#60627"
msgid " Remove the channel name at the beginning"
msgid "Remove the channel name at the beginning"
msgstr ""
msgctxt "#60628"
msgid " Replace \'View in\' with \'[V]\' and \'Download in\' with \'[D]\'"
msgid "Replace \'View in\' with \'[V]\' and \'Download in\' with \'[D]\'"
msgstr ""
msgctxt "#60629"
@@ -2649,11 +2649,11 @@ msgid "Remote database"
msgstr "Database remoto"
msgctxt "#60632"
msgid " Server name"
msgid "Server name"
msgstr ""
msgctxt "#60633"
msgid " Server port"
msgid "Server port"
msgstr ""
msgctxt "#60634"
@@ -2661,7 +2661,7 @@ msgid "Automatically mark as watched"
msgstr ""
msgctxt "#60635"
msgid " Video viewing time"
msgid "Video viewing time"
msgstr ""
msgctxt "#60636"
@@ -2669,23 +2669,23 @@ msgid "0 seg"
msgstr ""
msgctxt "#60637"
msgid " Synchronizing with Trakt"
msgid "Synchronizing with Trakt"
msgstr ""
msgctxt "#60638"
msgid " After mark as watched the episode"
msgid "After mark as watched the episode"
msgstr ""
msgctxt "#60639"
msgid " Show notification"
msgid "Show notification"
msgstr ""
msgctxt "#60640"
msgid " On adding a TV show to the video library"
msgid "On adding a TV show to the video library"
msgstr ""
msgctxt "#60641"
msgid " Wait until the TV show is added"
msgid "Wait until the TV show is added"
msgstr ""
msgctxt "#60642"
@@ -2713,19 +2713,19 @@ msgid "Never"
msgstr ""
msgctxt "#60650"
msgid " Video library information providers"
msgid "Video library information providers"
msgstr ""
msgctxt "#60651"
msgid " Movies"
msgid "Movies"
msgstr ""
msgctxt "#60652"
msgid " TV show"
msgid "TV show"
msgstr ""
msgctxt "#60653"
msgid " If there are no results search in English"
msgid "If there are no results search in English"
msgstr ""
msgctxt "#60654"
@@ -2761,7 +2761,7 @@ msgid "News"
msgstr ""
msgctxt "#60662"
msgid " Language"
msgid "Language"
msgstr ""
msgctxt "#60663"
@@ -3109,7 +3109,7 @@ msgid ">> Next Page"
msgstr ""
msgctxt "#70066"
msgid " Search title in spanish: %s"
msgid "Search title in spanish: %s"
msgstr ""
msgctxt "#70067"
@@ -3201,11 +3201,11 @@ msgid "Show only links of %s"
msgstr ""
msgctxt "#70090"
msgid " Exclude all streams with specific words"
msgid "Exclude all streams with specific words"
msgstr ""
msgctxt "#70091"
msgid " Words"
msgid "Words"
msgstr ""
msgctxt "#70092"
@@ -3521,7 +3521,7 @@ msgid "Torrent"
msgstr ""
msgctxt "#70172"
msgid " Plan B (If favourites fail try other links)"
msgid "Plan B (If favourites fail try other links)"
msgstr ""
msgctxt "#70173"
@@ -3661,7 +3661,7 @@ msgid "Link found in %s"
msgstr ""
msgctxt "#70207"
msgid " - Movies 4K "
msgid " - Movies 4K "
msgstr ""
msgctxt "#70208"
@@ -3681,15 +3681,15 @@ msgid " (In %s)"
msgstr ""
msgctxt "#70212"
msgid " - Castellan"
msgid " - Castellan"
msgstr ""
msgctxt "#70213"
msgid " - Latin"
msgid " - Latin"
msgstr ""
msgctxt "#70214"
msgid " - Torrent"
msgid " - Torrent"
msgstr ""
msgctxt "#70215"
@@ -3765,19 +3765,19 @@ msgid "View downloaded files"
msgstr ""
msgctxt "#70233"
msgid " - Size per block"
msgid " - Size per block"
msgstr ""
msgctxt "#70234"
msgid " - Size by part"
msgid " - Size by part"
msgstr ""
msgctxt "#70235"
msgid " - Maximum number of simultaneous connections"
msgid " - Maximum number of simultaneous connections"
msgstr ""
msgctxt "#70236"
msgid " - Maximum number of parts in memory"
msgid " - Maximum number of parts in memory"
msgstr ""
msgctxt "#70237"
@@ -3945,7 +3945,7 @@ msgid "You can try downloading the 'libtorrent' module from Kodi or installing s
msgstr ""
msgctxt "#70280"
msgid " - Torrent Links don't work."
msgid " - Torrent Links don't work."
msgstr ""
msgctxt "#70281"
@@ -4257,7 +4257,7 @@ msgid "Recommendations MyAnimeList"
msgstr ""
msgctxt "#70360"
msgid " [Without subs in castellan]"
msgid " [Without subs in castellan]"
msgstr ""
msgctxt "#70361"
@@ -4325,7 +4325,7 @@ msgid "Info in AniDB %s"
msgstr ""
msgctxt "#70377"
msgid " - Fansubs in spanish:"
msgid " - Fansubs in spanish:"
msgstr ""
msgctxt "#70378"
@@ -972,24 +972,24 @@ msgid "AutoPlay Language (Optional)"
msgstr "Lingua per AutoPlay (opzionale)"
msgctxt "#60081"
msgid " Favorite servers"
msgstr " Server Preferiti"
msgid " Favorite servers"
msgstr " Server Preferiti"
msgctxt "#60082"
msgid "Favorite server %s"
msgstr "Server Preferito %s"
msgctxt "#60083"
msgid " Preferred Qualities"
msgstr " Qualità Preferite"
msgid " Preferred Qualities"
msgstr " Qualità Preferite"
msgctxt "#60084"
msgid "Preferred Quality %s"
msgstr "Qualità Preferita %s"
msgctxt "#60085"
msgid " Priority (Indicates the order for AutoPlay)"
msgstr " Priorità (Indica l'ordine per la Riproduzione Automatica)"
msgid " Priority (Indicates the order for AutoPlay)"
msgstr " Priorità (Indica l'ordine per la Riproduzione Automatica)"
msgctxt "#60086"
msgid "It has been renamed to:"
@@ -1160,40 +1160,40 @@ msgid "Identifiers:"
msgstr "Identificatori:"
msgctxt "#60234"
msgid " The Movie Database ID"
msgstr " The Movie Database ID"
msgid "The Movie Database ID"
msgstr "The Movie Database ID"
msgctxt "#60235"
msgid " URL Tmdb"
msgstr " URL Tmdb"
msgid "URL Tmdb"
msgstr "URL Tmdb"
msgctxt "#60236"
msgid " The TVDB ID"
msgstr " The TVDB ID"
msgid "The TVDB ID"
msgstr "The TVDB ID"
msgctxt "#60237"
msgid " URL TVDB"
msgstr " URL TVDB"
msgid "URL TVDB"
msgstr "URL TVDB"
msgctxt "#60238"
msgid " IMDb ID"
msgstr " IMDb ID"
msgid "IMDb ID"
msgstr "IMDb ID"
msgctxt "#60239"
msgid " Other ID"
msgstr " Altro ID"
msgid "Other ID"
msgstr "Altro ID"
msgctxt "#60240"
msgid "Images"
msgstr "Immagini"
msgctxt "#60241"
msgid " Background"
msgstr " Fondo"
msgid "Background"
msgstr "Fondo"
msgctxt "#60242"
msgid " Thumbnail"
msgstr " Miniatura"
msgid "Thumbnail"
msgstr "Miniatura"
msgctxt "#60243"
msgid "Type of content"
@@ -1952,40 +1952,40 @@ msgid "Guide (opens the browser)"
msgstr "Guida alle funzioni di KoD (apre il browser)"
msgctxt "#60448"
msgid " - How do I report an error?"
msgstr " - Come segnalo un errore?"
msgid " - How do I report an error?"
msgstr " - Come segnalo un errore?"
msgctxt "#60449"
msgid " - Is it possible to enable/disable channels?"
msgstr " - È Possibile attivare/disattivare i canali?"
msgid " - Is it possible to enable/disable channels?"
msgstr " - È Possibile attivare/disattivare i canali?"
msgctxt "#60450"
msgid " - Is automatic synchronization with Trakt possible?"
msgstr " - È possibile la sincronizzazione automatica con Trakt?"
msgid " - Is automatic synchronization with Trakt possible?"
msgstr " - È possibile la sincronizzazione automatica con Trakt?"
msgctxt "#60451"
msgid " - Is it possible to show all the results together in the global search?"
msgstr " - È Possibile mostrare tutti i risultati uniti nella ricerca globale?"
msgid " - Is it possible to show all the results together in the global search?"
msgstr " - È Possibile mostrare tutti i risultati uniti nella ricerca globale?"
msgctxt "#60452"
msgid " - Links take too long to appear."
msgstr " - I link ci mettono troppo ad apparire."
msgid " - Links take too long to appear."
msgstr " - I link ci mettono troppo ad apparire."
msgctxt "#60453"
msgid " - The content search is not performed correctly."
msgstr " - La ricerca dei contenuti non viene eseguita correttamente."
msgid " - The content search is not performed correctly."
msgstr " - La ricerca dei contenuti non viene eseguita correttamente."
msgctxt "#60454"
msgid " - Some channels do not function properly."
msgstr " - Alcuni canali non funzionano correttamente."
msgid " - Some channels do not function properly."
msgstr " - Alcuni canali non funzionano correttamente."
msgctxt "#60455"
msgid " - The library does not update correctly."
msgstr " - La libreria non viene aggiornata correttamente."
msgid " - The library does not update correctly."
msgstr " - La libreria non viene aggiornata correttamente."
msgctxt "#60456"
msgid " - Links of interest"
msgstr " - Collegamenti di interesse"
msgid " - Links of interest"
msgstr " - Collegamenti di interesse"
msgctxt "#60457"
msgid "Kodi on Demand"
@@ -2264,24 +2264,24 @@ msgid "Included channels by category"
msgstr "Canali inclusi per categoria"
msgctxt "#60526"
msgid " - Movies "
msgstr " - Film "
msgid " - Movies "
msgstr " - Film "
msgctxt "#60527"
msgid " - Kids"
msgstr " - Bambini"
msgid " - Kids"
msgstr " - Bambini"
msgctxt "#60528"
msgid " - TV show episodes"
msgstr " - Episodi serie TV"
msgid " - TV show episodes"
msgstr " - Episodi serie TV"
msgctxt "#60529"
msgid " - Anime episodes"
msgstr " - Episodi anime"
msgid " - Anime episodes"
msgstr " - Episodi anime"
msgctxt "#60530"
msgid " - Documentaries"
msgstr " - Documentari"
msgid " - Documentaries"
msgstr " - Documentari"
msgctxt "#60531"
msgid "Other settings"
@@ -2368,8 +2368,8 @@ msgid "Debriders settings"
msgstr "Impostazioni debrider"
msgctxt "#60553"
msgid " Server configuration '%s'"
msgstr " Configurazione del server '%s'"
msgid " Server configuration '%s'"
msgstr " Configurazione del server '%s'"
msgctxt "#60554"
msgid "Server settings"
@@ -2408,8 +2408,8 @@ msgid "Channel Options"
msgstr "Opzioni dei canali"
msgctxt "#60565"
msgid " Check the files * _data.json"
msgstr " Controlla i file * _data.json"
msgid " Check the files * _data.json"
msgstr " Controlla i file * _data.json"
msgctxt "#60566"
msgid "Video library options"
@@ -2444,8 +2444,8 @@ msgid "Order Servers"
msgstr "Ordina i server"
msgctxt "#60578"
msgid " Server #%s"
msgstr " Server #%s"
msgid " Server #%s"
msgstr " Server #%s"
msgctxt "#60579"
msgid "Error"
@@ -2520,8 +2520,8 @@ msgid "Channels"
msgstr "Canali"
msgctxt "#60597"
msgid " Server #%s"
msgstr " Server #%s"
msgid " Server #%s"
msgstr " Server #%s"
msgctxt "#60598"
msgid "Video library configuration"
@@ -2556,8 +2556,8 @@ msgid "When Kodi starts and daily"
msgstr "All'avvio di Kodi e giornaliero"
msgctxt "#60606"
msgid " Update waiting time"
msgstr " Tempo di attesa aggiornamento"
msgid " Update waiting time"
msgstr " Tempo di attesa aggiornamento"
msgctxt "#60607"
msgid "When Kodi starts"
@@ -2580,12 +2580,12 @@ msgid "60 sec"
msgstr "60 sec"
msgctxt "#60613"
msgid " Update time"
msgstr " Ora aggiornamento"
msgid "Update time"
msgstr "Ora aggiornamento"
msgctxt "#60614"
msgid " Search for new episodes"
msgstr " Cerca nuovi episodi"
msgid "Search for new episodes"
msgstr "Cerca nuovi episodi"
msgctxt "#60615"
msgid "Never"
@@ -2600,8 +2600,8 @@ msgid "Based on airing"
msgstr "In base all'uscita"
msgctxt "#60618"
msgid " Kodi video library update"
msgstr " Aggiornamento libreria di Kodi"
msgid "Kodi video library update"
msgstr "Aggiornamento libreria di Kodi"
msgctxt "#60619"
msgid "Each TV show"
@@ -2624,68 +2624,68 @@ msgid "Pop-up window"
msgstr "Finestra pop-up"
msgctxt "#60624"
msgid " Maximum number of links to display"
msgstr " Numero massimo di link da visualizzare"
msgid "Maximum number of links to display"
msgstr "Numero massimo di link da visualizzare"
msgctxt "#60625"
msgid "All"
msgstr "Tutti"
msgctxt "#60626"
msgid " Sort by whitelist"
msgstr " Ordina per whitelist"
msgid "Sort by whitelist"
msgstr "Ordina per whitelist"
msgctxt "#60627"
msgid " Remove the channel name at the beginning"
msgstr " Rimuovi il nome del canale all'inizio"
msgid "Remove the channel name at the beginning"
msgstr "Rimuovi il nome del canale all'inizio"
msgctxt "#60628"
msgid " Replace \'View in\' with \'[V]\' and \'Download in\' with \'[D]\'"
msgstr " Sostituisci \'Vedi in\' con \'[V]\' e \'Scarica in\' con \'[D]\'"
msgid "Replace \'View in\' with \'[V]\' and \'Download in\' with \'[D]\'"
msgstr "Sostituisci \'Vedi in\' con \'[V]\' e \'Scarica in\' con \'[D]\'"
msgctxt "#60629"
msgid "Remote database"
msgstr "Database remoto"
msgctxt "#60632"
msgid " Server name"
msgstr " Nome server"
msgid "Server name"
msgstr "Nome server"
msgctxt "#60633"
msgid " Server port"
msgstr " Porta server"
msgid "Server port"
msgstr "Porta server"
msgctxt "#60634"
msgid "Automatically mark as watched"
msgstr "Segna automaticamente come visto"
msgctxt "#60635"
msgid " Video viewing time"
msgstr " Tempo di visione del video"
msgid "Video viewing time"
msgstr "Tempo di visione del video"
msgctxt "#60636"
msgid "0 seg"
msgstr "0 sec"
msgctxt "#60637"
msgid " Synchronizing with Trakt"
msgstr " Sincronizzazione con Trakt"
msgid "Synchronizing with Trakt"
msgstr "Sincronizzazione con Trakt"
msgctxt "#60638"
msgid " After mark as watched the episode"
msgstr " Dopo aver segnato come visto l'episodio"
msgid "After mark as watched the episode"
msgstr "Dopo aver segnato come visto l'episodio"
msgctxt "#60639"
msgid " Show notification"
msgstr " Mostra notifica"
msgid "Show notification"
msgstr "Mostra notifica"
msgctxt "#60640"
msgid " On adding a TV show to the video library"
msgstr " All'aggiunta di una serie TV alla videoteca"
msgid "On adding a TV show to the video library"
msgstr "All'aggiunta di una serie TV alla videoteca"
msgctxt "#60641"
msgid " Wait until the TV show is added"
msgstr " Attendere finchè la serie TV sia aggiunta"
msgid "Wait until the TV show is added"
msgstr "Attendere finchè la serie TV sia aggiunta"
msgctxt "#60642"
msgid "Show option \'All Seasons\'"
@@ -2712,20 +2712,20 @@ msgid "Never"
msgstr "Mai"
msgctxt "#60650"
msgid " Video library information providers"
msgstr " Provider informazioni videoteca"
msgid "Video library information providers"
msgstr "Provider informazioni videoteca"
msgctxt "#60651"
msgid " Movies"
msgstr " Film"
msgid "Movies"
msgstr "Film"
msgctxt "#60652"
msgid " TV show"
msgstr " Serie TV"
msgid "TV show"
msgstr "Serie TV"
msgctxt "#60653"
msgid " If there are no results search in English"
msgstr " Se non ci sono risultati cerca in inglese"
msgid "If there are no results search in English"
msgstr "Se non ci sono risultati cerca in inglese"
msgctxt "#60654"
msgid "Include in blacklist"
@@ -2760,8 +2760,8 @@ msgid "News"
msgstr "Novità"
msgctxt "#60662"
msgid " Language"
msgstr " Lingua"
msgid "Language"
msgstr "Lingua"
msgctxt "#60663"
msgid "Add the progress window"
@@ -3108,7 +3108,7 @@ msgid ">> Next Page"
msgstr ">> Pagina successiva"
msgctxt "#70066"
msgid " Search title in spanish: %s"
msgid "Search title in spanish: %s"
msgstr "Cerca il suo titolo in italiano: %s"
msgctxt "#70067"
@@ -3200,11 +3200,11 @@ msgid "Show only links of %s"
msgstr "Mostra solo link di %s"
msgctxt "#70090"
msgid " Exclude all streams with specific words"
msgid "Exclude all streams with specific words"
msgstr "Escludi streams con specifiche parole"
msgctxt "#70091"
msgid " Words"
msgid "Words"
msgstr "Parole"
msgctxt "#70092"
@@ -3520,8 +3520,8 @@ msgid "Torrent"
msgstr "Torrent"
msgctxt "#70172"
msgid " Plan B (If favourites fail try other links)"
msgstr " Piano B (Se i preferiti non vanno prova altri link)"
msgid "Plan B (If favourites fail try other links)"
msgstr "Piano B (Se i preferiti non vanno prova altri link)"
msgctxt "#70173"
msgid "No working links"
@@ -3660,8 +3660,8 @@ msgid "Link found in %s"
msgstr "%s"
msgctxt "#70207"
msgid " - Movies 4K "
msgstr " - Film 4K "
msgid " - Movies 4K "
msgstr " - Film 4K "
msgctxt "#70208"
msgid "Movies 4K"
@@ -3680,16 +3680,16 @@ msgid " (In %s)"
msgstr " (En %s)"
msgctxt "#70212"
msgid " - Castellan"
msgstr " - Castigliano"
msgid " - Castellan"
msgstr " - Castigliano"
msgctxt "#70213"
msgid " - Latin"
msgstr " - Latino"
msgid " - Latin"
msgstr " - Latino"
msgctxt "#70214"
msgid " - Torrent"
msgstr " - Torrent"
msgid " - Torrent"
msgstr " - Torrent"
msgctxt "#70215"
msgid "TEST THIS CHANNEL"
@@ -3764,20 +3764,20 @@ msgid "View downloaded files"
msgstr "Visualizza file scaricati"
msgctxt "#70233"
msgid " - Size per block"
msgstr " - Dimensione per blocco"
msgid " - Size per block"
msgstr " - Dimensione per blocco"
msgctxt "#70234"
msgid " - Size by part"
msgstr " - Dimensione per parte"
msgid " - Size by part"
msgstr " - Dimensione per parte"
msgctxt "#70235"
msgid " - Maximum number of simultaneous connections"
msgstr " - Numero massimo di connnessioni simultanee"
msgid " - Maximum number of simultaneous connections"
msgstr " - Numero massimo di connnessioni simultanee"
msgctxt "#70236"
msgid " - Maximum number of parts in memory"
msgstr " - Numero massimo di parti in memoria"
msgid " - Maximum number of parts in memory"
msgstr " - Numero massimo di parti in memoria"
msgctxt "#70237"
msgid "Choice of the server"
@@ -3785,7 +3785,7 @@ msgstr "Scelta del server"
msgctxt "#70238"
msgid "- Order of servers"
msgstr " - Ordine dei servers"
msgstr " - Ordine dei servers"
msgctxt "#70240"
msgid "Preferred quality"
@@ -3944,8 +3944,8 @@ msgid "You can try downloading the 'libtorrent' module from Kodi or installing s
msgstr "Puoi provare a scaricare il modulo 'libtorrent' da Kodi o installare alcuni addon come 'Quasar' o 'Torrenter', che appariranno tra le opzioni nel pop-up .Quando appare quando fai clic su un collegamento torrent. 'Torrenter' È più complesso ma anche più completo e funziona sempre."
msgctxt "#70280"
msgid " - Torrent Links don't work."
msgstr " - I Link Torrent non funzionano."
msgid " - Torrent Links don't work."
msgstr " - I Link Torrent non funzionano."
msgctxt "#70281"
msgid "Do you want to show these links?"
@@ -4256,8 +4256,8 @@ msgid "Recommendations MyAnimeList"
msgstr "Raccomandazioni MyAnimeList"
msgctxt "#70360"
msgid " [Without subs in castellan]"
msgstr " [Senza subs in castigliano]"
msgid " [Without subs in castellan]"
msgstr " [Senza subs in castigliano]"
msgctxt "#70361"
msgid ">> More Episodes"
@@ -4324,8 +4324,8 @@ msgid "Info in AniDB %s"
msgstr "Info in AniDB %s"
msgctxt "#70377"
msgid " - Fansubs in spanish:"
msgstr " - Fansubs in spagnolo:"
msgid " - Fansubs in spanish:"
msgstr " - Fansubs in spagnolo:"
msgctxt "#70378"
msgid "Complete"
+3 -3
View File
@@ -24,7 +24,7 @@
<setting id="servers_favorites" visible="true" type="action" label="60551" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAic2VydmVyc19mYXZvcml0ZXMiLA0KICAgICJjaGFubmVsIjogInNldHRpbmciDQp9==)"/>
<setting id="servers_blacklist" visible="true" type="action" label="60550" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAic2VydmVyc19ibGFja2xpc3QiLA0KICAgICJjaGFubmVsIjogInNldHRpbmciDQp9==)"/>
<setting id="window_type" type="select" label="60621" lvalues="60623|60622" default="0"/>
<!-- <setting id="window_type" type="select" label="60621" lvalues="60623|60622" default="0"/> -->
<!-- <setting id="hide_servers" type="bool" label="70747" default="false" visible="eq(-1,true)" subsetting="true"/> -->
<setting id="checklinks" type="bool" label="30020" default="false"/>
<setting id="checklinks_number" type="slider" option="int" range="5,5,20" label="30021" default="5" visible="eq(-1,true)" subsetting="true"/>
@@ -163,8 +163,8 @@
<!-- <setting id="extended_info" type="bool" label="70152" default="false"/> -->
<!-- Shortcut -->
<setting label="30998" type="lsep"/>
<setting id="shortcut_key" type="action" label="30999" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAia2V5bWFwIg0KfQ==)"/>
<setting id="delete_key" type="action" label="31000" action="RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJkZWxldGVfa2V5Igp9==)"/>
<setting id="shortcut_key" type="action" label="30999" action="RunPlugin(plugin://plugin.video.kod/?channel=shortcuts&action=shortcut_menu&add=true)"/>
<setting id="delete_key" type="action" label="31000" action="RunPlugin(plugin://plugin.video.kod/?channel=shortcuts&action=shortcut_menu&delete=true)"/>
<!-- Others -->
<setting label="70149" type="lsep"/>
<setting id="icon_set" type="select" label="70108" values="default|light|dark|mike" default="default"/>
+380
View File
@@ -0,0 +1,380 @@
<?xml version='1.0' encoding='utf-8' standalone='yes'?>
<window>
<zorder>0.52</zorder>
<coordinates>
<left>0</left>
<top>0</top>
</coordinates>
<controls>
<control type='group'>
<top>0</top>
<left>0</left>
<width>100%</width>
<height>100%</height>
<control type='image'>
<description>Window Background</description>
<width>100%</width>
<height>100%</height>
<texture colordiffuse='FF232323'>white.png</texture>
</control>
<control type='group'>
<top>40</top>
<left>40</left>
<control type='image'>
<description>Divider</description>
<top>10</top>
<left>0</left>
<height>40</height>
<width>40</width>
<texture colordiffuse='FFFFFFFF'>gear.png</texture>
</control>
<control type='label' id='1'>
<description>Title</description>
<top>0</top>
<left>50</left>
<height>60</height>
<width>1070</width>
<font>font13</font>
<textcolor>FFFFFFFF</textcolor>
<label>[B]$ADDON[plugin.video.kod 70320][/B]</label>
<aligny>center</aligny>
<align>left</align>
<label/>
</control>
</control>
<control type='list' id='100'>
<left>40</left>
<top>140</top>
<height>540</height>
<width>1100</width>
<pagecontrol>101</pagecontrol>
<itemlayout height='60' width='1100'>
<control type='group'>
<description>Enabled</description>
<visible>String.IsEqual(ListItem.Property(enabled), True)</visible>
<left>20</left>
<height>100%</height>
<width>1060</width>
<control type='Label'>
<description>Label</description>
<width min='30' max='500'>auto</width>
<height>100%</height>
<align>left</align>
<aligny>center</aligny>
<font>font13</font>
<textcolor>FFFFFFFF</textcolor>
<label>$INFO[ListItem.Label]</label>
</control>
<control type='image'>
<description>Bool Selector</description>
<visible>String.IsEqual(ListItem.Property(type), label)</visible>
<top>30</top>
<right>0</right>
<width>540</width>
<height>2</height>
<texture colordiffuse='FFFFFFFF'>white.png</texture>
</control>
<control type='Label'>
<description>Selection</description>
<visible>!ListItem.Property(insert) + !ListItem.Property(bool) + !String.IsEqual(ListItem.Label2, None)</visible>
<width min='30' max='500'>auto</width>
<right>0</right>
<height>100%</height>
<align>right</align>
<aligny>center</aligny>
<font>font13</font>
<textcolor>FFFFFFFF</textcolor>
<label>$INFO[ListItem.Label2]</label>
</control>
<control type='image'>
<description>Bool Selector</description>
<visible>ListItem.Property(bool)</visible>
<top>15</top>
<right>0</right>
<width>30</width>
<height>30</height>
<texture colordiffuse='FFFFFFFF'>$INFO[ListItem.Property(bool)]</texture>
</control>
<control type='image'>
<description>Add Button</description>
<visible>ListItem.Property(insert) + String.IsEmpty(ListItem.Label)</visible>
<top>5</top>
<right>0</right>
<width>100%</width>
<height>50</height>
<texture colordiffuse='FFFFFFFF'>add.png</texture>
<aspectratio>keep</aspectratio>
</control>
</control>
<control type='group'>
<description>Disabled</description>
<visible>String.IsEqual(ListItem.Property(enabled), False)</visible>
<left>20</left>
<height>100%</height>
<width>1060</width>
<control type='Label'>
<description>Label</description>
<width min='30' max='500'>auto</width>
<height>100%</height>
<align>left</align>
<aligny>center</aligny>
<font>font13</font>
<textcolor>55FFFFFF</textcolor>
<label>$INFO[ListItem.Label]</label>
</control>
<control type='Label'>
<description>Selection</description>
<visible>!ListItem.Property(insert) + !ListItem.Property(bool) + !String.IsEqual(ListItem.Label2, None)</visible>
<width min='30' max='500'>auto</width>
<right>0</right>
<height>100%</height>
<align>right</align>
<aligny>center</aligny>
<font>font13</font>
<textcolor>55FFFFFF</textcolor>
<label>$INFO[ListItem.Label2]</label>
</control>
<control type='image'>
<description>Bool Selector</description>
<visible>!String.IsEmpty(ListItem.Property(bool))</visible>
<top>15</top>
<right>0</right>
<width>30</width>
<height>30</height>
<texture colordiffuse='55FFFFFF'>$INFO[ListItem.Property(bool)]</texture>
<aspectratio>keep</aspectratio>
</control>
<control type='image'>
<description>Add Button</description>
<visible>!String.IsEmpty(ListItem.Property(insert)) + String.IsEmpty(ListItem.Label)</visible>
<top>5</top>
<right>0</right>
<width>100%</width>
<height>50</height>
<texture colordiffuse='55FFFFFF'>add.png</texture>
<aspectratio>keep</aspectratio>
</control>
</control>
</itemlayout>
<focusedlayout height='60' width='1100'>
<control type='image'>
<description>Bool Selector</description>
<width>100%</width>
<height>100%</height>
<texture colordiffuse='AAFFFFFF'>white.png</texture>
</control>
<control type='group'>
<visible>String.IsEqual(ListItem.Property(enabled), True)</visible>
<left>20</left>
<height>100%</height>
<width>1060</width>
<control type='Label'>
<description>Label</description>
<width min='30' max='500'>auto</width>
<height>100%</height>
<align>left</align>
<aligny>center</aligny>
<font>font13</font>
<textcolor>FF232323</textcolor>
<label>$INFO[ListItem.Label]</label>
</control>
<control type='Label'>
<description>Selection</description>
<visible>!ListItem.Property(insert) + !ListItem.Property(bool) + !String.IsEqual(ListItem.Label2, None)</visible>
<width min='30' max='500'>auto</width>
<right>0</right>
<height>100%</height>
<align>right</align>
<aligny>center</aligny>
<font>font13</font>
<textcolor>FF232323</textcolor>
<label>$INFO[ListItem.Label2]</label>
</control>
<control type='image'>
<description>Bool Selector</description>
<visible>!String.IsEmpty(ListItem.Property(bool))</visible>
<top>15</top>
<right>0</right>
<width>30</width>
<height>30</height>
<texture colordiffuse='FF232323'>$INFO[ListItem.Property(bool)]</texture>
<aspectratio>keep</aspectratio>
</control>
<control type='image'>
<description>Add Button</description>
<visible>!String.IsEmpty(ListItem.Property(insert)) + String.IsEmpty(ListItem.Label)</visible>
<top>5</top>
<right>0</right>
<width>100%</width>
<height>50</height>
<texture colordiffuse='FF232323'>add.png</texture>
<aspectratio>keep</aspectratio>
</control>
</control>
<control type='group'>
<visible>String.IsEqual(ListItem.Property(enabled), False)</visible>
<left>20</left>
<height>100%</height>
<width>1060</width>
<control type='Label'>
<description>Label</description>
<width min='30' max='500'>auto</width>
<height>100%</height>
<align>left</align>
<aligny>center</aligny>
<font>font13</font>
<textcolor>55232323</textcolor>
<label>$INFO[ListItem.Label]</label>
</control>
<control type='Label'>
<description>Selection</description>
<visible>!ListItem.Property(insert) + !ListItem.Property(bool) + !String.IsEqual(ListItem.Label2, None)</visible>
<width min='30' max='500'>auto</width>
<right>0</right>
<height>100%</height>
<align>right</align>
<aligny>center</aligny>
<font>font13</font>
<textcolor>55232323</textcolor>
<label>$INFO[ListItem.Label2]</label>
</control>
<control type='image'>
<description>Bool Selector</description>
<visible>!String.IsEmpty(ListItem.Property(bool))</visible>
<top>15</top>
<right>0</right>
<width>30</width>
<height>30</height>
<texture colordiffuse='55232323'>$INFO[ListItem.Property(bool)]</texture>
<aspectratio>keep</aspectratio>
</control>
<control type='image'>
<description>Add Button</description>
<visible>!String.IsEmpty(ListItem.Property(insert)) + String.IsEmpty(ListItem.Label)</visible>
<top>5</top>
<right>0</right>
<width>100%</width>
<height>50</height>
<texture colordiffuse='55232323'>add.png</texture>
<aspectratio>keep</aspectratio>
</control>
</control>
</focusedlayout>
</control>
<control type='scrollbar' id='101'>
<animation effect='zoom' center='1161,0' end='800,100' time='50' condition='Control.HasFocus(101)'>Conditional</animation>
<description>Scrollbar</description>
<left>1160</left>
<top>140</top>
<width>1</width>
<height>540</height>
<visible>true</visible>
<texturesliderbackground colordiffuse='22FFFFFF'>white.png</texturesliderbackground>
<texturesliderbar colordiffuse='55FFFFFF'>white.png</texturesliderbar>
<texturesliderbarfocus colordiffuse='FFFFFFFF'>white.png</texturesliderbarfocus>
<textureslidernib />
<textureslidernibfocus/>
<pulseonselect></pulseonselect>
<orientation>vertical</orientation>
<onleft>100</onleft>
<onright>200</onright>
</control>
</control>
<control type='list' id='200'>
<description>Buttons</description>
<top>140</top>
<right>40</right>
<width>40</width>
<height>540</height>
<itemlayout height='50' width='40'>
<control type='image'>
<height>40</height>
<width>40</width>
<aspectratio>scale</aspectratio>
<texture colordiffuse='FF555555'>$INFO[ListItem.Art(button)]</texture>
</control>
</itemlayout>
<focusedlayout height='50' width='40'>
<control type='image'>
<visible>!Control.HasFocus(200)</visible>
<height>40</height>
<width>40</width>
<aspectratio>scale</aspectratio>
<texture colordiffuse='FF555555'>$INFO[ListItem.Art(button)]</texture>
</control>
<control type='image'>
<visible>Control.HasFocus(200)</visible>
<height>40</height>
<width>40</width>
<aspectratio>scale</aspectratio>
<texture colordiffuse='FFFFFFFF'>$INFO[ListItem.Art(button)]</texture>
</control>
</focusedlayout>
</control>
<control type='group'>
<description>Insert Controls</description>
<orientation>horizontal</orientation>
<top>90</top>
<right>480</right>
<height>40</height>
<width>120</width>
<visible>!String.IsEmpty(Container(100).ListItem.Property(insert)) + !String.IsEmpty(Container(100).ListItem.Label)</visible>
<animation effect='slide' end='0,60' condition='Integer.IsGreater(Container(100).Position,0)'>Conditional</animation>
<animation effect='slide' end='0,60' condition='Integer.IsGreater(Container(100).Position,1)'>Conditional</animation>
<animation effect='slide' end='0,60' condition='Integer.IsGreater(Container(100).Position,2)'>Conditional</animation>
<animation effect='slide' end='0,60' condition='Integer.IsGreater(Container(100).Position,3)'>Conditional</animation>
<animation effect='slide' end='0,60' condition='Integer.IsGreater(Container(100).Position,4)'>Conditional</animation>
<animation effect='slide' end='0,60' condition='Integer.IsGreater(Container(100).Position,5)'>Conditional</animation>
<animation effect='slide' end='0,60' condition='Integer.IsGreater(Container(100).Position,6)'>Conditional</animation>
<animation effect='slide' end='0,60' condition='Integer.IsGreater(Container(100).Position,7)'>Conditional</animation>
<animation effect='slide' end='0,60' condition='Integer.IsGreater(Container(100).Position,8)'>Conditional</animation>
<control type='button' id='300'>
<description>Move Up</description>
<top>0</top>
<left>0</left>
<height>40</height>
<width>40</width>
<onleft>100</onleft>
<onright>301</onright>
<onup>Control.Move(100,-1)</onup>
<ondown>Control.Move(100,1)</ondown>
<texturefocus colordiffuse='FF232323'>up.png</texturefocus>
<texturenofocus colordiffuse='80232323'>up.png</texturenofocus>
</control>
<control type='button' id='301'>
<description>Move Down</description>
<top>0</top>
<left>40</left>
<height>40</height>
<width>40</width>
<onleft>300</onleft>
<onright>302</onright>
<onup>Control.Move(100,-1)</onup>
<ondown>Control.Move(100,1)</ondown>
<texturefocus colordiffuse='FF232323'>down.png</texturefocus>
<texturenofocus colordiffuse='80232323'>down.png</texturenofocus>
</control>
<control type='button' id='302'>
<description>Remove</description>
<top>0</top>
<left>80</left>
<height>40</height>
<width>40</width>
<onleft>301</onleft>
<onright>200</onright>
<onup>Control.Move(100,-1)</onup>
<ondown>Control.Move(100,1)</ondown>
<texturefocus colordiffuse='FF232323'>delete.png</texturefocus>
<texturenofocus colordiffuse='80232323'>delete.png</texturenofocus>
</control>
</control>
</controls>
</window>
+1 -1
View File
@@ -698,7 +698,7 @@
<top>30</top>
<right>30</right>
<height>40</height>
<width>120</width>
<width>130</width>
<orientation>horizontal</orientation>
<control type="button" id="200">
<description>search</description>
+47 -11
View File
@@ -62,6 +62,7 @@
<left>520</left>
<width>700</width>
<height>570</height>
<onup>101</onup>
<onleft>101</onleft>
<onright>101</onright>
<animation type="WindowOpen" reversible="false">
@@ -165,19 +166,54 @@
</focusedlayout>
</control>
<!-- END Servers List -->
<control type="button" id="101">
<description>Close</description>
<control type="group">
<top>30</top>
<right>30</right>
<height>40</height>
<width>40</width>
<onup>100</onup>
<ondown>100</ondown>
<onleft>100</onleft>
<onright>100</onright>
<texturefocus colordiffuse="FFFFFFFF">close.png</texturefocus>
<texturenofocus colordiffuse="80FFFFFF">close.png</texturenofocus>
<onclick>Action(close)</onclick>
<control type="button" id="101">
<description>Close</description>
<top>0</top>
<right>0</right>
<height>40</height>
<width>40</width>
<onup>100</onup>
<ondown>100</ondown>
<onleft condition="Control.IsVisible(102)">102</onleft>
<onleft condition="Control.IsVisible(103)">103</onleft>
<onleft>100</onleft>
<onright>100</onright>
<texturefocus colordiffuse="FFFFFFFF">close.png</texturefocus>
<texturenofocus colordiffuse="80FFFFFF">close.png</texturenofocus>
<onclick>Action(close)</onclick>
</control>
<control type="button" id="102">
<description>videolibrary</description>
<top>0</top>
<right>40</right>
<height>40</height>
<width>40</width>
<onup>100</onup>
<ondown>100</ondown>
<onleft condition="Control.IsVisible(103)">103</onleft>
<onleft condition="Control.IsVisible(103)">100</onleft>
<onright>101</onright>
<texturefocus colordiffuse="FFFFFFFF">add.png</texturefocus>
<texturenofocus colordiffuse="80FFFFFF">add.png</texturenofocus>
</control>
<control type="button" id="103">
<description>Download</description>
<top>0</top>
<right>40</right>
<animation effect="slide" end="-40,0" condition="Control.IsVisible(102)">Conditional</animation>
<height>40</height>
<width>40</width>
<onup>100</onup>
<ondown>100</ondown>
<onleft>100</onleft>
<onright condition="Control.IsVisible(102)">102</onright>
<onright>101</onright>
<texturefocus colordiffuse="FFFFFFFF">down.png</texturefocus>
<texturenofocus colordiffuse="80FFFFFF">down.png</texturenofocus>
</control>
</control>
</control>
<!-- END SERVERS GROUP -->
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

+9 -9
View File
@@ -24,7 +24,7 @@ def test_video_exists(page_url):
if code:
page = httptools.downloadpage('http://akvideo.stream/video/' + code, headers=headers)
else:
return False, config.get_localized_string(70449) % "Akvideo"
return False, config.getLocalizedString(70449) % "Akvideo"
if 'video.php?file_code=' in page.url:
page = httptools.downloadpage(page.url.replace('video.php?file_code=', 'video/'), headers=headers)
@@ -34,23 +34,23 @@ def test_video_exists(page_url):
# post = urllib.urlencode({ID: code})
# logger.debug('PAGE DATA' + data)
if "File Not Found" in data:
return False, config.get_localized_string(70449) % "Akvideo"
return False, config.getLocalizedString(70449) % "Akvideo"
return True, ""
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
def get_videoUrl(page_url, premium=False, user="", password="", video_password=""):
logger.debug(" url=" + page_url)
video_urls = []
videoUrls = []
global data
# logger.debug('PAGE DATA' + data)
# sitekey = scrapertools.find_single_match(data, 'data-sitekey="([^"]+)')
# captcha = platformtools.show_recaptcha(sitekey, page_url) if sitekey else ''
# captcha = platformtools.showRecaptcha(sitekey, page_url) if sitekey else ''
#
# if captcha:
# data = httptools.downloadpage(page_url, post={'g-recaptcha-response': captcha}).data
vres = scrapertools.find_multiple_matches(data, 'nowrap[^>]+>([^,]+)')
if not vres: vres = scrapertools.find_multiple_matches(data, '<td>(\d+x\d+)')
vres = scrapertools.findMultipleMatches(data, 'nowrap[^>]+>([^,]+)')
if not vres: vres = scrapertools.findMultipleMatches(data, '<td>(\d+x\d+)')
data_pack = scrapertools.find_single_match(data, "</div>\n\s*<script[^>]+>(eval.function.p,a,c,k,e,.*?)\s*</script>")
if data_pack != "":
@@ -58,7 +58,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
data = jsunpack.unpack(data_pack)
_headers = urllib.urlencode(httptools.default_headers)
video_urls = support.get_jwplayer_mediaurl(data, 'akvideo', onlyHttp=True)
videoUrls = support.get_jwplayer_mediaUrl(data, 'akvideo', onlyHttp=True)
return video_urls
return videoUrls
+4 -4
View File
@@ -10,12 +10,12 @@ def test_video_exists(page_url):
global data
data = httptools.downloadpage(page_url, cookies=False).data
if 'File you are looking for is not found.' in data:
return False, config.get_localized_string(70449) % "AvaVids"
return False, config.getLocalizedString(70449) % "AvaVids"
return True, ""
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
def get_videoUrl(page_url, premium=False, user="", password="", video_password=""):
global data
video_urls = support.get_jwplayer_mediaurl(data, 'AvaVids')
return video_urls
videoUrls = support.get_jwplayer_mediaUrl(data, 'AvaVids')
return videoUrls
+5 -5
View File
@@ -9,18 +9,18 @@ def test_video_exists(page_url):
logger.debug("(page_url='%s')" % page_url)
data = httptools.downloadpage(page_url).data
if "no longer exists" in data or "to copyright issues" in data:
return False, config.get_localized_string(70449) % "animeid"
return False, config.getLocalizedString(70449) % "animeid"
if "please+try+again+later." in data:
return False, "[animeid] Error de animeid, no se puede generar el enlace al video"
return True, ""
def get_video_url(page_url, user="", password="", video_password=""):
def get_videoUrl(page_url, user="", password="", video_password=""):
logger.debug("(page_url='%s')" % page_url)
data = httptools.downloadpage(page_url).data
video_urls = []
videoUrls = []
label, videourl = scrapertools.find_single_match(data, 'label":"([^"]+)".*?file":"([^"]+)')
if "animeid.tv" in videourl:
videourl = httptools.downloadpage(videourl, follow_redirects=False, only_headers=True).headers.get("location", "")
video_urls.append({'type':'mp4', 'res':label, 'url':videourl})
return video_urls
videoUrls.append({'type':'mp4', 'res':label, 'url':videourl})
return videoUrls
+6 -6
View File
@@ -12,17 +12,17 @@ def test_video_exists(page_url):
logger.debug("(page_url='%s')" % page_url)
response = httptools.downloadpage(page_url)
if not response.success or "Not Found" in response.data or "File was deleted" in response.data or "is no longer available" in response.data:
return False, config.get_localized_string(70449) % "anonfile"
return False, config.getLocalizedString(70449) % "anonfile"
return True, ""
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
def get_videoUrl(page_url, premium=False, user="", password="", video_password=""):
logger.debug("(page_url='%s')" % page_url)
video_urls = []
videoUrls = []
data = httptools.downloadpage(page_url).data
patron = 'download-url.*?href="([^"]+)"'
match = scrapertools.find_multiple_matches(data, patron)
match = scrapertools.findMultipleMatches(data, patron)
for media_url in match:
media_url += "|Referer=%s" %page_url
video_urls.append({'type':'mp4', 'url':media_url})
return video_urls
videoUrls.append({'type':'mp4', 'url':media_url})
return videoUrls
+6 -6
View File
@@ -12,16 +12,16 @@ def test_video_exists(page_url):
logger.debug("(page_url='%s')" % page_url)
data = httptools.downloadpage(page_url)
if data.code == 404:
return False, config.get_localized_string(70449) % "ArchiveOrg"
return False, config.getLocalizedString(70449) % "ArchiveOrg"
return True, ""
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
def get_videoUrl(page_url, premium=False, user="", password="", video_password=""):
logger.debug("url=" + page_url)
video_urls = []
videoUrls = []
data = httptools.downloadpage(page_url).data
patron = '<meta property="og:video" content="([^"]+)">'
matches = scrapertools.find_multiple_matches(data, patron)
matches = scrapertools.findMultipleMatches(data, patron)
for url in matches:
video_urls.append({'type':'mp4', 'url':url})
return video_urls
videoUrls.append({'type':'mp4', 'url':url})
return videoUrls
+7 -7
View File
@@ -18,15 +18,15 @@ def test_video_exists(page_url):
data = httptools.downloadpage(page_url).data
if 'File Not Found' in data:
return False, config.get_localized_string(70449) % "backin"
return False, config.getLocalizedString(70449) % "backin"
return True, ""
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
def get_videoUrl(page_url, premium=False, user="", password="", video_password=""):
logger.debug("page_url=" + page_url)
video_urls = []
videoUrls = []
headers = [["User-Agent", "Mozilla/5.0 (Windows NT 6.1; rv:54.0) Gecko/20100101 Firefox/54.0"]]
@@ -45,9 +45,9 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
logger.debug("URL=" + str(url))
# URL del vídeo
video_urls.append({'type':'mp4', 'url':url})
videoUrls.append({'type':'mp4', 'url':url})
# for video_url in video_urls:
# logger.debug("%s - %s" % (video_url[0], httptools.get_url_headers(video_url[1])))
# for videoUrl in videoUrls:
# logger.debug("%s - %s" % (videoUrl[0], httptools.get_url_headers(videoUrl[1])))
return video_urls
return videoUrls
+5 -5
View File
@@ -15,19 +15,19 @@ def test_video_exists(page_url):
global page
page = httptools.downloadpage(page_url)
if not page.success:
return False, config.get_localized_string(70449) % "Badshare"
return False, config.getLocalizedString(70449) % "Badshare"
return True, ""
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
def get_videoUrl(page_url, premium=False, user="", password="", video_password=""):
logger.debug("url=" + page_url)
video_urls = []
videoUrls = []
ext = '.mp4'
data = page.data
data = re.sub(r'\n|\r|\t|\s{2,}', "", data)
media_url, ext = scrapertools.find_single_match(data, r'file:\s*"([^"]+)",type:\s*"([^"]+)"')
video_urls.append({'type':ext, 'url':media_url})
videoUrls.append({'type':ext, 'url':media_url})
return video_urls
return videoUrls
+6 -6
View File
@@ -13,17 +13,17 @@ def test_video_exists(page_url):
logger.debug("(page_url='%s')" % page_url)
data = httptools.downloadpage(page_url).data
if "Archive no Encontrado" in data:
return False, config.get_localized_string(70449) % "bdupload"
return False, config.getLocalizedString(70449) % "bdupload"
return True, ""
def get_video_url(page_url, user="", password="", video_password=""):
def get_videoUrl(page_url, user="", password="", video_password=""):
logger.debug("(page_url='%s')" % page_url)
data = httptools.downloadpage(page_url).data
post = ""
patron = '(?s)type="hidden" name="([^"]+)".*?value="([^"]*)"'
match = scrapertools.find_multiple_matches(data, patron)
match = scrapertools.findMultipleMatches(data, patron)
for nombre, valor in match:
post += nombre + "=" + valor + "&"
time.sleep(1)
@@ -32,7 +32,7 @@ def get_video_url(page_url, user="", password="", video_password=""):
file = scrapertools.find_single_match(data1, patron).replace(" ","%20")
file += "|User-Agent=" + httptools.get_user_agent()
file += "&Host=fs30.indifiles.com:182"
video_urls = []
videoUrls = []
videourl = file
video_urls.append({'type':'mp4', 'url':videourl})
return video_urls
videoUrls.append({'type':'mp4', 'url':videourl})
return videoUrls
+6 -6
View File
@@ -14,18 +14,18 @@ def test_video_exists(page_url):
logger.debug("(page_url='%s')" % page_url)
data = httptools.downloadpage(page_url)
if data.code == 404:
return False, config.get_localized_string(70449) % "CinemaUpload"
return False, config.getLocalizedString(70449) % "CinemaUpload"
return True, ""
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
def get_videoUrl(page_url, premium=False, user="", password="", video_password=""):
logger.debug("url=" + page_url)
video_urls = []
videoUrls = []
data = httptools.downloadpage(page_url).data
data = re.sub(r'\n|\r|\t|&nbsp;|<br>|\s{2,}', "", data)
patron = 'file: "([^"]+)",'
matches = scrapertools.find_multiple_matches(data, patron)
matches = scrapertools.findMultipleMatches(data, patron)
for url in matches:
url += "|Referer=%s" %page_url
video_urls.append({'type':'m3u8', 'url':url})
return video_urls
videoUrls.append({'type':'m3u8', 'url':url})
return videoUrls
+8 -8
View File
@@ -25,35 +25,35 @@ def test_video_exists(page_url):
logger.debug("(page_url='%s')" % page_url)
data = get_data(page_url.replace(".org", ".me"))
if "File Not Found" in data: return False, config.get_localized_string(70449) % "Clicknupload"
if "File Not Found" in data: return False, config.getLocalizedString(70449) % "Clicknupload"
return True, ""
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
def get_videoUrl(page_url, premium=False, user="", password="", video_password=""):
logger.debug("url=" + page_url)
data = get_data(page_url.replace(".org", ".me"))
post = ""
block = scrapertools.find_single_match(data, '(?i)<Form method="POST"(.*?)</Form>')
matches = scrapertools.find_multiple_matches(block, 'input.*?name="([^"]+)".*?value="([^"]*)"')
matches = scrapertools.findMultipleMatches(block, 'input.*?name="([^"]+)".*?value="([^"]*)"')
for inputname, inputvalue in matches:
post += inputname + "=" + inputvalue + "&"
post = post.replace("download1", "download2")
data = get_data(page_url, post)
video_urls = []
videoUrls = []
media = scrapertools.find_single_match(data, "onClick=\"window.open\('([^']+)'")
# Solo es necesario codificar la ultima parte de la url
url_strip = urllib.quote(media.rsplit('/', 1)[1])
media_url = media.rsplit('/', 1)[0] + "/" + url_strip
video_urls.append({'type':scrapertools.get_filename_from_url(media_url).split('.')[-1], 'url':media_url})
# for video_url in video_urls:
# logger.debug("%s - %s" % (video_url[0], video_url[1]))
videoUrls.append({'type':scrapertools.get_filename_from_url(media_url).split('.')[-1], 'url':media_url})
# for videoUrl in videoUrls:
# logger.debug("%s - %s" % (videoUrl[0], videoUrl[1]))
return video_urls
return videoUrls
def get_data(url_orig, req_post=""):
+7 -7
View File
@@ -11,13 +11,13 @@ def test_video_exists(page_url):
global data
data = httptools.downloadpage(page_url).data
if "File Not Found" in data or "File was deleted" in data:
return False, config.get_localized_string(70292) % "ClipWatching"
return False, config.getLocalizedString(70292) % "ClipWatching"
return True, ""
def get_video_url(page_url, user="", password="", video_password=""):
def get_videoUrl(page_url, user="", password="", video_password=""):
logger.info("(page_url='%s')" % page_url)
video_urls = []
videoUrls = []
multires = False
try:
@@ -26,7 +26,7 @@ def get_video_url(page_url, user="", password="", video_password=""):
except:
unpacked = scrapertools.find_single_match(data,"window.hola_player.*")
videos = scrapertools.find_multiple_matches(unpacked if unpacked else data, r'(?:file|src|sources):\s*(?:\[)?"([^"]+).*?(?:label:\s*"([^"]+))?')
videos = scrapertools.findMultipleMatches(unpacked if unpacked else data, r'(?:file|src|sources):\s*(?:\[)?"([^"]+).*?(?:label:\s*"([^"]+))?')
for video, label in videos:
if ".jpg" not in video:
if label and not label.endswith('p'):
@@ -35,7 +35,7 @@ def get_video_url(page_url, user="", password="", video_password=""):
else:
label = video.split('.')[-1]
multires = False
video_urls.append({'type':label, 'url':video})
videoUrls.append({'type':label, 'url':video})
# if multires:
# video_urls.sort(key=lambda it: int(it[0].split("p ", 1)[0]))
return video_urls
# videoUrls.sort(key=lambda it: int(it[0].split("p ", 1)[0]))
return videoUrls
+9 -9
View File
@@ -13,29 +13,29 @@ def test_video_exists(page_url):
global data
data = html.data
if html.code == 404 or 'No Signal 404 Error Page' in data:
return False, config.get_localized_string(70449) % "CloudVideo"
return False, config.getLocalizedString(70449) % "CloudVideo"
return True, ""
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
def get_videoUrl(page_url, premium=False, user="", password="", video_password=""):
logger.debug("url=" + page_url)
video_urls = []
videoUrls = []
global data
# data = httptools.downloadpage(page_url).data
enc_data = scrapertools.find_single_match(data, r'text/javascript">(eval.+?)(?:\n|\s*</script>)')
if enc_data:
dec_data = jsunpack.unpack(enc_data)
matches = scrapertools.find_multiple_matches(dec_data, r'src:"([^"]+)"')
matches = scrapertools.findMultipleMatches(dec_data, r'src:"([^"]+)"')
else:
sources = scrapertools.find_single_match(data, r"<source(.*?)</source")
patron = r'src="([^"]+)'
matches = scrapertools.find_multiple_matches(sources, patron)
matches = scrapertools.findMultipleMatches(sources, patron)
for url in matches:
Type = 'm3u8'
video_url = url
videoUrl = url
if 'label' in url:
url = url.split(',')
video_url = url[0]
videoUrl = url[0]
Type = url[1].replace('label:','')
video_urls.append({'type':Type, 'url':video_url})
return video_urls
videoUrls.append({'type':Type, 'url':videoUrl})
return videoUrls
+11 -11
View File
@@ -42,10 +42,10 @@ def test_video_exists(page_url):
return True, ""
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
def get_videoUrl(page_url, premium=False, user="", password="", video_password=""):
#page_url='https://www.crunchyroll.com/es-es/one-piece/episode-891-climbing-up-a-waterfall-a-great-journey-through-the-land-of-wanos-sea-zone-786643'
logger.debug("url=" + page_url)
video_urls = []
videoUrls = []
if "crunchyroll.com" in page_url:
media_id = page_url.rsplit("-", 1)[1]
else:
@@ -62,7 +62,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
data = httptools.downloadpage(get, post=post, headers=GLOBAL_HEADER).data
media_url = scrapertools.find_single_match(data, '<file>(.*?)</file>').replace("&amp;", "&")
if not media_url:
return video_urls
return videoUrls
elif not media_url.startswith("http"):
rtmp = scrapertools.find_single_match(data, '<host>(.*?)</host>').replace("&amp;", "&")
media_url = rtmp + " playpath=%s" % media_url
@@ -73,7 +73,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
try:
#idiomas = ['Español \(España\)', 'Español\]', 'English', 'Italiano', 'Français', 'Português', 'Deutsch']
idiomas = ['Deutsch', 'Português', 'Français', 'Italiano', 'English', 'Español\]', 'Español \(España\)']
index_sub = int(config.get_setting("crunchyrollsub", "crunchyroll"))
index_sub = int(config.getSetting("crunchyrollsub", "crunchyroll"))
idioma_sub = idiomas[index_sub]
link_sub = scrapertools.find_single_match(data, "link='([^']+)' title='\[%s" % idioma_sub)
@@ -92,16 +92,16 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
import traceback
logger.error(traceback.format_exc())
file_sub = ""
video_urls.append({'type':filename, 'res':quality, 'url':media_url, 'sub':file_sub})
# for video_url in video_urls:
# logger.debug("%s - %s" % (video_url[0], video_url[1]))
return video_urls
videoUrls.append({'type':filename, 'res':quality, 'url':media_url, 'sub':file_sub})
# for videoUrl in videoUrls:
# logger.debug("%s - %s" % (videoUrl[0], videoUrl[1]))
return videoUrls
def login(page_url):
login_page = "https://www.crunchyroll.com/login"
user = config.get_setting("user", server="crunchyroll")
password = config.get_setting("password", server="crunchyroll")
user = config.getSetting("user", server="crunchyroll")
password = config.getSetting("password", server="crunchyroll")
data = httptools.downloadpage(login_page, headers=GLOBAL_HEADER).data
if not "<title>Redirecting" in data:
token = scrapertools.find_single_match(data, 'name="login_form\[_token\]" value="([^"]+)"')
@@ -159,7 +159,7 @@ def decrypt_subs(iv, data, id):
import xml.etree.ElementTree as ET
raiz = ET.fromstring(data)
ass_sub = convert_to_ass(raiz)
file_sub = filetools.join(config.get_data_path(), 'crunchyroll_sub.ass')
file_sub = filetools.join(config.getDataPath(), 'crunchyroll_sub.ass')
filetools.write(file_sub, ass_sub)
return file_sub

Some files were not shown because too many files have changed in this diff Show More