Converted to ORM based on sqlalchemy

This commit is contained in:
th3r00t
2022-11-13 00:55:50 -05:00
parent d2dff3833a
commit fdf7a94061
8 changed files with 253 additions and 203 deletions

24
pyShelf.py vendored
View File

@@ -1,9 +1,10 @@
#!/usr/bin/env python3
"""PyShelf Entrypoint."""
import asyncio
import sys
from pathlib import Path
import websockets
# import websockets
from src.backend.lib.config import Config
from src.backend.pyShelf_MakeCollections import MakeCollections
@@ -18,18 +19,14 @@ tx = None
async def RunImport():
"""
Begin live import of books
"""
"""Begin live import of books."""
execute_scan(PRG_PATH, config=config)
MakeCollections(PRG_PATH, config=config)
return "Import Complete"
async def socketio(websocket, path):
"""
Web Socket Controller
"""
"""Web Socket Controller."""
async for message in websocket:
config.logger.info("Message Processing")
if message == "ping":
@@ -45,14 +42,13 @@ async def socketio(websocket, path):
def pong():
"""
Respond to incoming pings
"""
"""Respond to incoming pings."""
config.logger.info(">> Pong")
return "pong"
start_server = websockets.serve(socketio, "127.0.0.1", 1337)
asyncio.get_event_loop().run_until_complete(start_server)
asyncio.get_event_loop().run_forever()
asyncio.run(RunImport())
# start_server = websockets.serve(socketio, "127.0.0.1", 1337)
#
# asyncio.get_event_loop().run_until_complete(start_server)
# asyncio.get_event_loop().run_forever()