diff --git a/src/var/lib/tyto/program/check.py b/src/var/lib/tyto/program/check.py index 3cc37cb..5daf1c0 100644 --- a/src/var/lib/tyto/program/check.py +++ b/src/var/lib/tyto/program/check.py @@ -858,6 +858,6 @@ def create_database(): # Create Post DB #--------------- database = '%s\n%s\n%s'%(database, opt_tags, db_stats) - tyto.set_file(db.config, 'new', database) + tyto.set_file(db.config, 'New', database) logs.out("21", db.uri_file, False) diff --git a/src/var/lib/tyto/program/form.py b/src/var/lib/tyto/program/form.py index 82b472c..b597485 100644 --- a/src/var/lib/tyto/program/form.py +++ b/src/var/lib/tyto/program/form.py @@ -37,7 +37,6 @@ from datetime import datetime import os, sys, re, locale, importlib - import logs, dom, tyto, html, show, langs # locale translation directory @@ -184,7 +183,6 @@ def create_domain(target): # Start registering variables in domain database #----------------------------------------------- - global navbars_conf local_user = '%s/.local/tyto/%s/'%(dom.home_dir, shortname) modules_dir = '%s/articles/_configs/'%dom.folder footer_about_f = '%sfooter_about.html'%modules_dir @@ -215,7 +213,6 @@ def create_domain(target): 'wip_url = "%s"\n'%wip_url tyto.set_file(dom.config, True, set_f) - logs.out("32", dom.config, False) # Get srv root @@ -254,33 +251,34 @@ def create_domain(target): root_srv_dom = '%s/%s'%(srv, shortname) srv_wip_tpl = "%s/wip/template/"%root_srv_dom srv_www_tpl = "%s/www/template/"%root_srv_dom - set_f = '# Servers directories\n' + \ - 'srv_root = "%s/"\n'%srv + \ - 'srv_domain = "%s/"\n'%root_srv_dom + \ - 'srv_wip = "%s/wip/"\n'%root_srv_dom + \ - 'srv_wip_tpl_d = "%s"\n'%srv_wip_tpl + \ - 'srv_wip_images_d = "%s/wip/images/"\n'%root_srv_dom + \ - 'srv_wip_files_d = "%s/wip/files/"\n'%root_srv_dom + \ - 'srv_www = "%s/www/"\n'%root_srv_dom + \ - 'srv_www_tpl_d = "%s"\n'%srv_www_tpl + \ - 'srv_www_images_d = "%s/www/images/"\n'%root_srv_dom + \ - 'srv_www_files_d = "%s/www/files/"\n'%root_srv_dom + \ - '\n' + \ - '# Servers files (wip)\n' + \ - 'wip_logo_f = "%s%s"\n'%(srv_wip_tpl, logo) + \ - 'wip_css_f = "%sstyles.css"\n'%srv_wip_tpl + \ - 'wip_navbar_f = "%snavbar.html"\n'%srv_wip_tpl + \ - 'wip_sidebar_f = "%ssidebar.html"\n'%srv_wip_tpl + \ - 'wip_metas_f = "%smetas.html"\n'%srv_wip_tpl + \ - 'wip_footer_f = "%sfooter.html"\n'%srv_wip_tpl + \ - '\n' + \ - '# Servers files (www)\n' + \ - 'www_logo_f = "%s%s"\n'%(srv_www_tpl, logo) + \ - 'www_css_f = "%sstyles.css"\n'%srv_www_tpl + \ - 'www_navbar_f = "%snavbar.html"\n'%srv_www_tpl + \ - 'www_sidebar_f = "%ssidebar.html"\n'%srv_www_tpl + \ - 'www_metas_f = "%smetas.html"\n'%srv_www_tpl + \ - 'www_footer_f = "%sfooter.html"'%srv_www_tpl + set_f = \ + '# Servers directories\n' + \ + 'srv_root = "%s/"\n'%srv + \ + 'srv_domain = "%s/"\n'%root_srv_dom + \ + 'srv_wip = "%s/wip/"\n'%root_srv_dom + \ + 'srv_wip_tpl_d = "%s"\n'%srv_wip_tpl + \ + 'srv_wip_images_d = "%s/wip/images/"\n'%root_srv_dom + \ + 'srv_wip_files_d = "%s/wip/files/"\n'%root_srv_dom + \ + 'srv_www = "%s/www/"\n'%root_srv_dom + \ + 'srv_www_tpl_d = "%s"\n'%srv_www_tpl + \ + 'srv_www_images_d = "%s/www/images/"\n'%root_srv_dom + \ + 'srv_www_files_d = "%s/www/files/"\n'%root_srv_dom + \ + '\n' + \ + '# Servers files (wip)\n' + \ + 'wip_logo_f = "%s%s"\n'%(srv_wip_tpl, logo) + \ + 'wip_css_f = "%sstyles.css"\n'%srv_wip_tpl + \ + 'wip_navbar_f = "%snavbar.html"\n'%srv_wip_tpl + \ + 'wip_sidebar_f = "%ssidebar.html"\n'%srv_wip_tpl + \ + 'wip_metas_f = "%smetas.html"\n'%srv_wip_tpl + \ + 'wip_footer_f = "%sfooter.html"\n'%srv_wip_tpl + \ + '\n' + \ + '# Servers files (www)\n' + \ + 'www_logo_f = "%s%s"\n'%(srv_www_tpl, logo) + \ + 'www_css_f = "%sstyles.css"\n'%srv_www_tpl + \ + 'www_navbar_f = "%snavbar.html"\n'%srv_www_tpl + \ + 'www_sidebar_f = "%ssidebar.html"\n'%srv_www_tpl + \ + 'www_metas_f = "%smetas.html"\n'%srv_www_tpl + \ + 'www_footer_f = "%sfooter.html"'%srv_www_tpl tyto.set_file(dom.config, False, set_f) @@ -758,8 +756,7 @@ def create_metas(option): '\n' + \ '' - tyto.set_file(dom.metas_f, 'new', metas_tags) - logs.out("32", dom.metas_f, False) + tyto.set_file(dom.metas_f, 'New', metas_tags) # Create an empty html file in wip/www server if not exists if not tyto.exists(dom.wip_metas_f): @@ -820,8 +817,7 @@ def create_navbar(option): navbar_lang = navbar_lang%(tyto.Tyto, dom.navbar_f) - tyto.set_file(dom.navbar_f, 'new', navbar_lang) - logs.out("32", dom.navbar_f, False) + tyto.set_file(dom.navbar_f, 'New', navbar_lang) # Create wip navbar file html.create_navbar('wip') @@ -836,7 +832,6 @@ def create_sidebar(option): # Create an empty html file in wip/www server if not exists if not tyto.exists(dom.wip_sidebar_f): tyto.set_file(dom.wip_sidebar_f, 'new', '') - logs.out("32", dom.wip_sidebar_f, False) # Create new config file, or ask if exists with option = 'reset' if tyto.exists(dom.sidebar_f): @@ -887,8 +882,7 @@ def create_sidebar(option): dom.sidebar_items ) - tyto.set_file(dom.sidebar_f, 'new', sidebar_lang) - logs.out("32", dom.sidebar_f, False) + tyto.set_file(dom.sidebar_f, 'New', sidebar_lang) #=============================# @@ -1054,8 +1048,7 @@ def create_footer(option): if option == "form": return logs.out("255", '', True) - tyto.set_file(dom.footer_f, 'new', footer) - logs.out("32", dom.footer_f, False) + tyto.set_file(dom.footer_f, 'New', footer) # Create footer file in wip server if not exists if not tyto.exists(dom.wip_footer_f): @@ -1083,4 +1076,4 @@ def create_footer_about(option): '
'%dom.about tyto.set_file(dom.footer_about_f, False, set_f) - logs.out("32", dom.footer_about_f, False) + diff --git a/src/var/lib/tyto/program/html.py b/src/var/lib/tyto/program/html.py index fa68e76..b5385e2 100644 --- a/src/var/lib/tyto/program/html.py +++ b/src/var/lib/tyto/program/html.py @@ -270,8 +270,7 @@ def create_user_metas(option): if user_metas: user_metas = "%s\n%s%s"%(user_metas, tab, line) else: user_metas = '%s%s'%(tab, line) - tyto.set_file(target, True, user_metas) - logs.out("32", target, False) + tyto.set_file(target, 'New', user_metas) #==============================================# @@ -366,7 +365,6 @@ def create_navbar(option): if not navbar_items: if not tyto.exists(target): tyto.set_file(target, 'New', '') - logs.out("32", target, False) logs.out('28', '%s'%langs.log.navbar, False) return @@ -382,7 +380,6 @@ def create_navbar(option): ), True) tyto.set_file(target, 'New', menu_html) - logs.out("32", target, False) #==============================================# @@ -483,7 +480,6 @@ def create_sidebar(option): if not sidebar_items: if not tyto.exists(target): tyto.set_file(target, 'New', '') - logs.out("32", target, False) logs.out('28', '%s'%langs.log.sidebar, False) return @@ -504,7 +500,6 @@ def create_sidebar(option): ), True) tyto.set_file(target, True, sidebar_content) - logs.out("32", target, False) #===================================================# @@ -533,5 +528,4 @@ def create_user_footer(option): else: footer = '%s%s'%(tab, line) tyto.set_file(target, 'New', footer) - logs.out("32", target, False) diff --git a/src/var/lib/tyto/program/logs.py b/src/var/lib/tyto/program/logs.py index 9777c5a..3d254f8 100644 --- a/src/var/lib/tyto/program/logs.py +++ b/src/var/lib/tyto/program/logs.py @@ -90,6 +90,8 @@ def out(nbr, value, out): '42' : ' ╒ %s%s%s > "%s"'%(CG, langs.log.dom_act, CS, value), '43' : ' ╒ %s%s%s'%(CY, langs.log.dom_no, CS), '44' : ' ╞ %s%s%s "tyto check %s"'%(CY, langs.log.check_m, CS, value), + '45' : ' ╞ %s%s %s%s > %s'%(CY, langs.log.meta_t, langs.log.no_up, CS, value), + '46' : ' ╞ %s%s %s%s > %s'%(CY, langs.log.time_t, langs.log.no_up, CS, value), '51' : ' ╞ %s%s%s > %s'%(CY, langs.log.data_inc, CS, value), '60' : ' │\n ╞ %s'%langs.log.status_r, '255' : ' ╘ %s'%langs.log.laterout diff --git a/src/var/lib/tyto/program/publish.py b/src/var/lib/tyto/program/publish.py index 1665548..7bf1d2e 100644 --- a/src/var/lib/tyto/program/publish.py +++ b/src/var/lib/tyto/program/publish.py @@ -74,7 +74,7 @@ def manage_publish(target): publish_article() # Create new ATOM/RSS file - #rss.create_feed() + rss.create_feed() #===============# @@ -100,10 +100,8 @@ def publish_article(): #-------------------------------------------------# def replace_lines_pub(): html.create_html_time_meta('publish') - print(html.time_html_pub) in_pub = False - time_wip_pub = '' wip_html_post = open(db.post_wip, 'r').read() www_html_post = wip_html_post @@ -116,8 +114,6 @@ def replace_lines_pub(): elif line.startswith(''): time_wip_pub = '%s\n%s'%(time_wip_pub, line) in_pub = False - print('> time_wip_pub') - print(time_wip_pub) break elif line.startswith(''): @@ -127,15 +123,27 @@ def replace_lines_pub(): if in_pub: time_wip_pub = '%s\n%s'%(time_wip_pub, line) - www_html_post = www_html_post.replace(time_wip_pub, - html.time_html_pub - ) - - www_html_post = www_html_post.replace(time_wip_meta, html.meta_pub) + # Update file with new time meta + try: + www_html_post = \ + www_html_post.replace(time_wip_meta, + html.meta_pub + ) + except: + logs.out("45", db.post_www, False) + + # update file with new article time + try: + www_html_post = \ + www_html_post.replace(time_wip_pub, + html.time_html_pub + ) + except: + logs.out("46", db.post_www, False) + #print(www_html_post) - tyto.set_file(db.post_www, 'new', www_html_post) - logs.out("32", db.post_www, False) + tyto.set_file(db.post_www, 'New', www_html_post) #================================# diff --git a/src/var/lib/tyto/program/rss.py b/src/var/lib/tyto/program/rss.py index c8c465c..6833547 100644 --- a/src/var/lib/tyto/program/rss.py +++ b/src/var/lib/tyto/program/rss.py @@ -1,11 +1,27 @@ #!/usr/bin/env python3 -# Name: Tyto - Littérateur -# Type: ATOM/RSS template -# Description: Create raw RSS template -# file: rss.py -# Folder: /var/lib/tyto/program/ -# By echolib (XMPP: im@echolib.re) -# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 +# Tyto - Littérateur +# +# Copyright (C) 2023 Cyrille Louarn