Statistics for statoolinfos OK. Other fixes. Can show-wip/show-www stats

This commit is contained in:
Cyrille L 2023-04-04 16:03:13 +02:00
parent 576213ecfc
commit 7b9d4cf89c
17 changed files with 332 additions and 198 deletions

View File

@ -1,13 +1,27 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# Version: 0.9.1 # Tyto - Littérateur
# Name: Tyto - Littérateur #
# Type: Executable # Copyright (C) 2023 Cyrille Louarn <echolib+tyto@a-lec.org>
# Description: Multiple Static Websites generator and manager #
# file: tyto # This program is free software: you can redistribute it and/or modify
# Folder: /usr/local/bin/ # it under the terms of the GNU Affero General Public License
# By echolib (XMPP: im@echolib.re) # as published by the Free Software Foundation, either version 3 of the
# Repo: https://git.a-lec.org/echolib/tyto.git # License, or of the License, or (at your option) any later version.
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 #
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#----------------------------------------------------------------------
# XMPP: echolib (im@echolib.re)
#
# Description: Main binary to execute
# File: /usr/bin/tyto
#----------------------------------------------------------------------
#------------ #------------
# funny stats # funny stats

View File

@ -1,11 +1,27 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# Name: Tyto - Littérateur # Tyto - Littérateur
# Type: DB for article #
# Description: Search article database and exec # Copyright (C) 2023 Cyrille Louarn <echolib+tyto@a-lec.org>
# file: db.py #
# Folder: /var/lib/tyto/program/ # This program is free software: you can redistribute it and/or modify
# By echolib (XMPP: im@echolib.re) # it under the terms of the GNU Affero General Public License
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 # as published by the Free Software Foundation, either version 3 of the
# License, or of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#----------------------------------------------------------------------
# XMPP: echolib (im@echolib.re)
#
# Description: Load article's database and check validity
# File: /var/lib/tyto/program/db.py
#----------------------------------------------------------------------
#------------ #------------
# funny stats # funny stats

View File

