Switch to unified view

a/src/mediaserver/cdplugins/qobuz/qobuz-app.py b/src/mediaserver/cdplugins/qobuz/qobuz-app.py
...
...
45
45
46
session = Session()
46
session = Session()
47
47
48
is_logged_in = False
48
is_logged_in = False
49
49
50
def maybelogin():
50
def maybelogin(a={}):
51
    global formatid
51
    global formatid
52
    global httphp
52
    global httphp
53
    global pathprefix
53
    global pathprefix
54
    global is_logged_in
54
    global is_logged_in
55
55
...
...
65
    if "UPMPD_PATHPREFIX" not in os.environ:
65
    if "UPMPD_PATHPREFIX" not in os.environ:
66
        raise Exception("No UPMPD_PATHPREFIX in environment")
66
        raise Exception("No UPMPD_PATHPREFIX in environment")
67
    pathprefix = os.environ["UPMPD_PATHPREFIX"]
67
    pathprefix = os.environ["UPMPD_PATHPREFIX"]
68
    if "UPMPD_CONFIG" not in os.environ:
68
    if "UPMPD_CONFIG" not in os.environ:
69
        raise Exception("No UPMPD_CONFIG in environment")
69
        raise Exception("No UPMPD_CONFIG in environment")
70
70
    upconfig = conftree.ConfSimple(os.environ["UPMPD_CONFIG"])
71
    upconfig = conftree.ConfSimple(os.environ["UPMPD_CONFIG"])
71
    
72
    username = upconfig.get('qobuzuser')
73
    password = upconfig.get('qobuzpass')
74
    formatid = upconfig.get('qobuzformatid')
72
    formatid = upconfig.get('qobuzformatid')
73
    if 'user' in a:
74
        username = a['user']
75
        password = a['password']
76
    else:
77
        username, password = getserviceuserpass(upconfig, 'qobuz')
78
      
75
    if formatid:
79
    if formatid:
76
        formatid = int(formatid)
80
        formatid = int(formatid)
77
    else:
81
    else:
78
        formatid = 5
82
        formatid = 5
79
    
83
    
...
...
84
88
85
    if not username or not password:
89
    if not username or not password:
86
        raise Exception("qobuzuser and/or qobuzpass not set in configuration")
90
        raise Exception("qobuzuser and/or qobuzpass not set in configuration")
87
91
88
    is_logged_in = session.login(username, password)
92
    is_logged_in = session.login(username, password)
93
94
95
# This is not used by the media server. It's for use by the OpenHome
96
# Credentials service
97
@dispatcher.record('login')
98
def login(a):
99
    maybelogin(a)
100
    appid, token = session.get_appid_and_token()
101
    return {'appid': appid, 'token' : token}
102
    
89
    
103
    
90
@dispatcher.record('trackuri')
104
@dispatcher.record('trackuri')
91
def trackuri(a):
105
def trackuri(a):
92
    global formatid, pathprefix
106
    global formatid, pathprefix
93
107