From 109c10753227303e5e81e328464d4e780cf0bf51 Mon Sep 17 00:00:00 2001 From: TrueTechy Date: Mon, 9 Dec 2019 20:27:11 +0000 Subject: [PATCH] Removed blocks of commented out code --- jellyfin_kodi/library.py | 6 - jellyfin_kodi/objects/kodi/artwork.py | 163 +------------------------- 2 files changed, 1 insertion(+), 168 deletions(-) diff --git a/jellyfin_kodi/library.py b/jellyfin_kodi/library.py index 8528dc72..970f794d 100644 --- a/jellyfin_kodi/library.py +++ b/jellyfin_kodi/library.py @@ -390,12 +390,6 @@ class Library(threading.Thread): sync = get_sync() LOG.info("--[ retrieve changes ] %s", last_sync) - """ - for library in sync['Whitelist']: - - data = self.server.jellyfin.get_date_modified(last_sync, library.replace('Mixed:', ""), "Series,Episode,BoxSet,Movie,MusicVideo,MusicArtist,MusicAlbum,Audio") - [self.updated_output[query['Type']].put(query) for query in data['Items']] - """ try: updated = [] userdata = [] diff --git a/jellyfin_kodi/objects/kodi/artwork.py b/jellyfin_kodi/objects/kodi/artwork.py index 40268f75..baed5ee5 100644 --- a/jellyfin_kodi/objects/kodi/artwork.py +++ b/jellyfin_kodi/objects/kodi/artwork.py @@ -216,165 +216,4 @@ class GetArtworkWorker(threading.Thread): self.queue.task_done() if xbmc.Monitor().abortRequested(): - break - - -""" - -# -*- coding: utf-8 -*- - -################################################################################################# - -import logging -import os -import urllib -from sqlite3 import OperationalError - -import xbmc -import xbmcgui -import xbmcvfs -import requests - -import resources.lib.image_cache_thread as image_cache_thread -from resources.lib.helper import _, window, settings, JSONRPC -from resources.lib.database import Database -from __objs__ import QU - -################################################################################################## - -log = logging.getLogger("JELLYFIN."+__name__) - -################################################################################################## - - -class Artwork(object): - - xbmc_host = 'localhost' - xbmc_port = None - xbmc_username = None - xbmc_password = None - - image_cache_threads = [] - image_cache_limit = 0 - - - def __init__(self, server): - - self.server = server - self.enable_texture_cache = settings('enableTextureCache') == "true" - self.image_cache_limit = int(settings('imageCacheLimit')) * 5 - log.debug("image cache thread count: %s", self.image_cache_limit) - - if not self.xbmc_port and self.enable_texture_cache: - self._set_webserver_details() - - - def texture_cache_sync(self): - # This method will sync all Kodi artwork to textures13.db - # and cache them locally. This takes diskspace! - if not dialog(type_="yesno", - heading="{jellyfin}", - line1=_(33042)): - return - - log.info("Doing Image Cache Sync") - - pdialog = xbmcgui.DialogProgress() - pdialog.create(_(29999), _(33043)) - - # ask to rest all existing or not - if dialog(type_="yesno", heading="{jellyfin}", line1=_(33044)): - log.info("Resetting all cache data first") - self.delete_cache() - - # Cache all entries in video DB - self._cache_all_video_entries(pdialog) - # Cache all entries in music DB - self._cache_all_music_entries(pdialog) - - pdialog.update(100, "%s %s" % (_(33046), len(self.image_cache_threads))) - log.info("Waiting for all threads to exit") - - while len(self.image_cache_threads): - for thread in self.image_cache_threads: - if thread.is_finished: - self.image_cache_threads.remove(thread) - pdialog.update(100, "%s %s" % (_(33046), len(self.image_cache_threads))) - log.info("Waiting for all threads to exit: %s", len(self.image_cache_threads)) - xbmc.sleep(500) - - pdialog.close() - - @classmethod - def delete_cache(cls): - # Remove all existing textures first - path = xbmc.translatePath('special://thumbnails/').decode('utf-8') - if xbmcvfs.exists(path): - dirs, ignore_files = xbmcvfs.listdir(path) - for directory in dirs: - ignore_dirs, files = xbmcvfs.listdir(path + directory) - for file_ in files: - - if os.path.supports_unicode_filenames: - filename = os.path.join(path + directory.decode('utf-8'), - file_.decode('utf-8')) - else: - filename = os.path.join(path.encode('utf-8') + directory, file_) - - xbmcvfs.delete(filename) - log.debug("deleted: %s", filename) - - # remove all existing data from texture DB - with DatabaseConn('texture') as cursor_texture: - cursor_texture.execute('SELECT tbl_name FROM sqlite_master WHERE type="table"') - rows = cursor_texture.fetchall() - for row in rows: - table_name = row[0] - if table_name != "version": - cursor_texture.execute("DELETE FROM " + table_name) - - def _cache_all_video_entries(self, pdialog): - - with Database('video') as cursor_video: - - cursor_video.execute("SELECT url FROM art WHERE media_type != 'actor'") # dont include actors - result = cursor_video.fetchall() - total = len(result) - log.info("Image cache sync about to process %s images", total) - cursor_video.close() - - count = 0 - for url in result: - - if pdialog.iscanceled(): - break - - percentage = int((float(count) / float(total))*100) - message = "%s of %s (%s)" % (count, total, len(self.image_cache_threads)) - pdialog.update(percentage, "%s %s" % (_(33045), message)) - self.cache_texture(url[0]) - count += 1 - - def _cache_all_music_entries(self, pdialog): - - with Database('music') as cursor_music: - - cursor_music.execute("SELECT url FROM art") - result = cursor_music.fetchall() - total = len(result) - - log.info("Image cache sync about to process %s images", total) - - count = 0 - for url in result: - - if pdialog.iscanceled(): - break - - percentage = int((float(count) / float(total))*100) - message = "%s of %s" % (count, total) - pdialog.update(percentage, "%s %s" % (_(33045), message)) - self.cache_texture(url[0]) - count += 1 - -""" + break \ No newline at end of file