def get_item_media_path(item_media_path): full_path = '' # Local image in ressources/media folder if type(item_media_path) is list: full_path = os.path.join(Script.get_info("path"), "resources", "media", *(item_media_path)) # Remote image with complete URL elif 'http' in item_media_path: full_path = item_media_path # Remote image on our images repo else: full_path = 'https://github.com/Catch-up-TV-and-More/images/raw/master/' + item_media_path return ensure_native_str(full_path)
# Kodi imports import xbmcplugin import xbmcgui # Package imports from codequick.script import Script from codequick.support import auto_sort, build_path, logger_id, dispatcher from codequick.utils import safe_path, ensure_unicode, ensure_native_str, unicode_type, long_type __all__ = ["Listitem", "Art", "Info", "Stream", "Context", "Property", "Params"] # Logger specific to this module logger = logging.getLogger("%s.listitem" % logger_id) # Listitem thumbnail locations local_image = ensure_native_str(os.path.join(Script.get_info("path"), u"resources", u"media", u"{}")) global_image = ensure_native_str(os.path.join(Script.get_info("path_global"), u"resources", u"media", u"{}")) # Prefetch fanart/icon for use later _fanart = Script.get_info("fanart") fanart = ensure_native_str(_fanart) if os.path.exists(safe_path(_fanart)) else None icon = ensure_native_str(Script.get_info("icon")) # Stream type map to ensure proper stream value types stream_type_map = {"duration": int, "channels": int, "aspect": float, "height": int, "width": int} # Listing sort methods & sort mappings.
import sys import os try: import cPickle as pickle except ImportError: # pragma: no cover import pickle # Package imports from codequick.script import Script from codequick.utils import ensure_unicode __all__ = ["PersistentDict", "PersistentList"] # The addon profile directory profile_dir = Script.get_info("profile") class _PersistentBase(object): """ Base class to handle persistent file handling. :param str name: Filename of persistence storage file. """ def __init__(self, name): super(_PersistentBase, self).__init__() self._version_string = "__codequick_storage_version__" self._data_string = "__codequick_storage_data__" self._serializer_obj = object self._stream = None
from codequick.utils import ensure_unicode, ensure_native_str, unicode_type, PY3, bold if PY3: # noinspection PyUnresolvedReferences, PyCompatibility from collections.abc import MutableMapping, MutableSequence else: # noinspection PyUnresolvedReferences, PyCompatibility from collections import MutableMapping, MutableSequence __all__ = ["Listitem"] # Logger specific to this module logger = logging.getLogger("%s.listitem" % logger_id) # Listitem thumbnail locations local_image = ensure_native_str(os.path.join(Script.get_info("path"), u"resources", u"media", u"{}")) global_image = ensure_native_str(os.path.join(Script.get_info("path_global"), u"resources", u"media", u"{}")) # Prefetch fanart/icon for use later _fanart = Script.get_info("fanart") fanart = ensure_native_str(_fanart) if os.path.exists(_fanart) else None icon = ensure_native_str(Script.get_info("icon")) # Stream type map to ensure proper stream value types stream_type_map = {"duration": int, "channels": int, "aspect": float, "height": int, "width": int} # Listing sort methods & sort mappings.
# Package imports from codequick.script import Script from codequick.utils import ensure_unicode, PY3 if PY3: # noinspection PyUnresolvedReferences, PyCompatibility from collections.abc import MutableMapping, MutableSequence else: # noinspection PyUnresolvedReferences, PyCompatibility from collections import MutableMapping, MutableSequence __all__ = ["PersistentDict", "PersistentList"] # The addon profile directory profile_dir = Script.get_info("profile") class _PersistentBase(object): """ Base class to handle persistent file handling. :param str name: Filename of persistence storage file. """ def __init__(self, name): super(_PersistentBase, self).__init__() self._version_string = "__codequick_storage_version__" self._data_string = "__codequick_storage_data__" self._serializer_obj = object self._stream = None
def get_item_media_path(item_media_path): full_path = os.path.join( Script.get_info("path"), "resources", "media", *(item_media_path)) return ensure_native_str(full_path)