Continuing development

pull/292/head
morpheus65535 6 years ago
parent 005b78f350
commit 82793da436

@ -1,4 +1,6 @@
from get_argv import config_dir from get_argv import config_dir
from queue import q4ws
import datetime
import os import os
import sqlite3 import sqlite3
@ -9,6 +11,7 @@ from get_settings import get_general_settings
from list_subtitles import list_missing_subtitles from list_subtitles import list_missing_subtitles
def update_series(): def update_series():
q4ws.put("Update series list from Sonarr is running...")
from get_settings import get_sonarr_settings from get_settings import get_sonarr_settings
url_sonarr = get_sonarr_settings()[6] url_sonarr = get_sonarr_settings()[6]
apikey_sonarr = get_sonarr_settings()[4] apikey_sonarr = get_sonarr_settings()[4]
@ -51,6 +54,7 @@ def update_series():
series_to_add = [] series_to_add = []
for show in r.json(): for show in r.json():
q4ws.put("Getting data for this show: " + show['title'])
try: try:
overview = unicode(show['overview']) overview = unicode(show['overview'])
except: except:
@ -105,6 +109,8 @@ def update_series():
db.commit() db.commit()
db.close() db.close()
q4ws.put("Update series list from Sonarr is ended.")
def get_profile_list(): def get_profile_list():
from get_settings import get_sonarr_settings from get_settings import get_sonarr_settings
url_sonarr = get_sonarr_settings()[6] url_sonarr = get_sonarr_settings()[6]

@ -1,5 +1,7 @@
bazarr_version = '0.6.9' bazarr_version = '0.6.9'
from gevent import monkey; monkey.patch_all()
import gc import gc
gc.enable() gc.enable()
@ -20,6 +22,7 @@ from update_db import *
from notifier import update_notifier from notifier import update_notifier
update_notifier() update_notifier()
import queue
from get_settings import get_general_settings, get_proxy_settings from get_settings import get_general_settings, get_proxy_settings
import logging import logging
@ -1739,12 +1742,8 @@ def handle_websocket():
abort(400, 'Expected WebSocket request.') abort(400, 'Expected WebSocket request.')
while True: while True:
try: while not q4ws.empty():
message = wsock.receive() wsock.send(q4ws.get_nowait())
wsock.send("Your message was: %r" % message)
except WebSocketError:
break
import warnings import warnings
# Mute DeprecationWarning # Mute DeprecationWarning

@ -1,6 +1,8 @@
<html> <html>
<head> <head>
<!DOCTYPE html> <!DOCTYPE html>
<link href="{{base_url}}static/noty/noty.css" rel="stylesheet">
<script src="{{base_url}}static/noty/noty.min.js" type="text/javascript"></script>
<style> <style>
#divmenu { #divmenu {
background-color: #000000; background-color: #000000;
@ -211,6 +213,13 @@
<script type="text/javascript"> <script type="text/javascript">
var ws = new WebSocket("ws://" + window.location.host + "{{base_url}}websocket"); var ws = new WebSocket("ws://" + window.location.host + "{{base_url}}websocket");
ws.onmessage = function (evt) { ws.onmessage = function (evt) {
console.log(evt.data); new Noty({
text: evt.data,
timeout: 3000,
killer: true,
type: 'success',
layout: 'bottomRight',
theme: 'semanticui'
}).show();
}; };
</script> </script>
Loading…
Cancel
Save