fix debug vari
This commit is contained in:
parent
4401a29f04
commit
50c7a5ca61
3 changed files with 44 additions and 19 deletions
|
@ -1,17 +1,20 @@
|
|||
from __future__ import print_function
|
||||
from gevent import monkey
|
||||
|
||||
monkey.patch_all(subprocess=True)
|
||||
import logging
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import gevent
|
||||
from gevent import monkey
|
||||
from gevent.queue import Queue
|
||||
|
||||
from .eventutils import ParentedLet, Timer
|
||||
from .timegen import timegenerate
|
||||
from .audiogen import audiogenerate
|
||||
from .db import EventModel
|
||||
from .eventutils import ParentedLet, Timer
|
||||
from .timegen import timegenerate
|
||||
|
||||
monkey.patch_all(subprocess=True)
|
||||
|
||||
|
||||
|
||||
logging.getLogger("mpd").setLevel(logging.WARNING)
|
||||
|
||||
|
@ -75,9 +78,11 @@ class Monitor(ParentedLet):
|
|||
# but it is "tricky"; any small delay would cause the event to be
|
||||
# missed
|
||||
if delta is None:
|
||||
self.log.debug(
|
||||
"Skipping event %s: will never ring", alarm.get("nick", alarm.eid)
|
||||
)
|
||||
# this is way too much logging! we need more levels!
|
||||
# self.log.debug(
|
||||
# "Skipping event %s: will never ring", alarm.get("nick", alarm.eid)
|
||||
# )
|
||||
pass
|
||||
elif delta <= 2 * self.conf["EVENT_TICK_SECS"]:
|
||||
self.log.debug(
|
||||
"Scheduling event %s (%ds) => %s",
|
||||
|
|
|
@ -2,34 +2,37 @@
|
|||
This module is for the main application logic
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from gevent import monkey
|
||||
|
||||
monkey.patch_all(subprocess=True)
|
||||
|
||||
import sys
|
||||
import os
|
||||
import tempfile
|
||||
import signal
|
||||
from time import sleep
|
||||
import logging
|
||||
import logging.config
|
||||
import os
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from time import sleep
|
||||
|
||||
import gevent
|
||||
from gevent import monkey
|
||||
from gevent.pywsgi import WSGIServer
|
||||
|
||||
from .mpc import Controller, get_mpd_client
|
||||
from .config import get_conf
|
||||
from .mpc import Controller, get_mpd_client
|
||||
from .rpc import create_app
|
||||
|
||||
monkey.patch_all(subprocess=True)
|
||||
|
||||
|
||||
def on_main_crash(*args, **kwargs):
|
||||
print('A crash occurred in "main" greenlet. Aborting...')
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
|
||||
|
||||
class Larigira(object):
|
||||
def __init__(self):
|
||||
|
||||
self.log = logging.getLogger("larigira")
|
||||
self.conf = get_conf()
|
||||
self.controller = Controller(self.conf)
|
||||
|
@ -62,6 +65,7 @@ def main():
|
|||
)
|
||||
if not os.path.isdir(os.environ["TMPDIR"]):
|
||||
os.makedirs(os.environ["TMPDIR"])
|
||||
|
||||
if get_conf()["LOG_CONFIG"]:
|
||||
logging.config.fileConfig(
|
||||
get_conf()["LOG_CONFIG"], disable_existing_loggers=True
|
||||
|
@ -73,12 +77,26 @@ def main():
|
|||
format=log_format,
|
||||
datefmt="%H:%M:%S",
|
||||
)
|
||||
logging.addLevelName(9, "DEBUGV")
|
||||
|
||||
def debugv(self, message, *args, **kws):
|
||||
if self.isEnabledFor(9):
|
||||
self._log(9, message, args, **kws)
|
||||
|
||||
logging.Logger.debugv = debugv
|
||||
|
||||
if get_conf()["MPD_WAIT_START"]:
|
||||
|
||||
while True:
|
||||
try:
|
||||
get_mpd_client(get_conf())
|
||||
except Exception:
|
||||
logging.debug("Could not connect to MPD, waiting")
|
||||
except Exception as exc:
|
||||
print("exc", exc, file=sys.stderr)
|
||||
logging.debug(
|
||||
"Could not connect to MPD at (%s,%s), waiting",
|
||||
get_conf()["MPD_HOST"],
|
||||
get_conf()["MPD_PORT"],
|
||||
)
|
||||
sd_notify(status="Waiting MPD connection")
|
||||
sleep(int(get_conf()["MPD_WAIT_START_RETRYSECS"]))
|
||||
else:
|
||||
|
|
|
@ -157,6 +157,9 @@ class Player:
|
|||
reason = "Filtered by %s (%s)" % (entrypoint.name, reason)
|
||||
if ret is False:
|
||||
return ret, reason
|
||||
else:
|
||||
if reason:
|
||||
self.log.debug('filter %s says ok: %s', entrypoint.name, reason)
|
||||
return True, "Passed through %s" % ",".join(availfilters)
|
||||
|
||||
def enqueue(self, songs):
|
||||
|
@ -224,7 +227,6 @@ class Controller(gevent.Greenlet):
|
|||
gevent.Greenlet.spawn(self.player.check_playlist)
|
||||
while True:
|
||||
value = self.q.get()
|
||||
self.log.debug("<- %s", str(value))
|
||||
# emitter = value['emitter']
|
||||
kind = value["kind"]
|
||||
args = value["args"]
|
||||
|
|
Loading…
Reference in a new issue