mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-11-11 02:46:34 +00:00
Removes blank popup window from db reset logic
Cleans up the database reset logic to remove a blank popup window. Some other minor cleanup is included for readability.
This commit is contained in:
parent
80897822d3
commit
0108ed15e2
13 changed files with 102 additions and 109 deletions
|
|
@ -538,6 +538,10 @@ msgctxt "#33074"
|
||||||
msgid "Are you sure you want to reset your local Kodi database?"
|
msgid "Are you sure you want to reset your local Kodi database?"
|
||||||
msgstr "Möchtest du wirklich deine lokale Kodi Datenbank zurücksetzen?"
|
msgstr "Möchtest du wirklich deine lokale Kodi Datenbank zurücksetzen?"
|
||||||
|
|
||||||
|
msgctxt "#33085"
|
||||||
|
msgid "Unable to reset Kodi database while sync is running"
|
||||||
|
msgstr "Kodi-Datenbank kann während der Synchronisierung nicht zurückgesetzt werden"
|
||||||
|
|
||||||
msgctxt "#33086"
|
msgctxt "#33086"
|
||||||
msgid "Remove all cached artwork?"
|
msgid "Remove all cached artwork?"
|
||||||
msgstr "Alle zwischengespeicherten Bilder entfernen?"
|
msgstr "Alle zwischengespeicherten Bilder entfernen?"
|
||||||
|
|
|
||||||
|
|
@ -514,6 +514,10 @@ msgctxt "#33074"
|
||||||
msgid "Are you sure you want to reset your local Kodi database?"
|
msgid "Are you sure you want to reset your local Kodi database?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#33085"
|
||||||
|
msgid "Unable to reset Kodi database while sync is running"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#33086"
|
msgctxt "#33086"
|
||||||
msgid "Remove all cached artwork?"
|
msgid "Remove all cached artwork?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
|
||||||
|
|
@ -538,6 +538,10 @@ msgid "Are you sure you want to reset your local Kodi database?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Êtes-vous sûr de vouloir réinitialiser votre base de données Kodi locale ?"
|
"Êtes-vous sûr de vouloir réinitialiser votre base de données Kodi locale ?"
|
||||||
|
|
||||||
|
msgctxt "#33085"
|
||||||
|
msgid "Unable to reset Kodi database while sync is running"
|
||||||
|
msgstr "Impossible de réinitialiser la base de données Kodi lorsque la synchronisation est en cours d'exécution"
|
||||||
|
|
||||||
msgctxt "#33086"
|
msgctxt "#33086"
|
||||||
msgid "Remove all cached artwork?"
|
msgid "Remove all cached artwork?"
|
||||||
msgstr "Supprimer toutes les illustrations en cache ?"
|
msgstr "Supprimer toutes les illustrations en cache ?"
|
||||||
|
|
|
||||||
|
|
@ -536,6 +536,10 @@ msgctxt "#33074"
|
||||||
msgid "Are you sure you want to reset your local Kodi database?"
|
msgid "Are you sure you want to reset your local Kodi database?"
|
||||||
msgstr "Sei sicuro di voler resettare il tuo database Kodi locale?"
|
msgstr "Sei sicuro di voler resettare il tuo database Kodi locale?"
|
||||||
|
|
||||||
|
msgctxt "#33085"
|
||||||
|
msgid "Unable to reset Kodi database while sync is running"
|
||||||
|
msgstr "Impossibile ripristinare il database Kodi mentre la sincronizzazione è in esecuzione"
|
||||||
|
|
||||||
msgctxt "#33086"
|
msgctxt "#33086"
|
||||||
msgid "Remove all cached artwork?"
|
msgid "Remove all cached artwork?"
|
||||||
msgstr "Rimuove tutte le artwork dalla cache?"
|
msgstr "Rimuove tutte le artwork dalla cache?"
|
||||||
|
|
|
||||||
|
|
@ -534,6 +534,10 @@ msgctxt "#33074"
|
||||||
msgid "Are you sure you want to reset your local Kodi database?"
|
msgid "Are you sure you want to reset your local Kodi database?"
|
||||||
msgstr "Weet u zeker dat u de lokale Kodi databank resetten wilt?"
|
msgstr "Weet u zeker dat u de lokale Kodi databank resetten wilt?"
|
||||||
|
|
||||||
|
msgctxt "#33085"
|
||||||
|
msgid "Unable to reset Kodi database while sync is running"
|
||||||
|
msgstr "Kan Kodi-database niet opnieuw instellen terwijl synchronisatie wordt uitgevoerd"
|
||||||
|
|
||||||
msgctxt "#33086"
|
msgctxt "#33086"
|
||||||
msgid "Remove all cached artwork?"
|
msgid "Remove all cached artwork?"
|
||||||
msgstr "Cached artwork verwijderen?"
|
msgstr "Cached artwork verwijderen?"
|
||||||
|
|
|
||||||
|
|
@ -538,6 +538,10 @@ msgctxt "#33074"
|
||||||
msgid "Are you sure you want to reset your local Kodi database?"
|
msgid "Are you sure you want to reset your local Kodi database?"
|
||||||
msgstr "Na pewno chcesz zresetować lokalną bazę Kodi?"
|
msgstr "Na pewno chcesz zresetować lokalną bazę Kodi?"
|
||||||
|
|
||||||
|
msgctxt "#33085"
|
||||||
|
msgid "Unable to reset Kodi database while sync is running"
|
||||||
|
msgstr "Nie można zresetować bazy danych Kodi podczas synchronizacji"
|
||||||
|
|
||||||
msgctxt "#33086"
|
msgctxt "#33086"
|
||||||
msgid "Remove all cached artwork?"
|
msgid "Remove all cached artwork?"
|
||||||
msgstr "Usunąć pobrane grafiki?"
|
msgstr "Usunąć pobrane grafiki?"
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ from helper.utils import create_id
|
||||||
##################################################################################################
|
##################################################################################################
|
||||||
|
|
||||||
LOG = logging.getLogger("JELLYFIN."+__name__)
|
LOG = logging.getLogger("JELLYFIN."+__name__)
|
||||||
|
ADDON_DATA = xbmc.translatePath("special://profile/addon_data/plugin.video.jellyfin/").decode('utf-8')
|
||||||
|
|
||||||
##################################################################################################
|
##################################################################################################
|
||||||
|
|
||||||
|
|
@ -82,12 +83,7 @@ def get_device_id(reset=False):
|
||||||
if client_id:
|
if client_id:
|
||||||
return client_id
|
return client_id
|
||||||
|
|
||||||
directory = xbmc.translatePath('special://profile/addon_data/plugin.video.jellyfin/').decode('utf-8')
|
jellyfin_guid = os.path.join(ADDON_DATA, "jellyfin_guid")
|
||||||
|
|
||||||
if not xbmcvfs.exists(directory):
|
|
||||||
xbmcvfs.mkdir(directory)
|
|
||||||
|
|
||||||
jellyfin_guid = os.path.join(directory, "jellyfin_guid")
|
|
||||||
file_guid = xbmcvfs.File(jellyfin_guid)
|
file_guid = xbmcvfs.File(jellyfin_guid)
|
||||||
client_id = file_guid.read()
|
client_id = file_guid.read()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ from objects import obj
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
|
||||||
LOG = logging.getLogger("JELLYFIN."+__name__)
|
LOG = logging.getLogger("JELLYFIN."+__name__)
|
||||||
|
ADDON_DATA = xbmc.translatePath("special://profile/addon_data/plugin.video.jellyfin/").decode('utf-8')
|
||||||
|
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
|
||||||
|
|
@ -211,43 +212,26 @@ def reset():
|
||||||
from views import Views
|
from views import Views
|
||||||
views = Views()
|
views = Views()
|
||||||
|
|
||||||
if not dialog("yesno", heading="{jellyfin}", line1=_(33074)):
|
if window('jellyfin_sync.bool'):
|
||||||
return
|
|
||||||
|
|
||||||
window('jellyfin_should_stop.bool', True)
|
|
||||||
count = 10
|
|
||||||
|
|
||||||
while window('jellyfin_sync.bool'):
|
|
||||||
|
|
||||||
LOG.info("Sync is running...")
|
|
||||||
count -= 1
|
|
||||||
|
|
||||||
if not count:
|
|
||||||
dialog("ok", heading="{jellyfin}", line1=_(33085))
|
dialog("ok", heading="{jellyfin}", line1=_(33085))
|
||||||
|
else:
|
||||||
return
|
if dialog("yesno", heading="{jellyfin}", line1=_(33074)):
|
||||||
|
|
||||||
if xbmc.Monitor().waitForAbort(1):
|
|
||||||
return
|
|
||||||
|
|
||||||
reset_kodi()
|
reset_kodi()
|
||||||
reset_jellyfin()
|
reset_jellyfin()
|
||||||
views.delete_playlists()
|
views.delete_playlists()
|
||||||
views.delete_nodes()
|
views.delete_nodes()
|
||||||
|
LOG.info("[ reset kodi database ]")
|
||||||
|
|
||||||
if dialog("yesno", heading="{jellyfin}", line1=_(33086)):
|
if dialog("yesno", heading="{jellyfin}", line1=_(33086)):
|
||||||
reset_artwork()
|
reset_artwork()
|
||||||
|
|
||||||
addon_data = xbmc.translatePath("special://profile/addon_data/plugin.video.jellyfin/").decode('utf-8')
|
|
||||||
|
|
||||||
if dialog("yesno", heading="{jellyfin}", line1=_(33087)):
|
if dialog("yesno", heading="{jellyfin}", line1=_(33087)):
|
||||||
|
xbmcvfs.delete(os.path.join(ADDON_DATA, "settings.xml"))
|
||||||
xbmcvfs.delete(os.path.join(addon_data, "settings.xml"))
|
xbmcvfs.delete(os.path.join(ADDON_DATA, "data.json"))
|
||||||
xbmcvfs.delete(os.path.join(addon_data, "data.json"))
|
|
||||||
LOG.info("[ reset settings ]")
|
LOG.info("[ reset settings ]")
|
||||||
|
|
||||||
if xbmcvfs.exists(os.path.join(addon_data, "sync.json")):
|
if xbmcvfs.exists(os.path.join(ADDON_DATA, "sync.json")):
|
||||||
xbmcvfs.delete(os.path.join(addon_data, "sync.json"))
|
xbmcvfs.delete(os.path.join(ADDON_DATA, "sync.json"))
|
||||||
|
|
||||||
settings('enableMusic.bool', False)
|
settings('enableMusic.bool', False)
|
||||||
settings('MinimumSetup', "")
|
settings('MinimumSetup', "")
|
||||||
|
|
@ -255,6 +239,10 @@ def reset():
|
||||||
settings('SyncInstallRunDone.bool', False)
|
settings('SyncInstallRunDone.bool', False)
|
||||||
dialog("ok", heading="{jellyfin}", line1=_(33088))
|
dialog("ok", heading="{jellyfin}", line1=_(33088))
|
||||||
xbmc.executebuiltin('RestartApp')
|
xbmc.executebuiltin('RestartApp')
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
def reset_kodi():
|
def reset_kodi():
|
||||||
|
|
||||||
|
|
@ -278,7 +266,7 @@ def reset_kodi():
|
||||||
if name != 'version':
|
if name != 'version':
|
||||||
musicdb.cursor.execute("DELETE FROM " + name)
|
musicdb.cursor.execute("DELETE FROM " + name)
|
||||||
|
|
||||||
LOG.warn("[ reset kodi ]")
|
LOG.info("[ reset kodi ]")
|
||||||
|
|
||||||
def reset_jellyfin():
|
def reset_jellyfin():
|
||||||
|
|
||||||
|
|
@ -295,7 +283,7 @@ def reset_jellyfin():
|
||||||
jellyfindb.cursor.execute("DROP table IF EXISTS view")
|
jellyfindb.cursor.execute("DROP table IF EXISTS view")
|
||||||
jellyfindb.cursor.execute("DROP table IF EXISTS version")
|
jellyfindb.cursor.execute("DROP table IF EXISTS version")
|
||||||
|
|
||||||
LOG.warn("[ reset jellyfin ]")
|
LOG.info("[ reset jellyfin ]")
|
||||||
|
|
||||||
def reset_artwork():
|
def reset_artwork():
|
||||||
|
|
||||||
|
|
@ -322,17 +310,12 @@ def reset_artwork():
|
||||||
if name != 'version':
|
if name != 'version':
|
||||||
texdb.cursor.execute("DELETE FROM " + name)
|
texdb.cursor.execute("DELETE FROM " + name)
|
||||||
|
|
||||||
LOG.warn("[ reset artwork ]")
|
LOG.info("[ reset artwork ]")
|
||||||
|
|
||||||
def get_sync():
|
def get_sync():
|
||||||
|
|
||||||
path = xbmc.translatePath("special://profile/addon_data/plugin.video.jellyfin/").decode('utf-8')
|
|
||||||
|
|
||||||
if not xbmcvfs.exists(path):
|
|
||||||
xbmcvfs.mkdirs(path)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(os.path.join(path, 'sync.json')) as infile:
|
with open(os.path.join(ADDON_DATA, 'sync.json')) as infile:
|
||||||
sync = json.load(infile)
|
sync = json.load(infile)
|
||||||
except Exception:
|
except Exception:
|
||||||
sync = {}
|
sync = {}
|
||||||
|
|
@ -346,34 +329,23 @@ def get_sync():
|
||||||
|
|
||||||
def save_sync(sync):
|
def save_sync(sync):
|
||||||
|
|
||||||
path = xbmc.translatePath("special://profile/addon_data/plugin.video.jellyfin/").decode('utf-8')
|
|
||||||
|
|
||||||
if not xbmcvfs.exists(path):
|
|
||||||
xbmcvfs.mkdirs(path)
|
|
||||||
|
|
||||||
sync['Date'] = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')
|
sync['Date'] = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')
|
||||||
|
|
||||||
with open(os.path.join(path, 'sync.json'), 'w') as outfile:
|
with open(os.path.join(ADDON_DATA, 'sync.json'), 'w') as outfile:
|
||||||
json.dump(sync, outfile, sort_keys=True, indent=4, ensure_ascii=False)
|
json.dump(sync, outfile, sort_keys=True, indent=4, ensure_ascii=False)
|
||||||
|
|
||||||
def get_credentials():
|
def get_credentials():
|
||||||
|
|
||||||
path = xbmc.translatePath("special://profile/addon_data/plugin.video.jellyfin/").decode('utf-8')
|
|
||||||
|
|
||||||
if not xbmcvfs.exists(path):
|
|
||||||
xbmcvfs.mkdirs(path)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(os.path.join(path, 'data.json')) as infile:
|
if os.path.exists(os.path.join(ADDON_DATA, 'data.json')):
|
||||||
credentials = json.load(infile)
|
pass
|
||||||
except Exception:
|
elif os.path.exists(os.path.join(ADDON_DATA, 'data.txt')):
|
||||||
|
os.rename(os.path.join(ADDON_DATA, 'data.txt'), os.path.join(ADDON_DATA, 'data.json'))
|
||||||
|
else:
|
||||||
|
open(os.path.join(ADDON_DATA, 'data.json'), 'a')
|
||||||
|
|
||||||
try:
|
with open(os.path.join(ADDON_DATA, 'data.json')) as infile:
|
||||||
with open(os.path.join(path, 'data.txt')) as infile:
|
|
||||||
credentials = json.load(infile)
|
credentials = json.load(infile)
|
||||||
save_credentials(credentials)
|
|
||||||
|
|
||||||
xbmcvfs.delete(os.path.join(path, 'data.txt'))
|
|
||||||
except Exception:
|
except Exception:
|
||||||
credentials = {}
|
credentials = {}
|
||||||
|
|
||||||
|
|
@ -383,12 +355,8 @@ def get_credentials():
|
||||||
|
|
||||||
def save_credentials(credentials):
|
def save_credentials(credentials):
|
||||||
credentials = credentials or {}
|
credentials = credentials or {}
|
||||||
path = xbmc.translatePath("special://profile/addon_data/plugin.video.jellyfin/").decode('utf-8')
|
|
||||||
|
|
||||||
if not xbmcvfs.exists(path):
|
with open(os.path.join(ADDON_DATA, 'data.json'), 'w') as outfile:
|
||||||
xbmcvfs.mkdirs(path)
|
|
||||||
|
|
||||||
with open(os.path.join(path, 'data.json'), 'w') as outfile:
|
|
||||||
json.dump(credentials, outfile, sort_keys=True, indent=4, ensure_ascii=False)
|
json.dump(credentials, outfile, sort_keys=True, indent=4, ensure_ascii=False)
|
||||||
|
|
||||||
def get_item(kodi_id, media):
|
def get_item(kodi_id, media):
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ class Library(threading.Thread):
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
LOG.warn("--->[ library ]")
|
LOG.info("--->[ library ]")
|
||||||
|
|
||||||
if not self.startup():
|
if not self.startup():
|
||||||
self.stop_client()
|
self.stop_client()
|
||||||
|
|
@ -117,7 +117,7 @@ class Library(threading.Thread):
|
||||||
if self.monitor.waitForAbort(2):
|
if self.monitor.waitForAbort(2):
|
||||||
break
|
break
|
||||||
|
|
||||||
LOG.warn("---<[ library ]")
|
LOG.info("---<[ library ]")
|
||||||
|
|
||||||
def test_databases(self):
|
def test_databases(self):
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -449,7 +449,7 @@ class Listener(threading.Thread):
|
||||||
''' Detect the resume dialog for widgets.
|
''' Detect the resume dialog for widgets.
|
||||||
Detect external players.
|
Detect external players.
|
||||||
'''
|
'''
|
||||||
LOG.warn("--->[ listener ]")
|
LOG.info("--->[ listener ]")
|
||||||
|
|
||||||
while not self.stop_thread:
|
while not self.stop_thread:
|
||||||
special_listener()
|
special_listener()
|
||||||
|
|
|
||||||
15
service.py
15
service.py
|
|
@ -9,6 +9,7 @@ import sys
|
||||||
|
|
||||||
import xbmc
|
import xbmc
|
||||||
import xbmcaddon
|
import xbmcaddon
|
||||||
|
import xbmcvfs
|
||||||
|
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
|
||||||
|
|
@ -27,6 +28,7 @@ from helper import settings
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
|
||||||
LOG = logging.getLogger("JELLYFIN." + __name__)
|
LOG = logging.getLogger("JELLYFIN." + __name__)
|
||||||
|
ADDON_DATA = xbmc.translatePath("special://profile/addon_data/plugin.video.jellyfin/").decode('utf-8')
|
||||||
DELAY = int(settings('startupDelay') if settings('SyncInstallRunDone.bool') else 4 or 0)
|
DELAY = int(settings('startupDelay') if settings('SyncInstallRunDone.bool') else 4 or 0)
|
||||||
|
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
|
@ -71,14 +73,14 @@ if __name__ == "__main__":
|
||||||
LOG.info("-->[ service ]")
|
LOG.info("-->[ service ]")
|
||||||
LOG.info("Delay startup by %s seconds.", DELAY)
|
LOG.info("Delay startup by %s seconds.", DELAY)
|
||||||
|
|
||||||
|
if not xbmcvfs.exists(ADDON_DATA):
|
||||||
|
xbmcvfs.mkdirs(ADDON_DATA)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
||||||
if not settings('enableAddon.bool'):
|
if settings('enableAddon.bool'):
|
||||||
LOG.warn("Jellyfin for Kodi is not enabled.")
|
|
||||||
|
|
||||||
break
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
session = ServiceManager()
|
session = ServiceManager()
|
||||||
session.start()
|
session.start()
|
||||||
session.join() # Block until the thread exits.
|
session.join() # Block until the thread exits.
|
||||||
|
|
@ -92,5 +94,8 @@ if __name__ == "__main__":
|
||||||
LOG.exception(error)
|
LOG.exception(error)
|
||||||
|
|
||||||
break
|
break
|
||||||
|
else:
|
||||||
|
LOG.warn("Jellyfin for Kodi is not enabled.")
|
||||||
|
break
|
||||||
|
|
||||||
LOG.info("--<[ service ]")
|
LOG.info("--<[ service ]")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue