mirror of
https://github.com/EDCD/EDDN.git
synced 2025-06-18 16:03:02 +03:00
Moved _Core/_Conf to core/conf and some UTF8 fixes
This commit is contained in:
parent
131b36ac3a
commit
2f72fe84fe
2
.gitignore
vendored
2
.gitignore
vendored
@ -52,5 +52,5 @@ docs/_build/
|
|||||||
|
|
||||||
# PyBuilder
|
# PyBuilder
|
||||||
target/
|
target/
|
||||||
*.prices
|
|
||||||
*.prices
|
*.prices
|
||||||
|
2
setup.py
2
setup.py
@ -3,7 +3,7 @@ import re
|
|||||||
import glob
|
import glob
|
||||||
|
|
||||||
|
|
||||||
VERSIONFILE = "src/eddn/_Conf/Version.py"
|
VERSIONFILE = "src/eddn/conf/Version.py"
|
||||||
verstr = "unknown"
|
verstr = "unknown"
|
||||||
try:
|
try:
|
||||||
verstrline = open(VERSIONFILE, "rt").read()
|
verstrline = open(VERSIONFILE, "rt").read()
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# coding: utf8
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Contains the necessary ZeroMQ socket and a helper function to publish
|
Contains the necessary ZeroMQ socket and a helper function to publish
|
||||||
market data to the Announcer daemons.
|
market data to the Announcer daemons.
|
||||||
@ -13,8 +15,8 @@ from datetime import datetime
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from eddn._Conf.Settings import Settings, loadConfig
|
from eddn.conf.Settings import Settings, loadConfig
|
||||||
from eddn._Core.Validator import Validator, ValidationSeverity
|
from eddn.core.Validator import Validator, ValidationSeverity
|
||||||
|
|
||||||
from gevent import monkey
|
from gevent import monkey
|
||||||
monkey.patch_all()
|
monkey.patch_all()
|
||||||
@ -29,7 +31,7 @@ sender = context.socket(zmq.PUB)
|
|||||||
validator = Validator()
|
validator = Validator()
|
||||||
|
|
||||||
# This import must be done post-monkey-patching!
|
# This import must be done post-monkey-patching!
|
||||||
from eddn._Core.StatsCollector import StatsCollector
|
from eddn.core.StatsCollector import StatsCollector
|
||||||
statsCollector = StatsCollector()
|
statsCollector = StatsCollector()
|
||||||
statsCollector.start()
|
statsCollector.start()
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# coding: utf8
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Monitor sit below gateways, or another relay, and simply parse what it receives over SUB.
|
Monitor sit below gateways, or another relay, and simply parse what it receives over SUB.
|
||||||
"""
|
"""
|
||||||
@ -10,13 +12,13 @@ import datetime
|
|||||||
import collections
|
import collections
|
||||||
import zmq.green as zmq
|
import zmq.green as zmq
|
||||||
from bottle import get, request, response, run as bottle_run
|
from bottle import get, request, response, run as bottle_run
|
||||||
from eddn._Conf.Settings import Settings, loadConfig
|
from eddn.conf.Settings import Settings, loadConfig
|
||||||
|
|
||||||
from gevent import monkey
|
from gevent import monkey
|
||||||
monkey.patch_all()
|
monkey.patch_all()
|
||||||
|
|
||||||
if Settings.RELAY_DUPLICATE_MAX_MINUTES:
|
if Settings.RELAY_DUPLICATE_MAX_MINUTES:
|
||||||
from eddn._Core.DuplicateMessages import DuplicateMessages
|
from eddn.core.DuplicateMessages import DuplicateMessages
|
||||||
duplicateMessages = DuplicateMessages()
|
duplicateMessages = DuplicateMessages()
|
||||||
duplicateMessages.start()
|
duplicateMessages.start()
|
||||||
|
|
||||||
@ -42,7 +44,7 @@ def getTotalSoftwares():
|
|||||||
results = db.execute(query)
|
results = db.execute(query)
|
||||||
|
|
||||||
for row in results:
|
for row in results:
|
||||||
softwares[str(row[0])] = str(row[1])
|
softwares[row[0].encode('utf8')] = str(row[1])
|
||||||
|
|
||||||
db.close()
|
db.close()
|
||||||
|
|
||||||
@ -64,10 +66,10 @@ def getSoftwares():
|
|||||||
results = db.execute(query, (dateStart, dateEnd))
|
results = db.execute(query, (dateStart, dateEnd))
|
||||||
|
|
||||||
for row in results:
|
for row in results:
|
||||||
if not str(row[2]) in softwares.keys():
|
if not str(row[2].encode('utf8')) in softwares.keys():
|
||||||
softwares[str(row[2])] = collections.OrderedDict()
|
softwares[row[2].encode('utf8')] = collections.OrderedDict()
|
||||||
|
|
||||||
softwares[str(row[2])][str(row[0])] = str(row[1])
|
softwares[row[2].encode('utf8')][str(row[0])] = str(row[1])
|
||||||
|
|
||||||
db.close()
|
db.close()
|
||||||
|
|
||||||
@ -89,7 +91,7 @@ def getTotalUploaders():
|
|||||||
results = db.execute(query)
|
results = db.execute(query)
|
||||||
|
|
||||||
for row in results:
|
for row in results:
|
||||||
uploaders[str(row[0])] = str(row[1])
|
uploaders[row[0].encode('utf8')] = row[1]
|
||||||
|
|
||||||
db.close()
|
db.close()
|
||||||
|
|
||||||
@ -111,10 +113,10 @@ def getUploaders():
|
|||||||
results = db.execute(query, (dateStart, dateEnd))
|
results = db.execute(query, (dateStart, dateEnd))
|
||||||
|
|
||||||
for row in results:
|
for row in results:
|
||||||
if not str(row[2]) in uploaders.keys():
|
if not row[2].encode('utf8') in uploaders.keys():
|
||||||
uploaders[str(row[2])] = collections.OrderedDict()
|
uploaders[row[2].encode('utf8')] = collections.OrderedDict()
|
||||||
|
|
||||||
uploaders[str(row[2])][str(row[0])] = str(row[1])
|
uploaders[row[2]][row[0].encode('utf8')] = row[1]
|
||||||
|
|
||||||
db.close()
|
db.close()
|
||||||
|
|
||||||
@ -189,6 +191,7 @@ class Monitor(Thread):
|
|||||||
else:
|
else:
|
||||||
message = message[0]
|
message = message[0]
|
||||||
|
|
||||||
|
|
||||||
if Settings.RELAY_DUPLICATE_MAX_MINUTES:
|
if Settings.RELAY_DUPLICATE_MAX_MINUTES:
|
||||||
if duplicateMessages.isDuplicated(message):
|
if duplicateMessages.isDuplicated(message):
|
||||||
schemaID = 'DUPLICATE MESSAGE'
|
schemaID = 'DUPLICATE MESSAGE'
|
||||||
@ -206,15 +209,16 @@ class Monitor(Thread):
|
|||||||
json = simplejson.loads(message)
|
json = simplejson.loads(message)
|
||||||
|
|
||||||
# Update software count
|
# Update software count
|
||||||
softwareID = json['header']['softwareName'] + ' | ' + json['header']['softwareVersion']
|
softwareID = json['header']['softwareName'].encode('utf8') + ' | ' + json['header']['softwareVersion'].encode('utf8')
|
||||||
|
|
||||||
c = db.cursor()
|
c = db.cursor()
|
||||||
c.execute('UPDATE softwares SET hits = hits + 1 WHERE `name` = ? AND `dateStats` = DATE("now", "utc")', (softwareID, ))
|
c.execute('UPDATE softwares SET hits = hits + 1 WHERE `name` = ? AND `dateStats` = DATE("now", "utc")', (softwareID, ))
|
||||||
c.execute('INSERT OR IGNORE INTO softwares (name, dateStats) VALUES (?, DATE("now", "utc"))', (softwareID, ))
|
c.execute('INSERT OR IGNORE INTO softwares (name, dateStats) VALUES (?, DATE("now", "utc"))', (softwareID, ))
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
|
|
||||||
# Update uploader count
|
# Update uploader count
|
||||||
uploaderID = json['header']['uploaderID']
|
uploaderID = json['header']['uploaderID'].encode('utf8')
|
||||||
|
|
||||||
if uploaderID: # Don't get empty uploaderID
|
if uploaderID: # Don't get empty uploaderID
|
||||||
c = db.cursor()
|
c = db.cursor()
|
||||||
@ -222,6 +226,7 @@ class Monitor(Thread):
|
|||||||
c.execute('INSERT OR IGNORE INTO uploaders (name, dateStats) VALUES (?, DATE("now", "utc"))', (uploaderID, ))
|
c.execute('INSERT OR IGNORE INTO uploaders (name, dateStats) VALUES (?, DATE("now", "utc"))', (uploaderID, ))
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
|
|
||||||
# Update schemas count
|
# Update schemas count
|
||||||
schemaID = json['$schemaRef']
|
schemaID = json['$schemaRef']
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# coding: utf8
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Relays sit below an announcer, or another relay, and simply repeat what
|
Relays sit below an announcer, or another relay, and simply repeat what
|
||||||
they receive over PUB/SUB.
|
they receive over PUB/SUB.
|
||||||
@ -13,18 +15,18 @@ import gevent
|
|||||||
import simplejson
|
import simplejson
|
||||||
import zmq.green as zmq
|
import zmq.green as zmq
|
||||||
from bottle import get, response, run as bottle_run
|
from bottle import get, response, run as bottle_run
|
||||||
from eddn._Conf.Settings import Settings, loadConfig
|
from eddn.conf.Settings import Settings, loadConfig
|
||||||
|
|
||||||
from gevent import monkey
|
from gevent import monkey
|
||||||
monkey.patch_all()
|
monkey.patch_all()
|
||||||
|
|
||||||
from eddn._Core.StatsCollector import StatsCollector
|
from eddn.core.StatsCollector import StatsCollector
|
||||||
|
|
||||||
statsCollector = StatsCollector()
|
statsCollector = StatsCollector()
|
||||||
statsCollector.start()
|
statsCollector.start()
|
||||||
|
|
||||||
if Settings.RELAY_DUPLICATE_MAX_MINUTES:
|
if Settings.RELAY_DUPLICATE_MAX_MINUTES:
|
||||||
from eddn._Core.DuplicateMessages import DuplicateMessages
|
from eddn.core.DuplicateMessages import DuplicateMessages
|
||||||
duplicateMessages = DuplicateMessages()
|
duplicateMessages = DuplicateMessages()
|
||||||
duplicateMessages.start()
|
duplicateMessages.start()
|
||||||
|
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
'''
|
# coding: utf8
|
||||||
Created on 15 Nov 2014
|
|
||||||
|
|
||||||
@author: james
|
|
||||||
'''
|
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import simplejson
|
import simplejson
|
||||||
from eddn._Conf.Version import __version__ as version
|
from eddn.conf.Version import __version__ as version
|
||||||
|
|
||||||
|
|
||||||
class _Settings(object):
|
class _Settings(object):
|
@ -1 +1,3 @@
|
|||||||
|
# coding: utf8
|
||||||
|
|
||||||
__version__ = "0.4"
|
__version__ = "0.4"
|
@ -1,10 +1,12 @@
|
|||||||
|
# coding: utf8
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from threading import Lock, Thread
|
from threading import Lock, Thread
|
||||||
from time import sleep
|
from time import sleep
|
||||||
import hashlib
|
import hashlib
|
||||||
import zlib
|
import zlib
|
||||||
import simplejson
|
import simplejson
|
||||||
from eddn._Conf.Settings import Settings, loadConfig
|
from eddn.conf.Settings import Settings, loadConfig
|
||||||
|
|
||||||
|
|
||||||
class DuplicateMessages(Thread):
|
class DuplicateMessages(Thread):
|
@ -1,3 +1,5 @@
|
|||||||
|
# coding: utf8
|
||||||
|
|
||||||
from collections import deque
|
from collections import deque
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from itertools import islice
|
from itertools import islice
|
@ -1,3 +1,5 @@
|
|||||||
|
# coding: utf8
|
||||||
|
|
||||||
import simplejson
|
import simplejson
|
||||||
from enum import IntEnum
|
from enum import IntEnum
|
||||||
from jsonschema import validate as jsValidate, ValidationError
|
from jsonschema import validate as jsValidate, ValidationError
|
Loading…
x
Reference in New Issue
Block a user