mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Merge pull request #157 from TrueTechy/remove_commented_code
Removed blocks of commented out code
This commit is contained in:
commit
70a5f2dde8
2 changed files with 0 additions and 167 deletions
|
@ -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 = []
|
||||
|
|
|
@ -217,164 +217,3 @@ class GetArtworkWorker(threading.Thread):
|
|||
|
||||
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 translate, 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=translate(33042)):
|
||||
return
|
||||
|
||||
log.info("Doing Image Cache Sync")
|
||||
|
||||
pdialog = xbmcgui.DialogProgress()
|
||||
pdialog.create(translate(29999), translate(33043))
|
||||
|
||||
# ask to rest all existing or not
|
||||
if dialog(type_="yesno", heading="{jellyfin}", line1=translate(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" % (translate(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" % (translate(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" % (translate(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" % (translate(33045), message))
|
||||
self.cache_texture(url[0])
|
||||
count += 1
|
||||
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue