Merge remote-tracking branch 'origin/master'

This commit is contained in:
marco
2020-04-18 11:29:09 +02:00
10 changed files with 179 additions and 186 deletions

View File

@@ -245,7 +245,9 @@ def open_settings():
if not settings_pre.get("videolibrary_kodi", None) and settings_post.get("videolibrary_kodi", None):
xbmc_videolibrary.ask_set_content(silent=True)
elif settings_pre.get("videolibrary_kodi", None) and not settings_post.get("videolibrary_kodi", None):
xbmc_videolibrary.clean(get_setting('videolibrarypath'))
strm_list = []
strm_list.append(get_setting('videolibrarypath'))
xbmc_videolibrary.clean(strm_list)
def get_setting(name, channel="", server="", default=None):

View File

@@ -38,6 +38,8 @@ from platformcode import logger
from platformcode import config
from platformcode import unify
addon = xbmcaddon.Addon('plugin.video.kod')
addon_icon = os.path.join( addon.getAddonInfo( "path" ), "logo.png" )
class XBMCPlayer(xbmc.Player):
@@ -60,10 +62,10 @@ def dialog_ok(heading, line1, line2="", line3=""):
return dialog.ok(heading, makeMessage(line1, line2, line3))
def dialog_notification(heading, message, icon=0, time=5000, sound=True):
def dialog_notification(heading, message, icon=3, time=5000, sound=True):
dialog = xbmcgui.Dialog()
try:
l_icono = xbmcgui.NOTIFICATION_INFO, xbmcgui.NOTIFICATION_WARNING, xbmcgui.NOTIFICATION_ERROR
l_icono = xbmcgui.NOTIFICATION_INFO, xbmcgui.NOTIFICATION_WARNING, xbmcgui.NOTIFICATION_ERROR, addon_icon
dialog.notification(heading, message, l_icono[icon], time, sound)
except:
dialog_ok(heading, message)

View File

@@ -174,11 +174,11 @@ def check(background=False):
'w') # il file di tracking viene eliminato, lo ricreo
if addon.getSetting("addon_update_message"):
if background:
platformtools.dialog_notification(config.get_localized_string(20000), 'Aggiornato fino al commit ' + commits[0]['sha'][:7] + '\napri il menu principale per vedere il changelog', time=3000, sound=False)
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(80040) % commits[0]['sha'][:7], time=3000, sound=False)
with open(xbmc.translatePath(changelogFile), 'a+') as fileC:
fileC.write(changelog)
elif changelog:
platformtools.dialog_ok('Kodi on Demand', 'Aggiornamenti applicati:\n' + changelog)
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(80041) + changelog)
localCommitFile.seek(0)
localCommitFile.truncate()

View File

