Switch to unified view

a/src/mediaserver/cdplugins/uprcl/uprclinit.py b/src/mediaserver/cdplugins/uprcl/uprclinit.py
...
...
76
        g_dblock.acquire_write()
76
        g_dblock.acquire_write()
77
        g_initrunning = False
77
        g_initrunning = False
78
        g_dblock.release_write()
78
        g_dblock.release_write()
79
79
80
80
81
# This runs in a thread because of the possibly long index initialization.
81
# Initialisation runs in a thread because of the possibly long index
82
# initialization, during which the main thread can answer
83
# "initializing..." to the clients.
82
def _uprcl_init_worker():
84
def _uprcl_init_worker():
83
85
84
    #######
86
    #######
85
    # Acquire configuration data.
87
    # Acquire configuration data.
86
    
88
    
...
...
94
    if "UPMPD_CONFIG" not in os.environ:
96
    if "UPMPD_CONFIG" not in os.environ:
95
        raise Exception("No UPMPD_CONFIG in environment")
97
        raise Exception("No UPMPD_CONFIG in environment")
96
    upconfig = conftree.ConfSimple(os.environ["UPMPD_CONFIG"])
98
    upconfig = conftree.ConfSimple(os.environ["UPMPD_CONFIG"])
97
99
98
    global g_friendlyname
100
    global g_friendlyname
99
    tmp = upconfig.get("friendlyname")
101
    if "UPMPD_FNAME" in os.environ:
100
    if tmp:
102
        g_friendlyname = os.environ["UPMPD_FNAME"]
101
        g_friendlyname = tmp + "-mediaserver"
102
103
103
    global g_httphp
104
    global g_httphp
104
    g_httphp = upconfig.get("uprclhostport")
105
    g_httphp = upconfig.get("uprclhostport")
105
    if g_httphp is None:
106
    if g_httphp is None:
106
        ip = findmyip()
107
        ip = findmyip()
...
...
149
    _update_index()
150
    _update_index()
150
151
151
    uplog("Uprcl: init done")
152
    uplog("Uprcl: init done")
152
153
153
def uprcl_init():
154
def uprcl_init():
154
    # This lock and counter are used as a read/write lock 
155
    global g_initrunning
155
    global g_initrunning
156
    g_initrunning = True
156
    g_initrunning = True
157
    initthread = threading.Thread(target=_uprcl_init_worker)
157
    initthread = threading.Thread(target=_uprcl_init_worker)
158
    initthread.daemon = True 
158
    initthread.daemon = True 
159
    initthread.start()
159
    initthread.start()