Fix vari
This commit is contained in:
@@ -305,6 +305,11 @@ def get_localized_category(categ):
|
||||
return categories[categ] if categ in categories else categ
|
||||
|
||||
|
||||
def get_localized_language(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")
|
||||
|
||||
@@ -7,7 +7,7 @@ from platformcode.xbmc_videolibrary import execute_sql_kodi, get_data, get_file_
|
||||
from time import time, strftime, localtime
|
||||
import sqlite3
|
||||
|
||||
conn = sqlite3.connect(get_file_db())
|
||||
# conn = sqlite3.connect(get_file_db())
|
||||
date = strftime('%Y-%m-%d %H:%M:%S', localtime(float(time())))
|
||||
|
||||
def save_all():
|
||||
@@ -23,7 +23,7 @@ def save_all():
|
||||
item = tvshow['item']
|
||||
item.no_reload = True
|
||||
add_video(item)
|
||||
conn.close()
|
||||
# conn.close()
|
||||
|
||||
reload()
|
||||
|
||||
@@ -50,6 +50,8 @@ def reload():
|
||||
|
||||
|
||||
def add_video(item):
|
||||
global conn
|
||||
conn = sqlite3.connect(get_file_db())
|
||||
progress = platformtools.dialog_progress_bg('Sincronizzazione Libreria', item.title)
|
||||
progress.update(0)
|
||||
if item.contentType == 'movie':
|
||||
@@ -61,6 +63,7 @@ def add_video(item):
|
||||
addTvShow(item=item)
|
||||
logger.debug('TOTAL TIME:', time() - start)
|
||||
videolibrarydb.close()
|
||||
conn.close()
|
||||
progress.close()
|
||||
|
||||
|
||||
@@ -223,7 +226,7 @@ class addMovie(object):
|
||||
get_data(payload)
|
||||
else:
|
||||
xbmc.executebuiltin('ReloadSkin()')
|
||||
conn.close()
|
||||
# conn.close()
|
||||
|
||||
def get_id(self):
|
||||
Type = 'id' + self.item.contentType.replace('tv', '').capitalize()
|
||||
@@ -433,7 +436,9 @@ class addMovie(object):
|
||||
params = []
|
||||
art_urls = []
|
||||
_id = get_id('art_id', 'art')
|
||||
art_urls = [[u[0], u[1], u[2]] for u in execute_sql_kodi('select media_id, media_type, type from art', conn=conn)[1]]
|
||||
arts = execute_sql_kodi('select media_id, media_type, type from art', conn=conn)[1]
|
||||
if arts:
|
||||
art_urls = [[u[0], u[1], u[2]] for u in arts]
|
||||
for art in self.art:
|
||||
if [art ['media_id'], art['media_type'], art['type']] not in art_urls:
|
||||
params.append((_id, art['media_id'], art['media_type'], art['type'], art['url']))
|
||||
@@ -490,7 +495,7 @@ class addTvShow(object):
|
||||
get_data(payload)
|
||||
else:
|
||||
xbmc.executebuiltin('ReloadSkin()')
|
||||
conn.close()
|
||||
# conn.close()
|
||||
|
||||
def get_idShow(self):
|
||||
sql = 'select idShow from tvshow_view where uniqueid_value = {} and uniqueid_type = "kod"'.format(self.info['tmdb_id'])
|
||||
@@ -867,7 +872,9 @@ class addTvShow(object):
|
||||
params = []
|
||||
art_urls = []
|
||||
_id = get_id('art_id', 'art')
|
||||
art_urls = [[u[0], u[1], u[2]] for u in execute_sql_kodi('select media_id, media_type, type from art', conn=conn)[1]]
|
||||
arts = execute_sql_kodi('select media_id, media_type, type from art', conn=conn)[1]
|
||||
if arts:
|
||||
art_urls = [[u[0], u[1], u[2]] for u in arts]
|
||||
for art in self.art:
|
||||
if [art['media_id'], art['media_type'], art['type']] not in art_urls:
|
||||
params.append((_id, art['media_id'], art['media_type'], art['type'], art['url']))
|
||||
|
||||
@@ -146,7 +146,7 @@ class InfoPlus(xbmcgui.WindowXML):
|
||||
back(self)
|
||||
elif action in [UP, DOWN, LEFT, RIGHT] and focus not in [LIST, CAST, RECOMANDED, TRAILERS, FANARTS, SEARCH, BACK, CLOSE]:
|
||||
self.setFocusId(LIST)
|
||||
if focus > 0:
|
||||
if focus > 0 and focus not in [SEARCH, BACK, CLOSE]:
|
||||
self.item.setFocus = focus
|
||||
self.item.focus[focus] = self.getControl(focus).getSelectedPosition()
|
||||
|
||||
@@ -155,13 +155,13 @@ class InfoPlus(xbmcgui.WindowXML):
|
||||
global info_list
|
||||
|
||||
if control in [SEARCH]:
|
||||
from specials.globalsearch import Search
|
||||
from specials.globalsearch import new_search
|
||||
if self.item.contentType == 'episode':
|
||||
self.item.mode = 'tvshow'
|
||||
self.item.contentType = 'tvshow'
|
||||
self.item.text = self.item.contentSerieName
|
||||
else:
|
||||
self.item.mode = self.item.contentType
|
||||
Search(self.item)
|
||||
self.item.mode = 'all'
|
||||
self.item.type = self.item.contentType
|
||||
new_search(self.item)
|
||||
|
||||
elif control in [CLOSE]:
|
||||
self.close()
|
||||
@@ -281,7 +281,7 @@ class CastWindow(xbmcgui.WindowXML):
|
||||
place = info.get('place_of_birth')
|
||||
self.castitem = xbmcgui.ListItem(info.get('name'))
|
||||
birth = born + (' - ' + dead if dead else '') + (' [B]•[/B] ' + place if place else '')
|
||||
self.castitem.setArt({'poster':self.item.poster})
|
||||
self.castitem.setArt({'poster':self.item.poster if self.item.poster else self.item.infoLabels.get('thumbnail', '')})
|
||||
self.castitem.setProperties({'birth':birth, 'plot':biography})
|
||||
|
||||
def onInit(self):
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# XBMC Launcher (xbmc / kodi)
|
||||
# ------------------------------------------------------------
|
||||
|
||||
import platformcode
|
||||
from specials import videolibrary
|
||||
import sys, os
|
||||
|
||||
@@ -112,7 +113,8 @@ def run(item=None):
|
||||
|
||||
elif item.channel == "infoplus":
|
||||
from platformcode import infoplus
|
||||
return infoplus.start(item)
|
||||
action = getattr(infoplus, item.action)
|
||||
return action(item)
|
||||
|
||||
elif item.channel == "backup":
|
||||
from platformcode import backup
|
||||
|
||||
@@ -365,18 +365,18 @@ def render_items(itemlist, parent_item):
|
||||
|
||||
icon_image = "DefaultFolder.png" if item.folder else "DefaultVideo.png"
|
||||
|
||||
title = item.title
|
||||
title = item.title if item.title else item.contentTitle
|
||||
episode = ''
|
||||
|
||||
if title[:1] not in ['[', '•']:
|
||||
if item.contentTitle: title = item.contentTitle
|
||||
elif item.contentSerieName: title = item.contentSerieName
|
||||
# if item.contentTitle: title = item.contentTitle
|
||||
# elif item.contentSerieName: title = item.contentSerieName
|
||||
if type(item.contentSeason) == int and type(item.contentEpisodeNumber) == int and not item.onlyep:
|
||||
episode = '{}x{:02d}'.format(item.contentSeason, item.contentEpisodeNumber)
|
||||
elif type(item.contentEpisodeNumber) == int:
|
||||
episode = '{:02d}'.format(item.contentEpisodeNumber)
|
||||
if episode and item.episode2:
|
||||
if len(item.episode2) < 4: episode = '{}-{}'.format(episode, '-'.join('{:02d}'.format(e) for e in item.episode2))
|
||||
if len(item.episode2) < 4: episode = '{}-{}'.format(episode, '-'.join('{:02d}'.format(int(e)) for e in item.episode2))
|
||||
else: episode = '{} -> {:02d}'.format(episode, item.episode2[-1])
|
||||
if episode: title = '{}. {}'.format(episode, title)
|
||||
if item.title2: title = '{} - {}'.format(title, item.title2)
|
||||
@@ -481,23 +481,24 @@ def render_items(itemlist, parent_item):
|
||||
|
||||
|
||||
def viewmodeMonitor():
|
||||
try:
|
||||
currentModeName = xbmc.getInfoLabel('Container.Viewmode')
|
||||
win = xbmcgui.Window(xbmcgui.getCurrentWindowId())
|
||||
currentMode = int(win.getFocusId())
|
||||
if currentModeName and 'plugin.video.kod' in xbmc.getInfoLabel('Container.FolderPath') and currentMode < 1000 and currentMode >= 50: # inside addon and in itemlist view
|
||||
content, Type = getCurrentView()
|
||||
if content:
|
||||
defaultMode = int(config.get_setting('view_mode_%s' % content).split(',')[-1])
|
||||
if currentMode != defaultMode:
|
||||
logger.debug('viewmode changed: ' + currentModeName + '-' + str(currentMode) + ' - content: ' + content)
|
||||
config.set_setting('view_mode_%s' % content, currentModeName + ', ' + str(currentMode))
|
||||
dialog_notification(config.get_localized_string(70153),
|
||||
config.get_localized_string(70187) % (content, currentModeName),
|
||||
sound=False)
|
||||
except:
|
||||
import traceback
|
||||
logger.error(traceback.print_exc())
|
||||
if get_window() == 'WINDOW_VIDEO_NAV':
|
||||
try:
|
||||
currentModeName = xbmc.getInfoLabel('Container.Viewmode')
|
||||
win = xbmcgui.Window(xbmcgui.getCurrentWindowId())
|
||||
currentMode = int(win.getFocusId())
|
||||
if currentModeName and 'plugin.video.kod' in xbmc.getInfoLabel('Container.FolderPath') and currentMode < 1000 and currentMode >= 50: # inside addon and in itemlist view
|
||||
content, Type = getCurrentView()
|
||||
if content:
|
||||
defaultMode = int(config.get_setting('view_mode_%s' % content).split(',')[-1])
|
||||
if currentMode != defaultMode:
|
||||
logger.debug('viewmode changed: ' + currentModeName + '-' + str(currentMode) + ' - content: ' + content)
|
||||
config.set_setting('view_mode_%s' % content, currentModeName + ', ' + str(currentMode))
|
||||
dialog_notification(config.get_localized_string(70153),
|
||||
config.get_localized_string(70187) % (content, currentModeName),
|
||||
sound=False)
|
||||
except:
|
||||
import traceback
|
||||
logger.error(traceback.print_exc())
|
||||
|
||||
|
||||
def getCurrentView(item=None, parent_item=None):
|
||||
@@ -1884,7 +1885,7 @@ def serverwindow(item, itemlist):
|
||||
title = self.item.contentTitle
|
||||
|
||||
it.setProperties({'name': title, 'channel': videoitem.ch_name, 'color': color if color else 'FF0082C2'})
|
||||
it.setArt({'poster':self.item.contentThumbnail, 'thumb':videoitem.thumbnail, 'fanart':item.fanart})
|
||||
it.setArt({'poster':self.item.contentThumbnail if self.item.contentThumbnail else self.item.thumbnail, 'thumb':videoitem.thumbnail, 'fanart':videoitem.fanart})
|
||||
self.servers.append(it)
|
||||
self.doModal()
|
||||
return self.selection
|
||||
|
||||
@@ -32,6 +32,7 @@ def mark_auto_as_watched(item):
|
||||
sync = False
|
||||
next_episode = None
|
||||
show_server = True
|
||||
mark_time = 100
|
||||
|
||||
percentage = float(config.get_setting("watched_setting")) / 100
|
||||
time_from_end = config.get_setting('next_ep_seconds')
|
||||
@@ -47,9 +48,9 @@ def mark_auto_as_watched(item):
|
||||
while not xbmc.Monitor().abortRequested():
|
||||
if not platformtools.is_playing(): break
|
||||
try: actual_time = xbmc.Player().getTime()
|
||||
except: pass
|
||||
except: actual_time = 0
|
||||
try: total_time = xbmc.Player().getTotalTime()
|
||||
except: pass
|
||||
except: total_time = 0
|
||||
if item.played_time and xbmcgui.getCurrentWindowId() == 12005:
|
||||
xbmc.Player().seekTime(item.played_time)
|
||||
item.played_time = 0 # Fix for Slow Devices
|
||||
@@ -262,7 +263,6 @@ def mark_content_as_watched_on_kodi(item, value=1):
|
||||
logger.debug()
|
||||
|
||||
if item.contentType == 'movie':
|
||||
conn = sqlite3.connect(get_file_db())
|
||||
path = '%{}%'.format(item.strm_path.split('\\')[0].split('/')[0] if item.strm_path else item.base_name)
|
||||
sql = 'select idMovie from movie_view where strPath like "{}"'.format(path)
|
||||
|
||||
@@ -270,7 +270,15 @@ def mark_content_as_watched_on_kodi(item, value=1):
|
||||
if r:
|
||||
payload = {"jsonrpc": "2.0", "method": "VideoLibrary.SetMovieDetails", "params": {"movieid": r[0][0], "playcount": value}, "id": 1}
|
||||
data = get_data(payload)
|
||||
elif item.contentType == 'episode':
|
||||
from core.support import dbg;dbg()
|
||||
path = '%{}'.format(item.strm_path.replace('\\','%').replace('/', '%'))
|
||||
sql = 'select idEpisode from episode_view where c18 like "{}"'.format(path)
|
||||
|
||||
n, r = execute_sql_kodi(sql)
|
||||
if r:
|
||||
payload = {"jsonrpc": "2.0", "method": "VideoLibrary.SetEpisodeDetails", "params": {"episodeid": r[0][0], "playcount": value}, "id": 1}
|
||||
data = get_data(payload)
|
||||
else:
|
||||
nun_records, records = execute_sql_kodi('SELECT idShow FROM tvshow_view WHERE uniqueid_value LIKE "{}"'.format(item.videolibrary_id))
|
||||
# delete TV show
|
||||
@@ -286,7 +294,7 @@ def mark_content_as_watched_on_kodi(item, value=1):
|
||||
payload = {"jsonrpc": "2.0", "method": "VideoLibrary.RemoveTVShow", "id": 1, "params": {"tvshowid": tvshowid}}
|
||||
data = get_data(payload)
|
||||
|
||||
from platformcode.dbconverter import add_video;add_video(item)
|
||||
from platformcode.dbconverter import add_video;add_video(item)
|
||||
|
||||
|
||||
def set_watched_on_kod(data):
|
||||
|
||||
Reference in New Issue
Block a user