@ -19,7 +19,7 @@
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# XMPP: echolib (im@echolib.re) # XMPP: echolib (im@echolib.re)
# #
# Description: Manage domain configuration # Description: Load domain database and check validity
# File: /var/lib/tyto/program/dom.py # File: /var/lib/tyto/program/dom.py
#---------------------------------------------------------------------- #----------------------------------------------------------------------
@ -36,7 +36,7 @@
import os, sys, importlib, langs import os, sys, importlib, langs
lib = 'tyto_domain' lib = 'tyto_domain'
exists = incomplete = active = ready = shortname = False exists = incomplete = active = ready = shortname = corrupt = False
local_user = articles_db_d = False local_user = articles_db_d = False
hole = False hole = False
@ -81,11 +81,13 @@ dom_values = \
'wip_sidebar_f', 'wip_sidebar_f',
'wip_metas_f', 'wip_metas_f',
'wip_footer_f', 'wip_footer_f',
'wip_stats_f',
'www_css_f', 'www_css_f',
'www_navbar_f', 'www_navbar_f',
'www_sidebar_f', 'www_sidebar_f',
'www_metas_f', 'www_metas_f',
'www_footer_f', 'www_footer_f',
'www_stats_f',
'www_logo_f', 'www_logo_f',
'www_rss_f', 'www_rss_f',
'logo', 'logo',
@ -136,53 +138,58 @@ if not hole:
# Set configuration domain file # Set configuration domain file
config = '%s/tyto_domain.py'%folder config = '%s/tyto_domain.py'%folder
shortname = config
# Set exists if configuration file # Set exists if configuration file
if os.path.exists(config): if os.path.exists(config):
exists = True exists = True
exec(open(config).read()) try:
exec(open(config).read())
except:
corrupt = True
# For logs: show uri if not shortname known # For logs: show uri if not shortname known
try: shortname try: shortname
except: shortname = config except: pass
try: active = activated try: active = activated
except: pass except: pass
for value in dom_values: if not corrupt:
try: for value in dom_values:
eval(str(value)) try:
value_set = True eval(str(value))
except: value_set = True
err_val = err_val + ((value),) except:
value_set = False err_val = err_val + ((value),)
incomplete = True value_set = False
active = False incomplete = True
active = False
if value.endswith('_d'): if value.endswith('_d'):
if value_set: if value_set:
if not os.path.exists(eval(str(value))): if not os.path.exists(eval(str(value))):
try: try:
os.makedirs(eval(str(value)), exist_ok=True) os.makedirs(eval(str(value)), exist_ok=True)
dir_new = dir_new + ((eval(str(value))),) dir_new = dir_new + ((eval(str(value))),)
except: except:
dir_unu = dir_unu + ((eval(str(value))),) dir_unu = dir_unu + ((eval(str(value))),)
elif value.endswith('_f'):
if value_set:
if not os.path.exists(eval(str(value))):
if value in create_files:
file_mod = file_mod + ((value),)
else:
file_unu = file_unu + ((eval(str(value))),)
elif value.endswith('_f'):
if value_set:
if not os.path.exists(eval(str(value))):
if value in create_files:
file_mod = file_mod + ((value),)
else:
file_unu = file_unu + ((eval(str(value))),)
#==============================================# #==============================================#
# When an active and complete domain is needed # # When an active and complete domain is needed #
#----------------------------------------------# #----------------------------------------------#
if not incomplete: wip_html_mods = ()
if exists and not incomplete and not corrupt:
wip_html_mods = \ wip_html_mods = \
( (
eval(str('wip_navbar_f')), eval(str('wip_navbar_f')),
@ -199,4 +206,5 @@ if not hole:
#------------------------------------# #------------------------------------#
def valid(): def valid():
if incomplete: sys.exit(41) if incomplete: sys.exit(41)
#elif corrupt: sys.exit(41)
elif not active: sys.exit(42) elif not active: sys.exit(42)

View File

@ -250,6 +250,9 @@ def create_domain(target):
#------------------------------------- #-------------------------------------
root_srv_dom = '%s/%s'%(srv, shortname) root_srv_dom = '%s/%s'%(srv, shortname)
srv_wip_tpl = "%s/wip/template/"%root_srv_dom srv_wip_tpl = "%s/wip/template/"%root_srv_dom
stats_wip_f = "%s/wip/tyto_wip_statoolinfos.conf"%root_srv_dom
stats_www_f = "%s/www/tyto_www_statoolinfos.conf"%root_srv_dom
srv_www_tpl = "%s/www/template/"%root_srv_dom srv_www_tpl = "%s/www/template/"%root_srv_dom
set_f = \ set_f = \
'# Servers directories\n' + \ '# Servers directories\n' + \
@ -271,6 +274,7 @@ def create_domain(target):
'wip_sidebar_f = "%ssidebar.html"\n'%srv_wip_tpl + \ 'wip_sidebar_f = "%ssidebar.html"\n'%srv_wip_tpl + \
'wip_metas_f = "%smetas.html"\n'%srv_wip_tpl + \ 'wip_metas_f = "%smetas.html"\n'%srv_wip_tpl + \
'wip_footer_f = "%sfooter.html"\n'%srv_wip_tpl + \ 'wip_footer_f = "%sfooter.html"\n'%srv_wip_tpl + \
'wip_stats_f = "%s"\n'%stats_wip_f + \
'\n' + \ '\n' + \
'# Servers files (www)\n' + \ '# Servers files (www)\n' + \
'www_logo_f = "%s%s"\n'%(srv_www_tpl, logo) + \ 'www_logo_f = "%s%s"\n'%(srv_www_tpl, logo) + \
@ -278,7 +282,8 @@ def create_domain(target):
'www_navbar_f = "%snavbar.html"\n'%srv_www_tpl + \ 'www_navbar_f = "%snavbar.html"\n'%srv_www_tpl + \
'www_sidebar_f = "%ssidebar.html"\n'%srv_www_tpl + \ 'www_sidebar_f = "%ssidebar.html"\n'%srv_www_tpl + \
'www_metas_f = "%smetas.html"\n'%srv_www_tpl + \ 'www_metas_f = "%smetas.html"\n'%srv_www_tpl + \
'www_footer_f = "%sfooter.html"'%srv_www_tpl 'www_footer_f = "%sfooter.html"\n'%srv_www_tpl + \
'www_stats_f = "%s"'%stats_www_f
tyto.set_file(dom.config, False, set_f) tyto.set_file(dom.config, False, set_f)

View File

@ -1,11 +1,27 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# Name: Tyto - Littérateur # Tyto - Littérateur
# Type: Show infos about Tyto #
# Description: Show informations about Tyto - Littérateur # Copyright (C) 2023 Cyrille Louarn <echolib+tyto@a-lec.org>
# file: infos.py #
# Folder: /var/lib/tyto/program/ # This program is free software: you can redistribute it and/or modify
# By echolib (XMPP: im@echolib.re) # it under the terms of the GNU Affero General Public License
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 # as published by the Free Software Foundation, either version 3 of the
# License, or of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#----------------------------------------------------------------------
# XMPP: echolib (im@echolib.re)
#
# Description: Show helps and informations
# File: /var/lib/tyto/program/infos.py
#----------------------------------------------------------------------
#------------ #------------
# funny stats # funny stats

View File

@ -19,8 +19,8 @@
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# XMPP: echolib (im@echolib.re) # XMPP: echolib (im@echolib.re)
# #
# Description: Load translations file for log # Description: Load translations file for logs and forms/sites
# File: /var/lib/tyto/program/log.py # File: /var/lib/tyto/program/langs.py
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#------------ #------------

View File

@ -85,9 +85,10 @@ def out(nbr, value, out):
'36' : '%s %s'%(langs.log.file_e, value), '36' : '%s %s'%(langs.log.file_e, value),
'37' : '%s %s'%(langs.log.dir_e, value), '37' : '%s %s'%(langs.log.dir_e, value),
'38' : '%s%s%s "%s ?"'%(CR, langs.log.unused_t, CS, value), '38' : '%s%s%s "%s ?"'%(CR, langs.log.unused_t, CS, value),
'40' : '%s%s%s > "%s"'%(CY, langs.log.dom_ina, CS, value), '39' : '%s%s%s > %s'%(CR, langs.log.dom_cor, CS, value),
'41' : '%s%s%s > "%s"'%(CR, langs.log.dom_inc, CS, value), '40' : '%s%s%s > %s'%(CY, langs.log.dom_ina, CS, value),
'42' : '%s%s%s > "%s"'%(CG, langs.log.dom_act, CS, value), '41' : '%s%s%s > %s'%(CR, langs.log.dom_inc, CS, value),
'42' : '%s%s%s > %s'%(CG, langs.log.dom_act, CS, value),
'43' : '%s%s%s'%(CY, langs.log.dom_no, CS), '43' : '%s%s%s'%(CY, langs.log.dom_no, CS),
'44' : '%s%s%s "tyto check %s"'%(CY, langs.log.check_m, CS, value), '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), '45' : '%s%s %s%s > %s'%(CY, langs.log.meta_t, langs.log.no_up, CS, value),

View File

@ -58,7 +58,7 @@ def manage_publish(target):
'metas' : html.create_user_metas, 'metas' : html.create_user_metas,
'footer' : html.create_user_footer, 'footer' : html.create_user_footer,
'template' : publish_template, 'template' : publish_template,
'stats' : stats.manage_stats 'stats' : stats.manage
} }
do[target]('www') do[target]('www')

