From 2d13d4ea8ac2778734c53558d686a1c69e6911d5 Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Tue, 28 Mar 2023 15:18:19 +0200 Subject: [PATCH] checl + all. fix. all=valid (updated only). again=ALL valid --- src/var/lib/tyto/program/check.py | 24 ++++++++++++++---------- src/var/lib/tyto/program/db.py | 2 ++ src/var/lib/tyto/program/infos.py | 8 ++++---- src/var/lib/tyto/program/logs.py | 2 +- src/var/lib/tyto/translations/logs_en.py | 1 + src/var/lib/tyto/translations/logs_fr.py | 1 + 6 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/var/lib/tyto/program/check.py b/src/var/lib/tyto/program/check.py index d2e16eb..556413a 100644 --- a/src/var/lib/tyto/program/check.py +++ b/src/var/lib/tyto/program/check.py @@ -63,10 +63,8 @@ def manage(target): # target needed if not target: logs.out("5", args.action, True) - - elif not db.post: - sys.exit(1) - + + # Already check elif not target in args.multi_chk \ and db.exists \ and not db.old_chk: @@ -81,8 +79,13 @@ def manage(target): return check_process(target) + # All elif target in args.multi_chk: check_all(target) + + # No file found + elif not db.post: + sys.exit(1) else: check_process(target) @@ -99,16 +102,17 @@ def manage(target): def check_all(option): found = False - for post_db in os.listdir(db.articles_db): - if post_db.endswith('.conf'): + for post_db in os.listdir(dom.articles_db_d): + if post_db.endswith('.config'): # Load DB - post_db = '%s%s'%(db.articles_db, post_db) + post_db = '%s%s'%(dom.articles_db_d, post_db) exec(open(post_db).read(),globals()) args.target = post_src.rsplit('%s/'%db.in_dir)[1] importlib.reload(db) + #print(':> [%s] - %s'%(db.title, db.post_src)) - if not db.db_exists: continue - if option == 'again' and not db.old_chk: continue + if not db.exists: continue + if option == 'all' and not db.old_chk: continue found = True print(':> [%s] - %s'%(db.title, db.post_src)) @@ -116,7 +120,7 @@ def check_all(option): if post_err: logs.out("44", args.target, False) - if not found: logs.out("28", '(check)', True) + if not found: logs.out("28", args.action, True) #========================# diff --git a/src/var/lib/tyto/program/db.py b/src/var/lib/tyto/program/db.py index b1ae779..deec7f3 100644 --- a/src/var/lib/tyto/program/db.py +++ b/src/var/lib/tyto/program/db.py @@ -26,6 +26,8 @@ remove = exists = post = corrupt = False try: in_dir = os.getcwd() except: logs.out("13", '', True) +in_dir = os.getcwd() + if args.target \ and args.action in args.pass_db \ and not args.target in args.pass_targets: diff --git a/src/var/lib/tyto/program/infos.py b/src/var/lib/tyto/program/infos.py index 621d705..c95fd19 100644 --- a/src/var/lib/tyto/program/infos.py +++ b/src/var/lib/tyto/program/infos.py @@ -72,11 +72,11 @@ def tyto(target): ' wip : Create page in wip server\n' ' publish : Create page in www server\n\n' ' - [target] according to [action]\n' - ' all : Convert all already converted articles\n' - ' again : convert only converted articles and matches' - ' newer : convert only newer articles' + ' all : process (updated) valid articles\n' + ' again : process ALL valid articles\n' + ' newer : [wip/publish] convert only newer articles\n' ' template: - Create navbar/sidebar/metas/footer in www server\n' - ' - Copy wip/template/ files to www server\n' + ' - Copy other wip/template/ files to www server\n' ' domain : Create/Show config file\n' ' [file] : URI of an article\'s file (autocompletion is your friend)\n' ' footer : Create/Show footer HTML config\'s file\n' diff --git a/src/var/lib/tyto/program/logs.py b/src/var/lib/tyto/program/logs.py index 9ff1ea7..c7229de 100644 --- a/src/var/lib/tyto/program/logs.py +++ b/src/var/lib/tyto/program/logs.py @@ -72,7 +72,7 @@ def out(nbr, value, out): '41' : ' ╒ %s%s%s > "%s"'%(CR, lang.dom_inc, CS, value), '42' : ' ╒ %s%s%s > "%s"'%(CG, lang.dom_act, CS, value), '43' : ' ╒ %s%s%s'%(CY, lang.dom_no, CS), - '44' : ' ╞ %sCheck again manually%s "tyto check %s"'%(CY, CS, value), + '44' : ' ╞ %s%s%s "tyto check %s"'%(CY, lang.check_m, CS, value), '51' : ' ╞ %s%s%s > %s'%(CY, lang.data_inc, CS, value), '255' : ' ╘ %s'%lang.laterout } diff --git a/src/var/lib/tyto/translations/logs_en.py b/src/var/lib/tyto/translations/logs_en.py index 03cbeab..baafdf8 100644 --- a/src/var/lib/tyto/translations/logs_en.py +++ b/src/var/lib/tyto/translations/logs_en.py @@ -33,6 +33,7 @@ dir_c = "Directory created" dir_e = "Directory exists" check_on = "Article was check the" +check_m = "Check manually" post_inc = "Unused in article" post_inv = "Article not valid" post_val = "Article is valid" diff --git a/src/var/lib/tyto/translations/logs_fr.py b/src/var/lib/tyto/translations/logs_fr.py index bf5ee0b..3823509 100644 --- a/src/var/lib/tyto/translations/logs_fr.py +++ b/src/var/lib/tyto/translations/logs_fr.py @@ -33,6 +33,7 @@ dir_c = "Dossier créé" dir_e = "Dossier présent" check_on = "Article vérifié le" +check_m = "Vérifier manuellement" post_inc = "Donnée manquante dans l'article" post_inv = "Article non valide" post_val = "Article valide"