Fix trailer youtube, trailer nel menu contestuale
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
[
|
[
|
||||||
"platformcode.contextmenu.search",
|
"platformcode.contextmenu.search",
|
||||||
"platformcode.contextmenu.update_tv_show"
|
"platformcode.contextmenu.update_tv_show",
|
||||||
|
"platformcode.contextmenu.trailer"
|
||||||
]
|
]
|
||||||
@@ -107,7 +107,7 @@ def execute():
|
|||||||
contentType= mediatype,
|
contentType= mediatype,
|
||||||
mode="search",
|
mode="search",
|
||||||
contextual= True,
|
contextual= True,
|
||||||
text= title,
|
text=title,
|
||||||
type= mediatype,
|
type= mediatype,
|
||||||
infoLabels= {
|
infoLabels= {
|
||||||
'tmdb_id': tmdbid,
|
'tmdb_id': tmdbid,
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import xbmc
|
||||||
|
|
||||||
|
from core.item import Item
|
||||||
|
from platformcode import config
|
||||||
|
|
||||||
|
|
||||||
|
def get_menu_items():
|
||||||
|
return [(config.get_localized_string(60359), execute)]
|
||||||
|
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
tmdbid = xbmc.getInfoLabel('ListItem.Property(tmdb_id)')
|
||||||
|
year = xbmc.getInfoLabel('ListItem.Year')
|
||||||
|
mediatype = xbmc.getInfoLabel('ListItem.DBTYPE')
|
||||||
|
title = xbmc.getInfoLabel('ListItem.Title')
|
||||||
|
if mediatype in ('episode', 'season'):
|
||||||
|
mediatype = 'tvshow'
|
||||||
|
title = xbmc.getInfoLabel('ListItem.TVShowTitle')
|
||||||
|
|
||||||
|
item = Item(channel="trailertools", action="buscartrailer", search_title=title, contentType=mediatype,
|
||||||
|
year=year, contentTitle=title, contextual=True)
|
||||||
|
item.infoLabels['tmdb_id'] = tmdbid
|
||||||
|
xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?" + item.tourl() + ")")
|
||||||
@@ -9,6 +9,9 @@ from core.item import Item
|
|||||||
from lib.sambatools import libsmb as samba
|
from lib.sambatools import libsmb as samba
|
||||||
from core import scrapertools, support
|
from core import scrapertools, support
|
||||||
|
|
||||||
|
path = ''
|
||||||
|
mediatype = ''
|
||||||
|
|
||||||
|
|
||||||
def exists(path, silent=False, vfs=True):
|
def exists(path, silent=False, vfs=True):
|
||||||
path = xbmc.translatePath(path)
|
path = xbmc.translatePath(path)
|
||||||
@@ -105,26 +108,75 @@ def execute_sql(sql):
|
|||||||
return records
|
return records
|
||||||
|
|
||||||
|
|
||||||
|
def get_id():
|
||||||
|
global mediatype
|
||||||
|
|
||||||
|
mediatype = xbmc.getInfoLabel('ListItem.DBTYPE')
|
||||||
|
if mediatype == 'tvshow':
|
||||||
|
dbid = xbmc.getInfoLabel('ListItem.DBID')
|
||||||
|
elif mediatype in ('season', 'episode'):
|
||||||
|
dbid = xbmc.getInfoLabel('ListItem.TvShowDBID')
|
||||||
|
else:
|
||||||
|
dbid = ''
|
||||||
|
return dbid
|
||||||
|
|
||||||
def check_condition():
|
def check_condition():
|
||||||
# support.dbg()
|
# support.dbg()
|
||||||
dbid = xbmc.getInfoLabel('ListItem.TvShowDBID')
|
global path
|
||||||
path = search_paths(dbid)
|
path = search_paths(get_id())
|
||||||
if path:
|
return path
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def get_menu_items():
|
def get_menu_items():
|
||||||
logger.debug('get menu item')
|
logger.debug('get menu item')
|
||||||
if check_condition():
|
if check_condition():
|
||||||
return [(config.get_localized_string(70269), execute)]
|
items = [(config.get_localized_string(70269), update)]
|
||||||
|
# if config.get_setting('downloadenabled'):
|
||||||
|
# from core import videolibrarytools
|
||||||
|
# from core import filetools
|
||||||
|
# if xbmc.getInfoLabel('ListItem.FilenameAndPath'):
|
||||||
|
# item = Item().fromurl(filetools.read(xbmc.getInfoLabel('ListItem.FilenameAndPath')))
|
||||||
|
# else:
|
||||||
|
# item = videolibrarytools.read_nfo(path + 'tvshow.nfo')[1]
|
||||||
|
# if item:
|
||||||
|
# item_url = item.tourl()
|
||||||
|
#
|
||||||
|
# Download movie
|
||||||
|
# if mediatype == "movie":
|
||||||
|
# items.append((config.get_localized_string(60354), lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?%s&%s)" % (item_url,
|
||||||
|
# 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' + item.action))))
|
||||||
|
#
|
||||||
|
# elif item.contentSerieName:
|
||||||
|
# Download series
|
||||||
|
# if mediatype == "tvshow" and item.action not in ['findvideos']:
|
||||||
|
# if item.channel == 'videolibrary':
|
||||||
|
# items.append((config.get_localized_string(60003), lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?%s&%s)" % (
|
||||||
|
# item_url,
|
||||||
|
# 'channel=downloads&action=save_download&unseen=true&from_channel=' + item.channel + '&from_action=' + item.action))))
|
||||||
|
# items.append((config.get_localized_string(60355), lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?%s&%s)" % (
|
||||||
|
# item_url,
|
||||||
|
# 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' + item.action))))
|
||||||
|
# items.append((config.get_localized_string(60357), lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?%s&%s)" % (
|
||||||
|
# item_url,
|
||||||
|
# 'channel=downloads&action=save_download&download=season&from_channel=' + item.channel + '&from_action=' + item.action))))
|
||||||
|
# Download episode
|
||||||
|
# elif mediatype == "episode" and item.action in ['findvideos']:
|
||||||
|
# items.append((config.get_localized_string(60356), lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?%s&%s)" % (
|
||||||
|
# item_url,
|
||||||
|
# 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' + item.action))))
|
||||||
|
# Download season
|
||||||
|
# elif mediatype == "season":
|
||||||
|
# items.append((config.get_localized_string(60357), lambda: xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?%s&%s)" % (
|
||||||
|
# item_url,
|
||||||
|
# 'channel=downloads&action=save_download&download=season&from_channel=' + item.channel + '&from_action=' + item.action))))
|
||||||
|
|
||||||
|
return items
|
||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
def update():
|
||||||
def execute():
|
dbid = get_id()
|
||||||
dbid = xbmc.getInfoLabel('ListItem.TvShowDBID')
|
|
||||||
path = search_paths(dbid)
|
path = search_paths(dbid)
|
||||||
if path:
|
if path:
|
||||||
item = Item(action="update_tvshow", channel="videolibrary", path=path)
|
item = Item(action="update_tvshow", channel="videolibrary", path=path)
|
||||||
|
|||||||
@@ -640,7 +640,7 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
|
|||||||
context_commands.append((config.get_localized_string(60354), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' + item.action)))
|
context_commands.append((config.get_localized_string(60354), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' + item.action)))
|
||||||
|
|
||||||
elif item.contentSerieName:
|
elif item.contentSerieName:
|
||||||
# Descargar series
|
# Download series
|
||||||
if item.contentType == "tvshow" and item.action not in ['findvideos']:
|
if item.contentType == "tvshow" and item.action not in ['findvideos']:
|
||||||
if item.channel == 'videolibrary':
|
if item.channel == 'videolibrary':
|
||||||
context_commands.append((config.get_localized_string(60003), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'channel=downloads&action=save_download&unseen=true&from_channel=' + item.channel + '&from_action=' + item.action)))
|
context_commands.append((config.get_localized_string(60003), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'channel=downloads&action=save_download&unseen=true&from_channel=' + item.channel + '&from_action=' + item.action)))
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
from __future__ import division
|
from __future__ import division
|
||||||
|
|
||||||
# from builtins import str
|
# from builtins import str
|
||||||
|
import random
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from channelselector import get_thumb
|
from channelselector import get_thumb
|
||||||
@@ -199,6 +200,8 @@ def youtube_search(item):
|
|||||||
else:
|
else:
|
||||||
title = urllib.quote(title)
|
title = urllib.quote(title)
|
||||||
title = title.replace("%20", "+")
|
title = title.replace("%20", "+")
|
||||||
|
httptools.set_cookies({'domain': 'youtube.com', 'name': 'CONSENT',
|
||||||
|
'value': 'YES+cb.20210328-17-p0.en+FX+' + str(random.randint(100, 999))})
|
||||||
data = httptools.downloadpage("https://www.youtube.com/results?sp=EgIQAQ%253D%253D&search_query=" + title).data
|
data = httptools.downloadpage("https://www.youtube.com/results?sp=EgIQAQ%253D%253D&search_query=" + title).data
|
||||||
patron = r'thumbnails":\[\{"url":"(https://i.ytimg.com/vi[^"]+).*?'
|
patron = r'thumbnails":\[\{"url":"(https://i.ytimg.com/vi[^"]+).*?'
|
||||||
patron += r'text":"([^"]+).*?'
|
patron += r'text":"([^"]+).*?'
|
||||||
|
|||||||
Reference in New Issue
Block a user