Switch to unified view

a/src/mediaserver/cdplugins/uprcl/uprclutils.py b/src/mediaserver/cdplugins/uprcl/uprclutils.py
...
...
16
from __future__ import print_function
16
from __future__ import print_function
17
17
18
import sys
18
import sys
19
import urllib
19
import urllib
20
import os
20
import os
21
import subprocess
21
22
22
# This must be consistent with what contentdirectory.cxx does
23
# This must be consistent with what contentdirectory.cxx does
23
g_myprefix = '0$uprcl$'
24
g_myprefix = '0$uprcl$'
24
25
25
audiomtypes = frozenset([
26
audiomtypes = frozenset([
...
...
340
            tokens.append(curtok)
341
            tokens.append(curtok)
341
    elif state == INQUOTE or state == ESCAPE:
342
    elif state == INQUOTE or state == ESCAPE:
342
        raise Exception("Bad string: <" + str + ">")
343
        raise Exception("Bad string: <" + str + ">")
343
344
344
    return tokens
345
    return tokens
346
347
348
# Find first non loopback ip. This is surprisingly
349
# difficult. Executing "ip addr" actually seems to be the simplest
350
# approach, only works on Linux though (maybe bsd too ?)
351
def findmyip():
352
    data = subprocess.check_output(["ip", "addr"])
353
    l = data.split()
354
    ips = []
355
    chosenip = ""
356
    for i in range(len(l)):
357
        k = l[i]
358
        if k == 'inet':
359
            ipmask = l[i+1]
360
            if ipmask.find('127.') == 0:
361
                continue
362
            return ipmask.split('/')[0]
363