Browse Source

reload on GET /rpc/refresh

boyska 7 years ago
parent
commit
ac0f0d9469
3 changed files with 6 additions and 2 deletions
  1. 2 0
      doc/source/debug.rst
  2. 3 1
      larigira/mpc.py
  3. 1 1
      larigira/rpc.py

+ 2 - 0
doc/source/debug.rst

@@ -46,3 +46,5 @@ This is useful if you want to debug the event system, or if you manually
 changed the data on disk. Please note that the event system will automatically
 reload the DB from disk when appropriate. However, the WebUI will not, so you
 might have a misleading ``/db/list`` page; send an ``ALRM`` in this case.
+
+The same effect can be triggered performing an HTTP ``GET /rpc/refresh``.

+ 3 - 1
larigira/mpc.py

@@ -134,8 +134,10 @@ class Controller(gevent.Greenlet):
                 except Exception:
                     self.log.exception("Error while adding to queue; "
                                        "bad audiogen output?")
-            elif kind == 'signal' and args[0] == signal.SIGALRM:
+            elif (kind == 'signal' and args[0] == signal.SIGALRM) or \
+                    kind == 'refresh':
                 # it's a tick!
+                self.log.debug("Reload")
                 self.monitor.q.put(dict(kind='forcetick'))
                 gevent.Greenlet.spawn(self.player.check_playlist)
             else:

+ 1 - 1
larigira/rpc.py

@@ -38,7 +38,7 @@ def rpc_index():
 
 @rpc.route('/refresh')
 def rpc_refresh():
-    send_to_parent('rpc')
+    send_to_parent('refresh')
     return jsonify(dict(status='ok'))