Switch to unified view

a/src/mediaserver/cdplugins/pycommon/upmplgutils.py b/src/mediaserver/cdplugins/pycommon/upmplgutils.py
...
...
167
    if upnpclass:
167
    if upnpclass:
168
        ret['upnp:class'] = upnpclass
168
        ret['upnp:class'] = upnpclass
169
    return ret
169
    return ret
170
170
171
# Get user and password from service, from the main configuration
171
# Get user and password from service, from the main configuration
172
# file, or possibly from the ohcredentials scratchpad. In the main
172
# file, or possibly from the ohcredentials scratchpad. In both files,
173
# file, the entries are like:
173
# the entries are like:
174
#    qobuzuser=xxx
174
#    qobuzuser=xxx
175
#    qobuzpass=yyy
175
#    qobuzpass=yyy
176
# In the ohcreds file, they are like:
177
#    [qobuz]
178
#    u=xxx
179
#    p=yyy
180
def getserviceuserpass(upconfig, servicename):
176
def getserviceuserpass(upconfig, servicename):
181
    username = upconfig.get(servicename + 'user')
177
    username = upconfig.get(servicename + 'user')
182
    password = upconfig.get(servicename + 'pass')
178
    password = upconfig.get(servicename + 'pass')
183
    if not username or not password:
179
    if not username or not password:
184
        altconf = conftree.ConfSimple('/var/cache/upmpdcli/ohcreds/screds')
180
        altconf = conftree.ConfSimple('/var/cache/upmpdcli/ohcreds/screds')
185
        username = altconf.get('u', servicename)
181
        username = altconf.get(servicename + 'user')
186
        password = altconf.get('p', servicename)
182
        password = altconf.get(servicename + 'pass')
187
    return username, password
183
    return username, password
188
184
189
def uplog(s):
185
def uplog(s):
190
    if not type(s) == type(b''):
186
    if not type(s) == type(b''):
191
        s = ("%s: %s" % (_idprefix, s)).encode('utf-8')
187
        s = ("%s: %s" % (_idprefix, s)).encode('utf-8')