View File

@ -150,7 +150,8 @@ def manage(target):
'metas' : dom.wip_metas_f, 'metas' : dom.wip_metas_f,
'navbar' : dom.wip_navbar_f, 'navbar' : dom.wip_navbar_f,
'sidebar' : dom.wip_sidebar_f, 'sidebar' : dom.wip_sidebar_f,
'post' : post_wip 'post' : post_wip,
'stats' : dom.wip_stats_f,
}, },
'www' : { 'www' : {
'domain' : dom.config, 'domain' : dom.config,
@ -158,7 +159,8 @@ def manage(target):
'metas' : dom.www_metas_f, 'metas' : dom.www_metas_f,
'navbar' : dom.www_navbar_f, 'navbar' : dom.www_navbar_f,
'sidebar' : dom.www_sidebar_f, 'sidebar' : dom.www_sidebar_f,
'post' : post_www 'post' : post_www,
'stats' : dom.www_stats_f,
}, },
} }

View File

@ -1,11 +1,27 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# Name: Tyto - Littérateur # Tyto - Littérateur
# Type: Statistics generator #
# Description: Create/Show statistics (wip, publish...) # Copyright (C) 2023 Cyrille Louarn <echolib+tyto@a-lec.org>
# file: stats.py #
# Folder: /var/lib/tyto/program/ # This program is free software: you can redistribute it and/or modify
# By echolib (XMPP: im@echolib.re) # it under the terms of the GNU Affero General Public License
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 # as published by the Free Software Foundation, either version 3 of the
# License, or of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#----------------------------------------------------------------------
# XMPP: echolib (im@echolib.re)
#
# Description: Create total statistics file for www or wip
# File: /var/lib/tyto/program/stats.py
#----------------------------------------------------------------------
#------------ #------------
# funny stats # funny stats
@ -18,40 +34,26 @@
#********************************************************************** #**********************************************************************
import os, importlib import os, importlib
import args, dom, logs, form, tyto, show import args, dom, logs, form, tyto, show, langs
sti_anchors = sti_abbrs = sti_links = 0
sti_images = sti_files = sti_raws = 0
sti_tags = sti_words = sti_titles = sti_paragraphs = sti_anclinks = 0
sti_strongs = sti_bolds = sti_emphasis = sti_italics = sti_dels = 0
sti_underlines = sti_cites = sti_customs = sti_icodes = 0
sti_bcodes = sti_quotes = sti_lists = 0
sti_articles = 0
#=======================# #=======================#
# Manage "stats" option # # Manage "stats" option #
#-----------------------# #-----------------------#
def manage_stats(process): def manage(process):
domain.domain_needed() dom.valid()
global file_uri, domain_srv global file_uri, domain_srv
global sti_articles
if process == 'wip': if process == 'wip':
file_uri = '%s%s'%(db.srv_wip, tyto.stats_f) file_uri = dom.wip_stats_f
domain_srv = db.domain_wip_url domain_srv = dom.wip_url
elif process == 'www': elif process == 'www':
file_uri = '%s%s'%(db.srv_www, tyto.stats_f) file_uri = dom.www_stats_f
domain_srv = db.domain_www_url domain_srv = dom.www_url
do = { loop_articles(process)
'wip' : loop_articles,
'publish' : loop_articles,
'show-wip' : show_stats,
'show-www' : show_stats
}
do[args.action](process)
#==========================# #==========================#
@ -59,78 +61,133 @@ def manage_stats(process):
#--------------------------# #--------------------------#
def loop_articles(process): def loop_articles(process):
global sti_articles global sti_articles
sti_articles = 0
# Get databases of articles # Get databases of articles
for post_db in os.listdir(db.articles_db): for post_db in os.listdir(dom.articles_db_d):
if not post_db.endswith('.conf'): continue if not post_db.endswith('.config'):
continue
# Load DB # 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()) exec(open(post_db).read(),globals())
args.target = post_src.rsplit('%s/'%db.in_dir)[1]
importlib.reload(db)
# Check hash status (wip/www) # Check hash status (wip/www)
hash_srv = '' hash_srv = ''
if process == 'wip': hash_srv = db.hash_wip if process == 'wip': hash_srv = hash_wip
elif process == 'www': hash_srv = db.hash_www elif process == 'www': hash_srv = hash_www
# Now generic for wip/www
if not hash_srv: continue
print(':> [%s] | %s'%(db.title, db.post_src)) # - Now generic for wip and www
# - Article has changed and could have different stats
# Article has changed and could have different stats if not hash_srv or \
if hash_srv != db.hash_chk: hash_srv != hash_chk:
logs.out("9", db.post_src, False)
continue continue
sti_articles += 1 sti_articles += 1
count_stats() if sti_articles == 1: count_stats(False)
else: count_stats(True)
# Create file if article # Create file if article
if sti_articles > 0: create_stats_file(file_uri) if sti_articles > 0: create_stats_file(file_uri)
else: logs.out("28", '(%s stats)'%process, True) else: logs.out("28", '%s stats'%process, True)
#===============================#
# False: Set First statistics #
# True: Count total statistics #
#-------------------------------#
def count_stats(add):
global sti_uniq_anchors
global sti_uniq_abbrs
global sti_uniq_links
global sti_uniq_images
global sti_uniq_files
global sti_uniq_codes
global sti_uniq_raws
global sti_posts_coms
global sti_posts_tags
global sti_posts_lines
global sti_posts_words
global sti_posts_titles
global sti_posts_paragraphs
global sti_posts_anchors
global sti_posts_abbrs
global sti_posts_strongs
global sti_posts_bolds
global sti_posts_emphasis
global sti_posts_italics
global sti_posts_dels
global sti_posts_underlines
global sti_posts_cites
global sti_posts_customs
global sti_posts_icodes
global sti_posts_bcodes
global sti_posts_quotes
global sti_posts_lists
#================================# # Set
# Set Statistics and count # if not add:
# in a loop, from loop_article() # sti_uniq_anchors = uniq_anchors
#--------------------------------# sti_uniq_abbrs = uniq_abbrs
def count_stats(): sti_uniq_links = uniq_links
# Set Statistics sti_uniq_images = uniq_images
global sti_anchors, sti_abbrs, sti_links sti_uniq_files = uniq_files
global sti_images, sti_files, sti_raws sti_uniq_codes = uniq_codes
global sti_tags, sti_words, sti_titles, sti_paragraphs, sti_anclinks sti_uniq_raws = uniq_raws
global sti_strongs, sti_bolds, sti_emphasis, sti_italics, sti_dels
global sti_underlines, sti_cites, sti_customs, sti_icodes
global sti_bcodes, sti_quotes, sti_lists
# Set statistics sti_posts_coms = post_coms
sti_anchors = sti_anchors + db.uniq_anchors sti_posts_tags = post_tags
sti_abbrs = sti_abbrs + db.uniq_abbrs sti_posts_lines = post_lines
sti_links = sti_links + db.uniq_links sti_posts_words = post_words
sti_images = sti_images + db.uniq_images sti_posts_titles = post_titles
sti_files = sti_files + db.uniq_files sti_posts_paragraphs = post_paragraphs
sti_raws = sti_raws + db.uniq_raws sti_posts_anchors = post_anchors
sti_tags = sti_tags + db.stat_tags sti_posts_abbrs = post_abbrs
sti_words = sti_words + db.stat_words sti_posts_strongs = post_strongs
sti_titles = sti_titles + db.stat_titles sti_posts_bolds = post_bolds
sti_paragraphs = sti_paragraphs + db.stat_paragraphs sti_posts_emphasis = post_emphasis
sti_anclinks = sti_anclinks + db.stat_anchors sti_posts_italics = post_italics
sti_strongs = sti_strongs + db.stat_strongs sti_posts_dels = post_dels
sti_bolds = sti_bolds + db.stat_bolds sti_posts_underlines = post_underlines
sti_emphasis = sti_emphasis + db.stat_emphasis sti_posts_cites = post_cites
sti_italics = sti_italics + db.stat_italics sti_posts_customs = post_customs
sti_dels = sti_dels + db.stat_dels sti_posts_icodes = post_icodes
sti_underlines = sti_underlines + db.stat_underlines sti_posts_bcodes = post_bcodes
sti_cites = sti_cites + db.stat_cites sti_posts_quotes = post_quotes
sti_customs = sti_customs + db.stat_customs sti_posts_lists = post_lists
sti_icodes = sti_icodes + db.stat_icodes
sti_bcodes = sti_bcodes + db.stat_bcodes # Count
sti_quotes = sti_quotes + db.stat_quotes else:
sti_lists = sti_lists + db.stat_lists sti_uniq_anchors = sti_uniq_anchors + uniq_anchors
sti_uniq_abbrs = sti_uniq_abbrs + uniq_abbrs
sti_uniq_links = sti_uniq_links + uniq_links
sti_uniq_images = sti_uniq_images + uniq_images
sti_uniq_files = sti_uniq_files + uniq_files
sti_uniq_codes = sti_uniq_codes + uniq_codes
sti_uniq_raws = sti_uniq_raws + uniq_raws
sti_posts_coms = sti_posts_coms + post_coms
sti_posts_tags = sti_posts_tags + post_tags
sti_posts_lines = sti_posts_lines + post_lines
sti_posts_words = sti_posts_words + post_words
sti_posts_titles = sti_posts_titles + post_titles
sti_posts_paragraphs = sti_posts_paragraphs + post_paragraphs
sti_posts_anchors = sti_posts_anchors + post_anchors
sti_posts_abbrs = sti_posts_abbrs + post_abbrs
sti_posts_strongs = sti_posts_strongs + post_strongs
sti_posts_bolds = sti_posts_bolds + post_bolds
sti_posts_emphasis = sti_posts_emphasis + post_emphasis
sti_posts_italics = sti_posts_italics + post_italics
sti_posts_dels = sti_posts_dels + post_dels
sti_posts_underlines = sti_posts_underlines + post_underlines
sti_posts_cites = sti_posts_cites + post_cites
sti_posts_customs = sti_posts_customs + post_customs
sti_posts_icodes = sti_posts_icodes + post_icodes
sti_posts_bcodes = sti_posts_bcodes + post_bcodes
sti_posts_quotes = sti_posts_quotes + post_quotes
sti_posts_lists = sti_posts_lists + post_lists
#============================# #============================#
@ -144,36 +201,48 @@ def create_stats_file(file_uri):
'# Generated: %s\n'%tyto.nowdate() + \ '# Generated: %s\n'%tyto.nowdate() + \
'\n' + \ '\n' + \
'# Uniq statistics from articles\' headers\n' + \ '# Uniq statistics from articles\' headers\n' + \
'stats_articles = %d\n'%int(sti_articles) + \ 'stats_articles = %d\n'%int(sti_articles) + \
'stats_uniq_anchors = %d\n'%int(sti_anchors) + \ 'stats_uniq_anchors = %d\n'%int(sti_uniq_anchors) + \
'stats_uniq_abbrs = %d\n'%int(sti_abbrs) + \ 'stats_uniq_abbrs = %d\n'%int(sti_uniq_abbrs) + \
'stats_uniq_links = %d\n'%int(sti_links) + \ 'stats_uniq_links = %d\n'%int(sti_uniq_links) + \
'stats_uniq_images = %d\n'%int(sti_images) + \ 'stats_uniq_images = %d\n'%int(sti_uniq_images) + \
'stats_uniq_files = %d\n'%int(sti_files) + \ 'stats_uniq_files = %d\n'%int(sti_uniq_files) + \
'stats_uniq_raws = %d\n'%int(sti_raws) + \ 'stats_uniq_codes = %d\n'%int(sti_uniq_codes) + \
'stats_uniq_raws = %d\n'%int(sti_uniq_raws) + \
'\n' + \ '\n' + \
'# Statistics from articles\' content\n' + \ '# Statistics from articles\' contents\n' + \
'stats_tags = %d\n'%int(sti_tags) + \ 'stats_posts_coms = %d\n'%int(sti_posts_coms) + \
'stats_words = %d\n'%int(sti_words) + \ 'stats_posts_tags = %d\n'%int(sti_posts_tags) + \
'stats_titles = %d\n'%int(sti_titles) + \ 'stats_posts_lines = %d\n'%int(sti_posts_lines) + \
'stats_paragraphs = %d\n'%int(sti_paragraphs) + \ 'stats_posts_words = %d\n'%int(sti_posts_words) + \
'stats_link_anchors = %d\n'%int(sti_anclinks) + \ 'stats_posts_titles = %d\n'%int(sti_posts_titles) + \
'stats_strongs = %d\n'%int(sti_strongs) + \ 'stats_posts_paragraphs = %d\n'%int(sti_posts_paragraphs) + \
'stats_bolds = %d\n'%int(sti_bolds) + \ 'stats_posts_anchors = %d\n'%int(sti_posts_anchors) + \
'stats_emphasis = %d\n'%int(sti_emphasis) + \ 'stats_posts_abbrs = %d\n'%int(sti_posts_abbrs) + \
'stats_italics = %d\n'%int(sti_italics) + \ 'stats_posts_strongs = %d\n'%int(sti_posts_strongs) + \
'stats_dels = %d\n'%int(sti_dels) + \ 'stats_posts_bolds = %d\n'%int(sti_posts_bolds) + \
'stats_underlines = %d\n'%int(sti_underlines) + \ 'stats_posts_emphasis = %d\n'%int(sti_posts_emphasis) + \
'stats_cites = %d\n'%int(sti_cites) + \ 'stats_posts_italics = %d\n'%int(sti_posts_italics) + \
'stats_customs = %d\n'%int(sti_customs) + \ 'stats_posts_dels = %d\n'%int(sti_posts_dels) + \
'stats_icodes = %d\n'%int(sti_icodes) + \ 'stats_posts_underlines = %d\n'%int(sti_posts_underlines) + \
'stats_bcodes = %d\n'%int(sti_bcodes) + \ 'stats_posts_cites = %d\n'%int(sti_posts_cites) + \
'stats_quotes = %d\n'%int(sti_quotes) + \ 'stats_posts_customs = %d\n'%int(sti_posts_customs) + \
'stats_lists = %d\n'%int(sti_lists) 'stats_posts_icodes = %d\n'%int(sti_posts_icodes) + \
'stats_posts_bcodes = %d\n'%int(sti_posts_bcodes) + \
'stats_posts_quotes = %d\n'%int(sti_posts_quotes) + \
'stats_posts_lists = %d\n'%int(sti_posts_lists)
tyto.set_file(file_uri, 'New', sti) tyto.set_file(file_uri, 'New', sti)
logs.out("33", file_uri, False) try:
print('', langs.site.stats_f%(
sti_articles, sti_posts_words
)
)
except:
print(' └ Articles = %s ; Words = %s'%(
sti_articles, sti_posts_words
)
)
#======================================# #======================================#
# Show statistics from pages on server # # Show statistics from pages on server #

