Clean out entrypoint.py

This commit is contained in:
tomkat83 2017-01-24 19:59:38 +01:00
parent b1f6bd1edf
commit a716f8a2c1
3 changed files with 276 additions and 509 deletions

View file

@ -10,11 +10,10 @@ from threading import Thread
from Queue import Queue, Empty from Queue import Queue, Empty
from xbmc import executeJSONRPC, sleep, translatePath from xbmc import executeJSONRPC, sleep, translatePath
from xbmcgui import Dialog
from xbmcvfs import listdir, delete from xbmcvfs import listdir, delete
from utils import window, settings, language as lang, kodiSQL, tryEncode, \ from utils import window, settings, language as lang, kodiSQL, tryEncode, \
tryDecode, IfExists, ThreadMethods, ThreadMethodsAdditionalStop tryDecode, IfExists, ThreadMethods, ThreadMethodsAdditionalStop, dialog
# Disable annoying requests warnings # Disable annoying requests warnings
import requests.packages.urllib3 import requests.packages.urllib3
@ -251,15 +250,13 @@ class Artwork():
This method will sync all Kodi artwork to textures13.db This method will sync all Kodi artwork to textures13.db
and cache them locally. This takes diskspace! and cache them locally. This takes diskspace!
""" """
if not Dialog().yesno( if not dialog('yesno', "Image Texture Cache", lang(39250)):
"Image Texture Cache", lang(39250)):
return return
log.info("Doing Image Cache Sync") log.info("Doing Image Cache Sync")
# ask to rest all existing or not # ask to rest all existing or not
if Dialog().yesno( if dialog('yesno', "Image Texture Cache", lang(39251)):
"Image Texture Cache", lang(39251), ""):
log.info("Resetting all cache data first") log.info("Resetting all cache data first")
# Remove all existing textures first # Remove all existing textures first
path = tryDecode(translatePath("special://thumbnails/")) path = tryDecode(translatePath("special://thumbnails/"))

File diff suppressed because it is too large Load diff

View file

@ -101,21 +101,40 @@ def dialog(typus, *args, **kwargs):
icon='{info}' xbmcgui.NOTIFICATION_INFO icon='{info}' xbmcgui.NOTIFICATION_INFO
icon='{warning}' xbmcgui.NOTIFICATION_WARNING icon='{warning}' xbmcgui.NOTIFICATION_WARNING
icon='{error}' xbmcgui.NOTIFICATION_ERROR icon='{error}' xbmcgui.NOTIFICATION_ERROR
Input Types:
type='{alphanum}' xbmcgui.INPUT_ALPHANUM (standard keyboard)
type='{numeric}' xbmcgui.INPUT_NUMERIC (format: #)
type='{date}' xbmcgui.INPUT_DATE (format: DD/MM/YYYY)
type='{time}' xbmcgui.INPUT_TIME (format: HH:MM)
type='{ipaddress}' xbmcgui.INPUT_IPADDRESS (format: #.#.#.#)
type='{password}' xbmcgui.INPUT_PASSWORD
(return md5 hash of input, input is masked)
""" """
d = xbmcgui.Dialog() d = xbmcgui.Dialog()
if "icon" in kwargs: if "icon" in kwargs:
repl = { types = {
'{plex}': 'special://home/addons/plugin.video.plexkodiconnect/icon.png', '{plex}': 'special://home/addons/plugin.video.plexkodiconnect/icon.png',
'{info}': xbmcgui.NOTIFICATION_INFO, '{info}': xbmcgui.NOTIFICATION_INFO,
'{warning}': xbmcgui.NOTIFICATION_WARNING, '{warning}': xbmcgui.NOTIFICATION_WARNING,
'{error}': xbmcgui.NOTIFICATION_ERROR '{error}': xbmcgui.NOTIFICATION_ERROR
} }
for key, value in repl.iteritems(): for key, value in types.iteritems():
kwargs['icon'] = kwargs['icon'].replace(key, value) kwargs['icon'] = kwargs['icon'].replace(key, value)
if 'type' in kwargs:
types = {
'{alphanum}': xbmcgui.INPUT_ALPHANUM,
'{numeric}': xbmcgui.INPUT_NUMERIC,
'{date}': xbmcgui.INPUT_DATE,
'{time}': xbmcgui.INPUT_TIME,
'{ipaddress}': xbmcgui.INPUT_IPADDRESS,
'{password}': xbmcgui.INPUT_PASSWORD
}
for key, value in types.iteritems():
kwargs['type'] = kwargs['type'].replace(key, value)
if "heading" in kwargs: if "heading" in kwargs:
kwargs['heading'] = kwargs['heading'].replace("{plex}", kwargs['heading'] = kwargs['heading'].replace("{plex}",
language(29999)) language(29999))
types = { types = {
'yesno': d.yesno, 'yesno': d.yesno,
'ok': d.ok, 'ok': d.ok,