@@ -216,7 +216,6 @@ def sync_trakt_kodi(silent=True):
if notificacion:
platformtools.dialog_notification(config.get_localized_string(20000),
config.get_localized_string(60045),
icon=0,
time=2000)
@@ -878,7 +877,7 @@ def update_db(old_path, new_path, old_movies_folder, new_movies_folder, old_tvsh
xbmc.executebuiltin('XBMC.ReloadSkin()')
def clean(path=''):
def clean(path_list=[]):
def sql_format(path):
if path.startswith("special://"):
path = path.replace('/profile/', '/%/').replace('/home/userdata/', '/%/')
@@ -894,127 +893,125 @@ def clean(path=''):
logger.info()
idParentPath = 0
sql_path = ''
sql_movies_path = ''
sql_tvshows_path = ''
sql_episodes_path = ''
path, sep = sql_format(path)
movies_folder = config.get_setting("folder_movies")
tvshows_folder = config.get_setting("folder_tvshows")
# delete episode/movie (downloads.py move_to_libray)
if path.endswith(".strm"):
if movies_folder in path:
sql_movies_path = path
else:
sql_episodes_path = path
# delete movie
elif movies_folder in path:
if not path.endswith(sep): path += sep
sql_movies_path = path + '%'
# delete tvshow
elif tvshows_folder in path:
if not path.endswith(sep): path += sep
sql_tvshows_path = path + '%'
sql_episodes_path = sql_tvshows_path
# delete video library
else:
if not path.endswith(sep): path += sep
sql_path = path
sql_movies_path = sql_path + movies_folder
if not sql_movies_path.endswith(sep): sql_movies_path += sep
sql_movies_path += '%'
sql_tvshows_path = sql_path + tvshows_folder
if not sql_tvshows_path.endswith(sep): sql_tvshows_path += sep
sql_tvshows_path += '%'
sql_episodes_path = sql_tvshows_path
progress = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(80025))
progress.update(0)
if sql_path:
# search video library path in the DB
sql = 'SELECT idPath FROM path where strPath LIKE "%s"' % sql_path
nun_records, records = execute_sql_kodi(sql)
# delete video library path
if records:
idPath = records[0][0]
idParentPath = idPath
if not config.get_setting("videolibrary_kodi"):
sql = 'DELETE from path WHERE idPath=%s' % idPath
nun_records, records = execute_sql_kodi(sql)
progress.update(10)
if sql_movies_path:
# search movies in the DB
sql = 'SELECT idMovie FROM movie where c22 LIKE "%s"' % sql_movies_path
nun_records, records = execute_sql_kodi(sql)
# delete movies
if records:
for record in records:
idMovie = record[0]
sql = 'DELETE from movie WHERE idMovie=%s' % idMovie
nun_records, records = execute_sql_kodi(sql)
for path in path_list:
progress.update(28)
if sql_movies_path:
# search movies path and folders in the DB
sql = 'SELECT idPath, idParentPath FROM path where strPath LIKE "%s"' % sql_movies_path
nun_records, records = execute_sql_kodi(sql)
# delete movies path and folders
if records:
for record in records:
if record[1] == idParentPath and config.get_setting("videolibrary_kodi"):
continue
idPath = record[0]
sql = 'DELETE from path WHERE idPath=%s' % idPath
nun_records, records = execute_sql_kodi(sql)
idParentPath = 0
sql_path = ''
sql_movies_path = ''
sql_tvshows_path = ''
sql_episodes_path = ''
progress.update(46)
if sql_tvshows_path:
# search TV shows in the DB
sql = 'SELECT idShow FROM tvshow_view where strPath LIKE "%s"' % sql_tvshows_path
nun_records, records = execute_sql_kodi(sql)
# delete TV shows
if records:
for record in records:
idShow = record[0]
sql = 'DELETE from tvshow WHERE idShow=%s' % idShow
nun_records, records = execute_sql_kodi(sql)
path, sep = sql_format(path)
movies_folder = config.get_setting("folder_movies")
tvshows_folder = config.get_setting("folder_tvshows")
progress.update(64)
if sql_episodes_path:
# search episodes in the DB
sql = 'SELECT idEpisode FROM episode where c18 LIKE "%s"' % sql_episodes_path
nun_records, records = execute_sql_kodi(sql)
# delete episodes
if records:
for record in records:
idEpisode = record[0]
sql = 'DELETE from episode WHERE idEpisode=%s' % idEpisode
nun_records, records = execute_sql_kodi(sql)
# delete episode/movie (downloads.py move_to_libray)
if path.endswith(".strm"):
if movies_folder in path:
sql_movies_path = path
else:
sql_episodes_path = path
# delete movie
elif movies_folder in path:
if not path.endswith(sep): path += sep
progress.update(82)
if sql_tvshows_path:
# search TV shows path and folders in the DB
sql = 'SELECT idPath, idParentPath FROM path where strPath LIKE "%s"' % sql_tvshows_path
nun_records, records = execute_sql_kodi(sql)
# delete tvshows path and folders
if records:
for record in records:
if record[1] == idParentPath and config.get_setting("videolibrary_kodi"):
continue
idPath = record[0]
sql = 'DELETE from path WHERE idPath=%s' % idPath
nun_records, records = execute_sql_kodi(sql)
sql_movies_path = path + '%'
# delete tvshow
elif tvshows_folder in path:
if not path.endswith(sep): path += sep
sql_tvshows_path = path + '%'
sql_episodes_path = sql_tvshows_path
# delete video library
else:
if not path.endswith(sep): path += sep
sql_path = path
sql_movies_path = sql_path + movies_folder
if not sql_movies_path.endswith(sep): sql_movies_path += sep
sql_movies_path += '%'
sql_tvshows_path = sql_path + tvshows_folder
if not sql_tvshows_path.endswith(sep): sql_tvshows_path += sep
sql_tvshows_path += '%'
sql_episodes_path = sql_tvshows_path
if sql_path:
# search video library path in the DB
sql = 'SELECT idPath FROM path where strPath LIKE "%s"' % sql_path
nun_records, records = execute_sql_kodi(sql)
# delete video library path
if records:
idPath = records[0][0]
idParentPath = idPath
if not config.get_setting("videolibrary_kodi"):
sql = 'DELETE from path WHERE idPath=%s' % idPath
nun_records, records = execute_sql_kodi(sql)
if sql_movies_path:
# search movies in the DB
sql = 'SELECT idMovie FROM movie where c22 LIKE "%s"' % sql_movies_path
nun_records, records = execute_sql_kodi(sql)
# delete movies
if records:
for record in records:
idMovie = record[0]
sql = 'DELETE from movie WHERE idMovie=%s' % idMovie
nun_records, records = execute_sql_kodi(sql)
if sql_movies_path:
# search movies path and folders in the DB
sql = 'SELECT idPath, idParentPath FROM path where strPath LIKE "%s"' % sql_movies_path
nun_records, records = execute_sql_kodi(sql)
# delete movies path and folders
if records:
for record in records:
if record[1] == idParentPath and config.get_setting("videolibrary_kodi"):
continue
idPath = record[0]
sql = 'DELETE from path WHERE idPath=%s' % idPath
nun_records, records = execute_sql_kodi(sql)
if sql_tvshows_path:
# search TV shows in the DB
sql = 'SELECT idShow FROM tvshow_view where strPath LIKE "%s"' % sql_tvshows_path
nun_records, records = execute_sql_kodi(sql)
# delete TV shows
if records:
for record in records:
idShow = record[0]
sql = 'DELETE from tvshow WHERE idShow=%s' % idShow
nun_records, records = execute_sql_kodi(sql)
if sql_episodes_path:
# search episodes in the DB
sql = 'SELECT idEpisode FROM episode where c18 LIKE "%s"' % sql_episodes_path
nun_records, records = execute_sql_kodi(sql)
# delete episodes
if records:
for record in records:
idEpisode = record[0]
sql = 'DELETE from episode WHERE idEpisode=%s' % idEpisode
nun_records, records = execute_sql_kodi(sql)
if sql_tvshows_path:
# search TV shows path and folders in the DB
sql = 'SELECT idPath, idParentPath FROM path where strPath LIKE "%s"' % sql_tvshows_path
nun_records, records = execute_sql_kodi(sql)
# delete tvshows path and folders
if records:
for record in records:
if record[1] == idParentPath and config.get_setting("videolibrary_kodi"):
continue
idPath = record[0]
sql = 'DELETE from path WHERE idPath=%s' % idPath
nun_records, records = execute_sql_kodi(sql)
progress.update(100)
xbmc.sleep(1000)