View File

@ -37,7 +37,8 @@ import dom, logs, tyto, form
def domain(): def domain():
if dom.hole: logs.out("13", '', True) if dom.hole: logs.out("13", '', True)
elif not dom.shortname: return elif dom.corrupt: logs.out("39", dom.shortname, True)
#elif not dom.shortname: return
elif dom.incomplete: logs.out("41", dom.shortname, False) elif dom.incomplete: logs.out("41", dom.shortname, False)
elif dom.active: logs.out("42", dom.shortname, False) elif dom.active: logs.out("42", dom.shortname, False)
elif not dom.active: logs.out("40", dom.shortname, False) elif not dom.active: logs.out("40", dom.shortname, False)

View File

@ -41,7 +41,6 @@ import args, dom, logs
Tyto = 'Tyto - Littérateur' Tyto = 'Tyto - Littérateur'
Tytogit = 'https://git.a-lec.org/echolib/tyto-litterateur' Tytogit = 'https://git.a-lec.org/echolib/tyto-litterateur'
Tytoweb = 'https://tyto.echolib.re' Tytoweb = 'https://tyto.echolib.re'
stats_f = 'tyto_statoolinfos.conf'
# Needed header tags # Needed header tags

View File

@ -62,7 +62,7 @@ def manage(target):
'navbar' : html.create_navbar, 'navbar' : html.create_navbar,
'metas' : html.create_user_metas, 'metas' : html.create_user_metas,
'footer' : html.create_user_footer, 'footer' : html.create_user_footer,
'stats' : stats.manage_stats 'stats' : stats.manage
} }
do[target]('wip') do[target]('wip')

