Exemplo n.º 1
0
def get_connection():
    global connection

    if connection is None:

        connected = False

        # Create connection
        try:
            connection = libsonic_extra.SubsonicClient(
                Addon().get_setting('subsonic_url'),
                Addon().get_setting('username', convert=False),
                Addon().get_setting('password', convert=False),
                Addon().get_setting('apiversion'),
                Addon().get_setting('insecure') == 'true',
                Addon().get_setting('legacyauth') == 'true',
            )
            connected = connection.ping()
        except:
            pass

        if connected is False:
            popup('Connection error')
            return False

    return connection
Exemplo n.º 2
0
    def __init__(self, addon_url, addon_handle, addon_args):
        self.addon_url = addon_url
        self.addon_handle = addon_handle
        self.addon_args = addon_args

        # Retrieve plugin settings
        self.url = addon.getSetting("subsonic_url")
        self.username = addon.getSetting("username")
        self.password = addon.getSetting("password")

        self.random_count = addon.getSetting("random_count")
        self.bitrate = addon.getSetting("bitrate")
        self.transcode_format = addon.getSetting("transcode_format")

        # Create connection
        self.connection = libsonic_extra.SubsonicClient(
            self.url, self.username, self.password)
Exemplo n.º 3
0
    def __init__(self, addon_url, addon_handle, addon_args):
        self.addon_url = addon_url
        self.addon_handle = addon_handle
        self.addon_args = addon_args

        # Retrieve plugin settings
        self.url = addon.getSetting("subsonic_url")
        self.username = addon.getSetting("username")
        self.password = addon.getSetting("password")
        self.apiversion = addon.getSetting("apiversion")
        self.insecure = addon.getSetting("insecure") == "true"
        self.legacyauth = addon.getSetting("legacyauth") == "true"
        self.escapehtml = addon.getSetting("escapehtml") == "true"

        self.random_count = addon.getSetting("random_count")
        self.bitrate = addon.getSetting("bitrate")
        self.transcode_format = addon.getSetting("transcode_format")

        # Create connection
        self.connection = libsonic_extra.SubsonicClient(
            self.url, self.username, self.password, self.apiversion, self.insecure, self.legacyauth)