Commit 4c66fbb1 authored by Jean-Francois Dockes's avatar Jean-Francois Dockes
Browse files

local media server: use the common logging function

parent 999e38a3
......@@ -168,6 +168,7 @@ def direntry(id, pid, title, arturi=None, artist=None, upnpclass=None):
def uplog(s):
if not type(s) == type(u''):
s = s.decode('utf-8', errors='replace')
print(("%s: %s" % (_idprefix, s)).encode('utf-8',errors='replace'),
file=sys.stderr)
......@@ -28,9 +28,12 @@ import uprcluntagged
import uprclsearch
import uprclindex
from upmplgutils import uplog, setidprefix
from uprclutils import uplog, g_myprefix, rcldirentry, waitentry
import uprclinit
setidprefix("uprcl")
#####
# Initialize communication with our parent process: pipe and method
# call dispatch
......
......@@ -54,7 +54,8 @@ import sys
import time
from timeit import default_timer as timer
from uprclutils import uplog, docarturi, audiomtypes, rcldirentry, \
from upmplgutils import uplog
from uprclutils import docarturi, audiomtypes, rcldirentry, \
rcldoctoentry, cmpentries
from recoll import recoll
from recoll import rclconfig
......
......@@ -21,7 +21,8 @@ import os
import time
import bottle
from uprclutils import uplog, embedded_open
from upmplgutils import uplog
from uprclutils import embedded_open
import uprclinit
@bottle.route('/')
......@@ -75,7 +76,7 @@ class Streamer(object):
bottle.response.set_header("Content-type", ctype)
bottle.response.set_header("Content-Length", size)
return f
uplog("Uprcl: streaming: %s" % os.path.join(self.root,filepath))
uplog("Streaming: %s" % os.path.join(self.root,filepath))
return bottle.static_file(filepath, root=self.root)
......
......@@ -25,7 +25,7 @@ import subprocess
import time
import copy
from uprclutils import uplog
from upmplgutils import uplog
def _initconfdir(confdir, topdirs):
if os.path.exists(confdir):
......
......@@ -31,7 +31,8 @@ import uprclsearch
import uprclindex
from uprclhttp import runbottle
from uprclutils import uplog, findmyip, stringToStrings
from upmplgutils import uplog
from uprclutils import findmyip, stringToStrings
try:
_s = g_httphp
......@@ -149,7 +150,7 @@ def _uprcl_init_worker():
_update_index()
uplog("Uprcl: init done")
uplog("Init done")
def uprcl_init():
global g_initrunning
......
......@@ -20,7 +20,8 @@ import re
import uprclfolders
from recoll import recoll
from uprclutils import uplog, stringToStrings, rcldoctoentry, cmpentries
from upmplgutils import uplog
from uprclutils import stringToStrings, rcldoctoentry, cmpentries
def _getchar(s, i):
if i < len(s):
......
......@@ -21,7 +21,8 @@ import time
import tempfile
from timeit import default_timer as timer
from uprclutils import g_myprefix, audiomtypes, docfolder, uplog, \
from upmplgutils import uplog
from uprclutils import g_myprefix, audiomtypes, docfolder, \
rcldirentry, rcldoctoentry, cmpentries
# After initialization, this holds the list of all records out of
......
......@@ -32,7 +32,8 @@ import shlex
import urllib
import sys
from uprclutils import uplog, rcldoctoentry, rcldirentry
from upmplgutils import uplog
from uprclutils import rcldoctoentry, rcldirentry
untg_prefix = '0$uprcl$untagged'
......
......@@ -25,6 +25,8 @@ try:
except ImportError:
from StringIO import StringIO
from upmplgutils import uplog
# This must be consistent with what contentdirectory.cxx does
g_myprefix = '0$uprcl$'
......@@ -302,12 +304,6 @@ def rcldirentry(id, pid, title, arturi=None, artist=None, upnpclass=None,
return ret
def uplog(s):
if not isinstance(s, unicode):
s = s.decode('utf-8', errors='replace')
print("%s: %s" % ('uprcl', s), file=sys.stderr)
# Parse string into (possibly multiword) tokens
# 'a b "one phrase" c' -> [a, b, 'one phrase', c]
def stringToStrings(str):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment