Ejemplo n.º 1
0
 def onSettingsChanged(self):
     self._api = Torrest(get_service_ip(), get_port())
     self._enabled = show_background_progress()
Ejemplo n.º 2
0
import routing
from xbmc import Monitor, executebuiltin, getInfoLabel, getCondVisibility, sleep
from xbmcgui import ListItem, DialogProgress, Dialog
from xbmcplugin import addDirectoryItem, endOfDirectory, setResolvedUrl

from lib.api import Torrest
from lib.dialog import DialogInsert
from lib.kodi import ADDON_PATH, ADDON_NAME, translate, notification, set_logger, refresh, show_picture
from lib.kodi_formats import is_music, is_picture, is_video, is_text
from lib.player import TorrestPlayer
from lib.settings import get_service_ip, get_port, get_buffering_timeout, show_status_overlay, get_min_candidate_size, \
    ask_to_delete_torrent, download_after_insert, get_files_order

set_logger()
plugin = routing.Plugin()
api = Torrest(get_service_ip(), get_port())


class PlayError(Exception):
    pass


def check_playable(func):
    def wrapper(*args, **kwargs):
        try:
            func(*args, **kwargs)
        except Exception as e:
            setResolvedUrl(plugin.handle, False, ListItem())
            if isinstance(e, PlayError):
                logging.debug(e)
            else: