diff --git a/src/usr/bin/tyto b/src/usr/bin/tyto index 8d97ea0..7479021 100755 --- a/src/usr/bin/tyto +++ b/src/usr/bin/tyto @@ -50,13 +50,14 @@ actions = { # Dict for Options options = { - '-a' : 'Add', 'add' : 'Add', - '-R' : "Remove", 'remove' : "Remove", - '-n' : "New", 'new' : "New", - '-e' : "Edit", 'edit' : "Edit", - '-F' : "Force", 'force' : "Force", - '-s' : "Show", - '-d' : 'DB' + '-a' : 'Add', 'add' : 'Add', + '-R' : "Remove", 'remove' : "Remove", + '-n' : "New", 'new' : "New", + '-e' : "Edit", 'edit' : "Edit", + '-F' : "Force", 'force' : "Force", + '-s' : "Show", + '-d' : 'DB', + 'again': 'Again' } # Set Argument 2 or 3 diff --git a/src/var/lib/tyto/program/tyto.py b/src/var/lib/tyto/program/tyto.py index ad41223..c155ffd 100644 --- a/src/var/lib/tyto/program/tyto.py +++ b/src/var/lib/tyto/program/tyto.py @@ -28,7 +28,8 @@ arguments = ( '-e', 'edit', '-n', 'new', '-F', 'force', - '-d' + '-d', + 'again' ) # Settings diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py index 772e23c..3cbea08 100644 --- a/src/var/lib/tyto/program/wip.py +++ b/src/var/lib/tyto/program/wip.py @@ -20,6 +20,32 @@ import os, re import tyto, html def manage_wip(target, option): + global post_db, hash_post + + #----------------------------------------- + # Option 'Again' to wip again, based on DB + #----------------------------------------- + if option == 'Again': + ask = '' + ask = input(":? wip again all already converted articles ? ") + if not ask in ['y', 'Y']: + return + + # Load domain configuration DB + exec(open(tyto.domain_conf).read(),globals()) + for post_db in os.listdir(domain_db): + if post_db.endswith('.conf'): + # Load DB + post_db = '%s%s'%(domain_db, post_db) + exec(open(post_db).read(),globals()) + print("->", root_uri) + hash_post = tyto.get_filesum(post_db, True) # From content file + wip_article(root_uri) + return + + #------------------------ + # Per article with target + #------------------------ # target needed if not target: tyto.exiting("5", '', True) @@ -30,10 +56,12 @@ def manage_wip(target, option): tyto.exiting("4", '', True) # Load DB - exec(open(tyto.post_db).read(),globals()) + post_db = tyto.post_db + hash_post = tyto.hash_post + exec(open(post_db).read(),globals()) # Exit if article has changed - if hash_chk != tyto.hash_post: tyto.exiting("9", '', True) + if hash_chk != hash_post: tyto.exiting("9", '', True) # In any case, if Force if option == 'Force': @@ -91,11 +119,11 @@ def wip_article(target): print(article_bottom) # Get article DB in html.py - html.set_page(tyto.post_db) + html.set_page(post_db) print(html.main_page) # Replace in DB hash_wip and date_wip - tyto.replace_in_db(tyto.post_db, 'wip', tyto.hash_post) + tyto.replace_in_db(post_db, 'wip', hash_post) #=================================#