View File

@ -30,6 +30,7 @@ no_fidi = "Black Hole: no file or directory here"
dom_ina = "Inactive domain" dom_ina = "Inactive domain"
dom_inc = "Incomplete domain" dom_inc = "Incomplete domain"
dom_act = "Active domain" dom_act = "Active domain"
dom_cor = "Corrupted domain"
data_inc = "Incomplete data" data_inc = "Incomplete data"
data_inv = "Invalid data" data_inv = "Invalid data"
dom_no = "No domain found" dom_no = "No domain found"

View File

@ -30,6 +30,7 @@ no_fidi = "Trou Noir: aucun fichier ou dossier ici"
dom_ina = "Domaine inactif" dom_ina = "Domaine inactif"
dom_inc = "Domaine incomplet" dom_inc = "Domaine incomplet"
dom_act = "Domaine actif" dom_act = "Domaine actif"
dom_cor = "Domaine corrompu"
data_inc = "Donnée incomplète" data_inc = "Donnée incomplète"
data_inv = "Donnée invalide" data_inv = "Donnée invalide"
dom_no = "Aucun domaine trouvé" dom_no = "Aucun domaine trouvé"

View File

@ -12,13 +12,12 @@
# IMPORTANT Instructions # IMPORTANT Instructions
#----------------------- #-----------------------
''' # This is a python file, so... DO NOT REMOVE:
This is a python file, so... DO NOT REMOVE: # - "#"
- "#" # - "%s", "%d"
- "%s", "%d" # - "\n"
- "\n" # - "+ \"
- "+ \"
'''
# Generic # Generic
article = "Article" article = "Article"
@ -133,6 +132,8 @@ check_a = "Check again this article"
uptpl = "Update directory" uptpl = "Update directory"
stats_f = "Articles: %s (%s words)"
# Documentation of configuration files # Documentation of configuration files
#------------------------------------- #-------------------------------------
metas_doc = \ metas_doc = \

View File

@ -12,13 +12,11 @@
# Instructions IMPORTANTES # Instructions IMPORTANTES
#------------------------- #-------------------------
''' # Ceci est un fichier python, donc... NE PAS ENLEVER :
Ceci est un fichier python, donc... NE PAS ENLEVER : # - "#"
- "#" # - "%s", "%d"
- "%s", "%d" # - "\n"
- "\n" # - "+ \"
- "+ \"
'''
# Generic # Generic
article = "Article" article = "Article"
@ -134,6 +132,8 @@ check_a = "Vérifier encore l'article"
uptpl = "Mettre à jour le dossier" uptpl = "Mettre à jour le dossier"
stats_f = "Articles : %s (%s mots)"
# Documentation des fichiers de configuration # Documentation des fichiers de configuration
#-------------------------------------------- #--------------------------------------------
metas_doc = \ metas_doc = \