Convert to packagable format
This commit is contained in:
parent
fac258e5f3
commit
1e93db124d
|
@ -2,8 +2,8 @@
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
# Application imports
|
# Application imports
|
||||||
import cli
|
from inquisitor import cli
|
||||||
import configs
|
from inquisitor import configs
|
||||||
|
|
||||||
|
|
||||||
from signal import signal, SIGPIPE, SIG_DFL
|
from signal import signal, SIGPIPE, SIG_DFL
|
||||||
|
|
|
@ -6,9 +6,8 @@ import traceback
|
||||||
from flask import Flask, render_template, request, jsonify
|
from flask import Flask, render_template, request, jsonify
|
||||||
|
|
||||||
# Application imports
|
# Application imports
|
||||||
from configs import logger, DUNGEON_PATH
|
from inquisitor.configs import logger, DUNGEON_PATH
|
||||||
import loader
|
from inquisitor import loader, timestamp
|
||||||
import timestamp
|
|
||||||
|
|
||||||
# Globals
|
# Globals
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import os
|
||||||
import random
|
import random
|
||||||
|
|
||||||
# Application imports
|
# Application imports
|
||||||
from configs import logger, DUNGEON_PATH, SOURCES_PATH
|
from inquisitor.configs import logger, DUNGEON_PATH, SOURCES_PATH
|
||||||
|
|
||||||
|
|
||||||
def command_update(args):
|
def command_update(args):
|
||||||
|
@ -30,7 +30,7 @@ def command_update(args):
|
||||||
logger.error("Couldn't find sources. Set INQUISITOR_SOURCES or cd to parent folder of ./sources")
|
logger.error("Couldn't find sources. Set INQUISITOR_SOURCES or cd to parent folder of ./sources")
|
||||||
|
|
||||||
# Update sources
|
# Update sources
|
||||||
from importer import update_sources
|
from inquisitor.importer import update_sources
|
||||||
update_sources(*args.source)
|
update_sources(*args.source)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ def command_deactivate(args):
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
# Deactivate all items in each source.
|
# Deactivate all items in each source.
|
||||||
from loader import load_items
|
from inquisitor.loader import load_items
|
||||||
for source_name in args.source:
|
for source_name in args.source:
|
||||||
path = os.path.join(DUNGEON_PATH, source_name)
|
path = os.path.join(DUNGEON_PATH, source_name)
|
||||||
if not os.path.isdir(path):
|
if not os.path.isdir(path):
|
||||||
|
@ -112,7 +112,7 @@ def command_add(args):
|
||||||
logger.error("Source '{}' does not exist".format(source))
|
logger.error("Source '{}' does not exist".format(source))
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
from importer import populate_new
|
from inquisitor.importer import populate_new
|
||||||
item = {
|
item = {
|
||||||
'id': '{:x}'.format(random.getrandbits(16 * 4)),
|
'id': '{:x}'.format(random.getrandbits(16 * 4)),
|
||||||
'source': 'inquisitor'
|
'source': 'inquisitor'
|
||||||
|
@ -142,8 +142,8 @@ def command_feed(args):
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
import shutil
|
import shutil
|
||||||
import loader
|
from inquisitor import loader
|
||||||
import timestamp
|
from inquisitor import timestamp
|
||||||
|
|
||||||
items, errors = loader.load_active_items()
|
items, errors = loader.load_active_items()
|
||||||
if not items and not errors:
|
if not items and not errors:
|
||||||
|
@ -187,7 +187,7 @@ def command_feed(args):
|
||||||
def command_run(args):
|
def command_run(args):
|
||||||
"""Run the default Flask server."""
|
"""Run the default Flask server."""
|
||||||
try:
|
try:
|
||||||
from app import app
|
from inquisitor.app import app
|
||||||
app.run()
|
app.run()
|
||||||
return 0
|
return 0
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
@ -3,8 +3,8 @@ import logging
|
||||||
import json
|
import json
|
||||||
import random
|
import random
|
||||||
|
|
||||||
import timestamp
|
from inquisitor import timestamp
|
||||||
from configs import DUNGEON_PATH, logger
|
from inquisitor.configs import DUNGEON_PATH, logger
|
||||||
|
|
||||||
logger = logging.getLogger("inquisitor")
|
logger = logging.getLogger("inquisitor")
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,8 @@ import importlib.util
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import error
|
from inquisitor import loader, timestamp, error
|
||||||
from configs import SOURCES_PATH, DUNGEON_PATH, logger
|
from inquisitor.configs import SOURCES_PATH, DUNGEON_PATH, logger
|
||||||
import loader
|
|
||||||
import timestamp
|
|
||||||
|
|
||||||
def update_sources(*source_names):
|
def update_sources(*source_names):
|
||||||
sys.path.append(SOURCES_PATH)
|
sys.path.append(SOURCES_PATH)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from configs import DUNGEON_PATH
|
from inquisitor.configs import DUNGEON_PATH
|
||||||
import error
|
from inquisitor import error
|
||||||
|
|
||||||
class WritethroughDict():
|
class WritethroughDict():
|
||||||
"""A wrapper for a dictionary saved to the disk."""
|
"""A wrapper for a dictionary saved to the disk."""
|
||||||
|
|
Loading…
Reference in New Issue