From be79dc188822a23ca9b50a8fe644094d59a397cf Mon Sep 17 00:00:00 2001 From: Krateng Date: Sat, 20 Jun 2020 17:52:26 +0200 Subject: [PATCH] Reorganized tasks --- maloja/proccontrol/control.py | 8 ++++---- maloja/proccontrol/{tasks.py => tasks/__init__.py} | 11 ++++++----- maloja/{ => proccontrol/tasks}/backup.py | 2 +- maloja/{ => proccontrol/tasks}/fixexisting.py | 4 ++-- maloja/{ => proccontrol/tasks}/lastfmconverter.py | 4 ++-- 5 files changed, 15 insertions(+), 14 deletions(-) rename maloja/proccontrol/{tasks.py => tasks/__init__.py} (81%) rename maloja/{ => proccontrol/tasks}/backup.py (95%) rename maloja/{ => proccontrol/tasks}/fixexisting.py (96%) rename maloja/{ => proccontrol/tasks}/lastfmconverter.py (96%) diff --git a/maloja/proccontrol/control.py b/maloja/proccontrol/control.py index 30c3a3c..d0cf53e 100644 --- a/maloja/proccontrol/control.py +++ b/maloja/proccontrol/control.py @@ -6,6 +6,7 @@ import os import signal from .setup import setup +from . import tasks def getInstance(): try: @@ -82,11 +83,10 @@ def main(action,*args,**kwargs): "run":direct, "debug":direct, - # "import":loadlastfm, - - # "backup":backuphere, + "import":tasks.loadlastfm, + "backup":tasks.backuphere, # "update":update, - # "fix":fixdb + "fix":tasks.fixdb } if action in actions: actions[action](*args,**kwargs) else: print("Valid commands: " + " ".join(a for a in actions)) diff --git a/maloja/proccontrol/tasks.py b/maloja/proccontrol/tasks/__init__.py similarity index 81% rename from maloja/proccontrol/tasks.py rename to maloja/proccontrol/tasks/__init__.py index f67798c..daaf86f 100644 --- a/maloja/proccontrol/tasks.py +++ b/maloja/proccontrol/tasks/__init__.py @@ -1,9 +1,10 @@ import os -from ..lastfmconverter import convert -from ..backup import backup -from ..fixexisting import fix -from ..globalconf import datadir -from .control import restart +from .lastfmconverter import convert +from .backup import backup +from .fixexisting import fix + +from ...globalconf import datadir +from ..control import restart from doreah.io import ask def loadlastfm(filename): diff --git a/maloja/backup.py b/maloja/proccontrol/tasks/backup.py similarity index 95% rename from maloja/backup.py rename to maloja/proccontrol/tasks/backup.py index 3a7e9da..9be8281 100644 --- a/maloja/backup.py +++ b/maloja/proccontrol/tasks/backup.py @@ -2,7 +2,7 @@ import tarfile from datetime import datetime import glob import os -from .globalconf import datadir +from ...globalconf import datadir user_files = { diff --git a/maloja/fixexisting.py b/maloja/proccontrol/tasks/fixexisting.py similarity index 96% rename from maloja/fixexisting.py rename to maloja/proccontrol/tasks/fixexisting.py index b0c39a3..35ca8af 100644 --- a/maloja/fixexisting.py +++ b/maloja/proccontrol/tasks/fixexisting.py @@ -1,7 +1,7 @@ import os -from .globalconf import datadir +from ...globalconf import datadir import re -from .cleanup import CleanerAgent +from ...cleanup import CleanerAgent from doreah.logging import log import difflib import datetime diff --git a/maloja/lastfmconverter.py b/maloja/proccontrol/tasks/lastfmconverter.py similarity index 96% rename from maloja/lastfmconverter.py rename to maloja/proccontrol/tasks/lastfmconverter.py index 6a70d80..bb5a6dc 100644 --- a/maloja/lastfmconverter.py +++ b/maloja/proccontrol/tasks/lastfmconverter.py @@ -1,6 +1,6 @@ import os, datetime, re -from .cleanup import * -from .utilities import * +from ...cleanup import * +from ...utilities import *