parent
f94310fdb7
commit
0cbcf1a702
@ -1,3 +1,4 @@
|
|||||||
__pycache__
|
__pycache__
|
||||||
junk/
|
junk/
|
||||||
.vscode/launch.json
|
.vscode/launch.json
|
||||||
|
.ipynb_checkpoints/
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
from ffx.pattern_controller import PatternController
|
|
||||||
|
|
||||||
from ffx.model.show import Base
|
|
||||||
from sqlalchemy import create_engine, Column, Integer, String, ForeignKey
|
|
||||||
from sqlalchemy.orm import relationship, sessionmaker, Mapped, backref
|
|
||||||
|
|
||||||
filename = 'Boruto.Naruto.Next.Generations.S01E256.GerEngSub.AAC.1080p.WebDL.x264-Tanuki.mkv'
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Data 'input' variable
|
|
||||||
context = {}
|
|
||||||
|
|
||||||
# Initialize DB
|
|
||||||
homeDir = os.path.expanduser("~")
|
|
||||||
ffxVarDir = os.path.join(homeDir, '.local', 'var', 'ffx')
|
|
||||||
if not os.path.exists(ffxVarDir):
|
|
||||||
os.makedirs(ffxVarDir)
|
|
||||||
|
|
||||||
context['database_url'] = f"sqlite:///{os.path.join(ffxVarDir, 'ffx.db')}"
|
|
||||||
context['database_engine'] = create_engine(context['database_url'])
|
|
||||||
context['database_session'] = sessionmaker(bind=context['database_engine'])
|
|
||||||
|
|
||||||
Base.metadata.create_all(context['database_engine'])
|
|
||||||
|
|
||||||
|
|
||||||
pc = PatternController(context)
|
|
||||||
|
|
||||||
|
|
||||||
print(pc.matchFilename(filename))
|
|
@ -1,6 +0,0 @@
|
|||||||
from ffx.helper import dictDiff
|
|
||||||
|
|
||||||
a = {'name': 'yolo', 'mass': 56}
|
|
||||||
b = {'name': 'zolo', 'mass': 58}
|
|
||||||
|
|
||||||
print(dictDiff(a, b))
|
|
@ -0,0 +1,48 @@
|
|||||||
|
import os, json
|
||||||
|
|
||||||
|
class ConfigurationController():
|
||||||
|
|
||||||
|
CONFIG_FILENAME = 'ffx.json'
|
||||||
|
DATABASE_FILENAME = 'ffx.db'
|
||||||
|
LOG_FILENAME = 'ffx.log'
|
||||||
|
|
||||||
|
DATABASE_PATH_CONFIG_KEY = 'databasePath'
|
||||||
|
LOG_DIRECTORY_CONFIG_KEY = 'logDirectory'
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
|
||||||
|
self.__homeDir = os.path.expanduser("~")
|
||||||
|
self.__localVarDir = os.path.join(self.__homeDir, '.local', 'var')
|
||||||
|
self.__localEtcDir = os.path.join(self.__homeDir, '.local', 'etc')
|
||||||
|
|
||||||
|
self.__configurationData = {}
|
||||||
|
|
||||||
|
# .local/etc/ffx.json
|
||||||
|
self.__configFilePath = os.path.join(self.__localEtcDir, ConfigurationController.CONFIG_FILENAME)
|
||||||
|
if os.path.isfile(self.__configFilePath):
|
||||||
|
with open(self.__configFilePath, 'r') as configurationFile:
|
||||||
|
self.__configurationData = json.load(configurationFile)
|
||||||
|
|
||||||
|
if ConfigurationController.DATABASE_PATH_CONFIG_KEY in self.__configurationData.keys():
|
||||||
|
self.__databaseFilePath = self.__configurationData[ConfigurationController.DATABASE_PATH_CONFIG_KEY]
|
||||||
|
os.makedirs(os.path.dirname(self.__databaseFilePath), exist_ok=True)
|
||||||
|
else:
|
||||||
|
ffxVarDir = os.path.join(self.__localVarDir, 'ffx')
|
||||||
|
os.makedirs(ffxVarDir, exist_ok=True)
|
||||||
|
self.__databaseFilePath = os.path.join(ffxVarDir, ConfigurationController.DATABASE_FILENAME)
|
||||||
|
|
||||||
|
if ConfigurationController.LOG_DIRECTORY_CONFIG_KEY in self.__configurationData.keys():
|
||||||
|
self.__logDir = self.__configurationData[ConfigurationController.LOG_DIRECTORY_CONFIG_KEY]
|
||||||
|
else:
|
||||||
|
self.__logDir = os.path.join(self.__localVarDir, 'log')
|
||||||
|
os.makedirs(self.__logDir, exist_ok=True)
|
||||||
|
|
||||||
|
|
||||||
|
def getHomeDirectory(self):
|
||||||
|
return self.__homeDir
|
||||||
|
|
||||||
|
def getLogFilePath(self):
|
||||||
|
return os.path.join(self.__logDir, ConfigurationController.LOG_FILENAME)
|
||||||
|
|
||||||
|
def getDatabaseFilePath(self):
|
||||||
|
return self.__databaseFilePath
|
@ -1,16 +0,0 @@
|
|||||||
from textual.app import App, ComposeResult
|
|
||||||
from textual.screen import Screen
|
|
||||||
from textual.widgets import Header, Footer, Placeholder, Label
|
|
||||||
|
|
||||||
class DashboardScreen(Screen):
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
super().__init__()
|
|
||||||
|
|
||||||
context = self.app.getContext()
|
|
||||||
context['dashboard'] = 'dashboard'
|
|
||||||
|
|
||||||
def compose(self) -> ComposeResult:
|
|
||||||
yield Header(show_clock=True)
|
|
||||||
yield Placeholder("Dashboard Screen")
|
|
||||||
yield Footer()
|
|
@ -1,11 +0,0 @@
|
|||||||
from textual.app import App, ComposeResult
|
|
||||||
from textual.screen import Screen
|
|
||||||
from textual.widgets import Header, Footer, Placeholder, Label
|
|
||||||
|
|
||||||
class WarningScreen(Screen):
|
|
||||||
def __init__(self):
|
|
||||||
super().__init__()
|
|
||||||
context = self.app.getContext()
|
|
||||||
def compose(self) -> ComposeResult:
|
|
||||||
yield Label("Warning! This file is not compliant to the defined source schema!")
|
|
||||||
yield Footer()
|
|
@ -1,52 +0,0 @@
|
|||||||
#! /usr/bin/python3
|
|
||||||
|
|
||||||
import logging
|
|
||||||
|
|
||||||
logger = logging.getLogger('FFX')
|
|
||||||
logger.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
testLogger = logging.getLogger('FFX Test')
|
|
||||||
testLogger.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
|
|
||||||
# create file handler that logs debug and higher level messages
|
|
||||||
ffxFileHandler = logging.FileHandler('ffx.log')
|
|
||||||
ffxFileHandler.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
# create file handler that logs debug and higher level messages
|
|
||||||
ffxTestReportFileHandler = logging.FileHandler('ffx_test_report.log')
|
|
||||||
ffxTestReportFileHandler.setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
# create console handler with a higher log level
|
|
||||||
ffxConsoleHandler = logging.StreamHandler()
|
|
||||||
#ffxConsoleHandler.setLevel(logging.ERROR)
|
|
||||||
|
|
||||||
# create formatter and add it to the handlers
|
|
||||||
formatter = logging.Formatter(
|
|
||||||
'%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
|
||||||
ffxConsoleHandler.setFormatter(formatter)
|
|
||||||
ffxFileHandler.setFormatter(formatter)
|
|
||||||
|
|
||||||
|
|
||||||
# add the handlers to logger
|
|
||||||
testLogger.addHandler(ffxConsoleHandler)
|
|
||||||
|
|
||||||
|
|
||||||
logger.addHandler(ffxConsoleHandler)
|
|
||||||
logger.addHandler(ffxFileHandler)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
logger.debug('debug message')
|
|
||||||
logger.info('info message')
|
|
||||||
logger.warning('warn message')
|
|
||||||
logger.error('error message')
|
|
||||||
logger.critical('critical message')
|
|
||||||
|
|
||||||
|
|
||||||
testLogger.info('TEST: info message')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
click / consoleLogger
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
import itertools
|
|
||||||
|
|
||||||
class c1():
|
|
||||||
def getYield():
|
|
||||||
for i in range(3):
|
|
||||||
yield i
|
|
||||||
|
|
||||||
class c2():
|
|
||||||
def getYield():
|
|
||||||
for i in range(5):
|
|
||||||
yield i
|
|
||||||
|
|
||||||
class c3():
|
|
||||||
def getYield():
|
|
||||||
for i in range(7):
|
|
||||||
yield i
|
|
||||||
sc = {}
|
|
||||||
sc['y1'] = c1
|
|
||||||
sc['y2'] = c2
|
|
||||||
sc['y3'] = c3
|
|
||||||
|
|
||||||
sc_list = [(k,v) for k,v in sc.items()]
|
|
||||||
|
|
||||||
y = []
|
|
||||||
for p in itertools.product(*[v.getYield() for k,v in sc_list]):
|
|
||||||
z = {}
|
|
||||||
for i in range(len(p)):
|
|
||||||
z[sc_list[i][0]] = p[i]
|
|
||||||
y.append(z)
|
|
||||||
print(y)
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue