Fix aggiunta alla videoteca tramite Ricerca Globale
This commit is contained in:
@@ -203,7 +203,7 @@ def save_movie(item, silent=False):
|
|||||||
if not movie_item.infoLabels['disc'] and item.infoLabels['discs']: movie_item.infoLabels['disc'] = item.infoLabels['discs'][0]
|
if not movie_item.infoLabels['disc'] and item.infoLabels['discs']: movie_item.infoLabels['disc'] = item.infoLabels['discs'][0]
|
||||||
if not movie_item.prefered_lang: movie_item.prefered_lang = ''
|
if not movie_item.prefered_lang: movie_item.prefered_lang = ''
|
||||||
if not movie_item.lang_list: movie_item.lang_list = []
|
if not movie_item.lang_list: movie_item.lang_list = []
|
||||||
# if not movie_item.info: movie_item.info = extra_info(_id)
|
movie_item.no_reload = item.no_reload
|
||||||
|
|
||||||
if not item.contentLanguage: item.contentLanguage = 'ITA'
|
if not item.contentLanguage: item.contentLanguage = 'ITA'
|
||||||
if not item.contentLanguage in movie_item.lang_list: movie_item.lang_list.append(item.contentLanguage)
|
if not item.contentLanguage in movie_item.lang_list: movie_item.lang_list.append(item.contentLanguage)
|
||||||
@@ -214,9 +214,8 @@ def save_movie(item, silent=False):
|
|||||||
movie_item.prefered_lang = movie_item.lang_list[0]
|
movie_item.prefered_lang = movie_item.lang_list[0]
|
||||||
|
|
||||||
# create nfo file if it does not exist
|
# create nfo file if it does not exist
|
||||||
# support.dbg()
|
|
||||||
if not nfo_exists:
|
if not nfo_exists:
|
||||||
# data = dicttoxml(movie_item)
|
|
||||||
filetools.write(filetools.join(MOVIES_PATH, movie_item.nfo_path), head_nfo)
|
filetools.write(filetools.join(MOVIES_PATH, movie_item.nfo_path), head_nfo)
|
||||||
|
|
||||||
# create strm file if it does not exist
|
# create strm file if it does not exist
|
||||||
@@ -267,8 +266,8 @@ def save_movie(item, silent=False):
|
|||||||
p_dialog.update(100, item.contentTitle)
|
p_dialog.update(100, item.contentTitle)
|
||||||
p_dialog.close()
|
p_dialog.close()
|
||||||
# Update Kodi Library
|
# Update Kodi Library
|
||||||
# from platformcode.dbconverter import add_video
|
from platformcode.dbconverter import add_video
|
||||||
# add_video(movie_item)
|
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.get_setting("videolibrary_kodi") and not silent and inserted:
|
||||||
# from platformcode.xbmc_videolibrary import update
|
# from platformcode.xbmc_videolibrary import update
|
||||||
# update(MOVIES_PATH)
|
# update(MOVIES_PATH)
|
||||||
@@ -399,6 +398,8 @@ def save_tvshow(item, episodelist, silent=False):
|
|||||||
if not tvshow_item.prefered_lang: tvshow_item.prefered_lang = ''
|
if not tvshow_item.prefered_lang: tvshow_item.prefered_lang = ''
|
||||||
if not tvshow_item.lang_list: tvshow_item.lang_list = []
|
if not tvshow_item.lang_list: tvshow_item.lang_list = []
|
||||||
|
|
||||||
|
tvshow_item.no_reload = item.no_reload
|
||||||
|
|
||||||
remove_host(item)
|
remove_host(item)
|
||||||
|
|
||||||
item.renumber = add_renumber_options(item)
|
item.renumber = add_renumber_options(item)
|
||||||
@@ -419,7 +420,7 @@ def save_tvshow(item, episodelist, silent=False):
|
|||||||
|
|
||||||
if not nfo_exists:
|
if not nfo_exists:
|
||||||
filetools.write(filetools.join(TVSHOWS_PATH, tvshow_item.nfo_path), head_nfo)
|
filetools.write(filetools.join(TVSHOWS_PATH, tvshow_item.nfo_path), head_nfo)
|
||||||
# support.dbg()
|
|
||||||
if not episodelist:
|
if not episodelist:
|
||||||
# The episode list is empty
|
# The episode list is empty
|
||||||
return 0, 0, -1, path
|
return 0, 0, -1, path
|
||||||
@@ -431,8 +432,7 @@ def save_tvshow(item, episodelist, silent=False):
|
|||||||
if config.is_xbmc() and config.get_setting("videolibrary_kodi") and not silent:# and inserted:
|
if config.is_xbmc() and config.get_setting("videolibrary_kodi") and not silent:# and inserted:
|
||||||
from platformcode.dbconverter import add_video
|
from platformcode.dbconverter import add_video
|
||||||
add_video(tvshow_item)
|
add_video(tvshow_item)
|
||||||
# from platformcode.xbmc_videolibrary import update
|
|
||||||
# update(TVSHOWS_PATH, tvshow_item.basename)
|
|
||||||
|
|
||||||
return inserted, overwritten, failed, path
|
return inserted, overwritten, failed, path
|
||||||
|
|
||||||
@@ -452,8 +452,6 @@ def save_episodes(item, episodelist, extra_info, host, local_files, silent=False
|
|||||||
season_episode = '{}x{:02d}'.format(e.contentSeason, e.contentEpisodeNumber)
|
season_episode = '{}x{:02d}'.format(e.contentSeason, e.contentEpisodeNumber)
|
||||||
strm_path = filetools.join(item.base_name, "{}.strm".format(season_episode))
|
strm_path = filetools.join(item.base_name, "{}.strm".format(season_episode))
|
||||||
|
|
||||||
# e.contentSeason = int(season_episode.split('x')[0])
|
|
||||||
# e.contentEpisodeNumber = int(season_episode.split('x')[1])
|
|
||||||
if item.infoLabels.get('imdb_id'): e.infoLabels['imdb_id'] = item.infoLabels['imdb_id']
|
if item.infoLabels.get('imdb_id'): e.infoLabels['imdb_id'] = item.infoLabels['imdb_id']
|
||||||
if item.infoLabels.get('tmdb_id'): e.infoLabels['tmdb_id'] = item.infoLabels['tmdb_id']
|
if item.infoLabels.get('tmdb_id'): e.infoLabels['tmdb_id'] = item.infoLabels['tmdb_id']
|
||||||
if item.infoLabels.get('tvdb_id'): e.infoLabels['tvdb_id'] = item.infoLabels['tvdb_id']
|
if item.infoLabels.get('tvdb_id'): e.infoLabels['tvdb_id'] = item.infoLabels['tvdb_id']
|
||||||
@@ -779,6 +777,7 @@ def add_tvshow(item, channel=None):
|
|||||||
# If the second screen is canceled, the variable "scraper_return" will be False. The user does not want to continue
|
# If the second screen is canceled, the variable "scraper_return" will be False. The user does not want to continue
|
||||||
|
|
||||||
item = generictools.update_title(item) # We call the method that updates the title with tmdb.find_and_set_infoLabels
|
item = generictools.update_title(item) # We call the method that updates the title with tmdb.find_and_set_infoLabels
|
||||||
|
|
||||||
if not item: return
|
if not item: return
|
||||||
#if item.tmdb_stat:
|
#if item.tmdb_stat:
|
||||||
# del item.tmdb_stat # We clean the status so that it is not recorded in the Video Library
|
# del item.tmdb_stat # We clean the status so that it is not recorded in the Video Library
|
||||||
|
|||||||
@@ -24,15 +24,15 @@ def save_all():
|
|||||||
add_video(item)
|
add_video(item)
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
_id = get_id('idShow', 'tvshow') + get_id('idMovie', 'movie')
|
reload()
|
||||||
if _id == 1:
|
|
||||||
payload = {
|
def reload():
|
||||||
"jsonrpc": "2.0",
|
movieid = get_id('idMovie', 'movie')
|
||||||
"method": "VideoLibrary.Scan",
|
showid = get_id('idShow', 'tvshow')
|
||||||
"directory": videolibrarytools.FOLDER_MOVIES,
|
|
||||||
"id": 1
|
if movieid > 0 and showid > 0:
|
||||||
}
|
xbmc.executebuiltin('ReloadSkin()')
|
||||||
get_data(payload)
|
else:
|
||||||
payload = {
|
payload = {
|
||||||
"jsonrpc": "2.0",
|
"jsonrpc": "2.0",
|
||||||
"method": "VideoLibrary.Scan",
|
"method": "VideoLibrary.Scan",
|
||||||
@@ -40,8 +40,13 @@ def save_all():
|
|||||||
"id": 1
|
"id": 1
|
||||||
}
|
}
|
||||||
get_data(payload)
|
get_data(payload)
|
||||||
else:
|
payload = {
|
||||||
xbmc.executebuiltin('ReloadSkin()')
|
"jsonrpc": "2.0",
|
||||||
|
"method": "VideoLibrary.Scan",
|
||||||
|
"directory": videolibrarytools.FOLDER_MOVIES,
|
||||||
|
"id": 1
|
||||||
|
}
|
||||||
|
get_data(payload)
|
||||||
|
|
||||||
|
|
||||||
def add_video(item):
|
def add_video(item):
|
||||||
@@ -256,6 +261,7 @@ class addMovie(object):
|
|||||||
if self.info.get('set'):
|
if self.info.get('set'):
|
||||||
sql = 'SELECT idSet from sets where (strSet = "{}") limit 1'.format(self.info.get('set'))
|
sql = 'SELECT idSet from sets where (strSet = "{}") limit 1'.format(self.info.get('set'))
|
||||||
collection_info = videolibrarydb['collection'][self.info.get('setid')].infoLabels
|
collection_info = videolibrarydb['collection'][self.info.get('setid')].infoLabels
|
||||||
|
logger.debug('COLLECTION INFO:',collection_info)
|
||||||
nun_records, records = execute_sql_kodi(sql, conn=conn)
|
nun_records, records = execute_sql_kodi(sql, conn=conn)
|
||||||
if records:
|
if records:
|
||||||
self.idSet = records[0][0]
|
self.idSet = records[0][0]
|
||||||
@@ -264,20 +270,20 @@ class addMovie(object):
|
|||||||
sql = 'INSERT OR IGNORE INTO sets (idSet, strSet, strOvervieW) VALUES ( ?, ?, ?)'
|
sql = 'INSERT OR IGNORE INTO sets (idSet, strSet, strOvervieW) VALUES ( ?, ?, ?)'
|
||||||
params = (self.idSet, self.info.get('set'), self.info.get('setoverview'))
|
params = (self.idSet, self.info.get('set'), self.info.get('setoverview'))
|
||||||
self.sql_actions.append([sql, params])
|
self.sql_actions.append([sql, params])
|
||||||
if collection_info.get('poster'):
|
if collection_info.get('posters'):
|
||||||
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'poster', 'url':collection_info.get('poster')})
|
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'poster', 'url':collection_info.get('posters')[0]})
|
||||||
if collection_info.get('fanart'):
|
if collection_info.get('fanarts'):
|
||||||
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'fanart', 'url':collection_info.get('fanart')})
|
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'fanart', 'url':collection_info.get('fanarts')[0]})
|
||||||
if collection_info.get('landscape'):
|
if collection_info.get('landscapes'):
|
||||||
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'landscape', 'url':collection_info.get('landscape')})
|
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'landscape', 'url':collection_info.get('landscapes')[0]})
|
||||||
if collection_info.get('banner'):
|
if collection_info.get('banners'):
|
||||||
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'banner', 'url':collection_info.get('banner')})
|
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'banner', 'url':collection_info.get('banners')[0]})
|
||||||
if collection_info.get('clearlogo'):
|
if collection_info.get('clearlogos'):
|
||||||
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'clearlogo', 'url':collection_info.get('clearlogo')})
|
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'clearlogo', 'url':collection_info.get('clearlogos')[0]})
|
||||||
if collection_info.get('clearart'):
|
if collection_info.get('cleararts'):
|
||||||
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'clearart', 'url':collection_info.get('clearart')})
|
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'clearart', 'url':collection_info.get('cleararts')[0]})
|
||||||
if collection_info.get('disc'):
|
if collection_info.get('discs'):
|
||||||
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'clearart', 'url':collection_info.get('disc')})
|
self.art.append({'media_id':self.idSet, 'media_type': 'set', 'type':'clearart', 'url':collection_info.get('discs')[0]})
|
||||||
|
|
||||||
def set_files(self):
|
def set_files(self):
|
||||||
self.idFile = get_id('idFile', 'files')
|
self.idFile = get_id('idFile', 'files')
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import threading
|
import threading
|
||||||
|
from core import support
|
||||||
|
|
||||||
import xbmc, xbmcgui, sys, channelselector, time, os
|
import xbmc, xbmcgui, sys, channelselector, time, os
|
||||||
from core.support import dbg, tmdb
|
from core.support import dbg, tmdb
|
||||||
@@ -8,6 +9,7 @@ from core import channeltools, servertools, scrapertools
|
|||||||
from platformcode import platformtools, config, logger
|
from platformcode import platformtools, config, logger
|
||||||
from platformcode.launcher import run
|
from platformcode.launcher import run
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
from platformcode.dbconverter import reload
|
||||||
|
|
||||||
if sys.version_info[0] >= 3:
|
if sys.version_info[0] >= 3:
|
||||||
PY3 = True
|
PY3 = True
|
||||||
@@ -73,6 +75,7 @@ SERVERLIST = 300
|
|||||||
class SearchWindow(xbmcgui.WindowXML):
|
class SearchWindow(xbmcgui.WindowXML):
|
||||||
def start(self, item, moduleDict={}, searchActions=[], thActions=None):
|
def start(self, item, moduleDict={}, searchActions=[], thActions=None):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
|
|
||||||
self.exit = False
|
self.exit = False
|
||||||
self.item = item
|
self.item = item
|
||||||
self.type = self.item.mode
|
self.type = self.item.mode
|
||||||
@@ -89,6 +92,7 @@ class SearchWindow(xbmcgui.WindowXML):
|
|||||||
self.pos = 0
|
self.pos = 0
|
||||||
self.items = []
|
self.items = []
|
||||||
self.search_threads = []
|
self.search_threads = []
|
||||||
|
self.reload = False
|
||||||
|
|
||||||
if not thActions:
|
if not thActions:
|
||||||
self.thActions = Thread(target=self.getActionsThread)
|
self.thActions = Thread(target=self.getActionsThread)
|
||||||
@@ -118,7 +122,6 @@ class SearchWindow(xbmcgui.WindowXML):
|
|||||||
from specials.search import save_search
|
from specials.search import save_search
|
||||||
save_search(self.item.text)
|
save_search(self.item.text)
|
||||||
|
|
||||||
|
|
||||||
def getActionsThread(self):
|
def getActionsThread(self):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
self.channelsList = self.get_channels()
|
self.channelsList = self.get_channels()
|
||||||
@@ -577,6 +580,7 @@ class SearchWindow(xbmcgui.WindowXML):
|
|||||||
|
|
||||||
elif action in [EXIT]:
|
elif action in [EXIT]:
|
||||||
self.Close()
|
self.Close()
|
||||||
|
reload()
|
||||||
close_action = True
|
close_action = True
|
||||||
xbmc.sleep(500)
|
xbmc.sleep(500)
|
||||||
|
|
||||||
@@ -602,6 +606,7 @@ class SearchWindow(xbmcgui.WindowXML):
|
|||||||
|
|
||||||
elif control_id in [CLOSE]:
|
elif control_id in [CLOSE]:
|
||||||
self.Close()
|
self.Close()
|
||||||
|
reload()
|
||||||
close_action = True
|
close_action = True
|
||||||
|
|
||||||
elif control_id in [MENU]:
|
elif control_id in [MENU]:
|
||||||
@@ -769,7 +774,6 @@ class SearchWindow(xbmcgui.WindowXML):
|
|||||||
platformtools.dialog_busy(False)
|
platformtools.dialog_busy(False)
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
|
|
||||||
def context(self):
|
def context(self):
|
||||||
focus = self.getFocusId()
|
focus = self.getFocusId()
|
||||||
if focus == EPISODESLIST: # context on episode
|
if focus == EPISODESLIST: # context on episode
|
||||||
@@ -785,11 +789,11 @@ class SearchWindow(xbmcgui.WindowXML):
|
|||||||
parent.noMainMenu = True
|
parent.noMainMenu = True
|
||||||
commands = platformtools.set_context_commands(item, item_url, parent)
|
commands = platformtools.set_context_commands(item, item_url, parent)
|
||||||
context = [c[0] for c in commands]
|
context = [c[0] for c in commands]
|
||||||
context_commands = [c[1].replace('Container.Refresh', 'RunPlugin').replace('Container.Update', 'RunPlugin') for c in commands]
|
context_commands = [c[1].replace('Container.Refresh', 'RunPlugin').replace('Container.Update', 'RunPlugin').replace(')','&no_reload=True)') for c in commands]
|
||||||
index = xbmcgui.Dialog().contextmenu(context)
|
index = xbmcgui.Dialog().contextmenu(context)
|
||||||
|
self.reload = True
|
||||||
if index > 0: xbmc.executebuiltin(context_commands[index])
|
if index > 0: xbmc.executebuiltin(context_commands[index])
|
||||||
|
|
||||||
|
|
||||||
def play(self, server=None):
|
def play(self, server=None):
|
||||||
platformtools.prevent_busy(server)
|
platformtools.prevent_busy(server)
|
||||||
server.window = True
|
server.window = True
|
||||||
|
|||||||
Reference in New Issue
Block a user