Statoolinfos: indev to create contents file
This commit is contained in:
parent
8a43b795bb
commit
6a06c07419
|
@ -25,7 +25,8 @@ sti_images = sti_files = sti_raws = 0
|
||||||
sti_tags = sti_words = sti_titles = sti_paragraphs = sti_anclink = 0
|
sti_tags = sti_words = sti_titles = sti_paragraphs = sti_anclink = 0
|
||||||
sti_strongs = sti_bolds = sti_emphasis = sti_italics = sti_dels = 0
|
sti_strongs = sti_bolds = sti_emphasis = sti_italics = sti_dels = 0
|
||||||
sti_underlines = sti_cites = sti_customs = sti_icodes = 0
|
sti_underlines = sti_cites = sti_customs = sti_icodes = 0
|
||||||
sti_bcodes = sti_quotes = sti_lists = 0
|
sti_bcodes = sti_quotes = sti_lists = sti_articles = 0
|
||||||
|
|
||||||
|
|
||||||
#=======================#
|
#=======================#
|
||||||
# Manage "stats" option #
|
# Manage "stats" option #
|
||||||
|
@ -43,11 +44,19 @@ def manage_stats(process):
|
||||||
do[args.action](process)
|
do[args.action](process)
|
||||||
|
|
||||||
|
|
||||||
|
#==========================#
|
||||||
|
# Check databases' article #
|
||||||
|
#--------------------------#
|
||||||
def loop_articles(process):
|
def loop_articles(process):
|
||||||
|
global file_uri, domain_srv
|
||||||
|
global sti_articles
|
||||||
|
|
||||||
if process == 'wip':
|
if process == 'wip':
|
||||||
file_stats = '%s%s'%(db.srv_wip, tyto.stats_f)
|
file_uri = '%s%s'%(db.srv_wip, tyto.stats_f)
|
||||||
|
domain_srv = db.domain_wip_url
|
||||||
elif process == 'www':
|
elif process == 'www':
|
||||||
file_stats = '%s%s'%(db.srv_www, tyto.stats_f)
|
file_uri = '%s%s'%(db.srv_www, tyto.stats_f)
|
||||||
|
domain_srv = db.domain_www_url
|
||||||
|
|
||||||
# Get databases of wip's articles
|
# Get databases of wip's articles
|
||||||
for post_db in os.listdir(db.articles_db):
|
for post_db in os.listdir(db.articles_db):
|
||||||
|
@ -70,18 +79,20 @@ def loop_articles(process):
|
||||||
logs.out("9", db.post_src, False)
|
logs.out("9", db.post_src, False)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
sti_articles += 1
|
||||||
count_stats()
|
count_stats()
|
||||||
|
|
||||||
# www
|
# www
|
||||||
elif process == 'www':
|
elif process == 'www':
|
||||||
if not db.hash_www: continue
|
if not db.hash_www: continue
|
||||||
|
|
||||||
print("> anchors", sti_anchors, sti_strongs)
|
create_stats_file(file_uri)
|
||||||
logs.out("33", file_stats, False)
|
|
||||||
|
|
||||||
#
|
|
||||||
# Set Statistics and count
|
#================================#
|
||||||
#
|
# Set Statistics and count #
|
||||||
|
# in a loop, from loop_article() #
|
||||||
|
#--------------------------------#
|
||||||
def count_stats():
|
def count_stats():
|
||||||
# Set Statistics
|
# Set Statistics
|
||||||
global sti_anchors, sti_abbrs, sti_links
|
global sti_anchors, sti_abbrs, sti_links
|
||||||
|
@ -116,3 +127,17 @@ def count_stats():
|
||||||
sti_quotes = sti_quotes + db.stat_quotes
|
sti_quotes = sti_quotes + db.stat_quotes
|
||||||
sti_lists = sti_lists + db.stat_lists
|
sti_lists = sti_lists + db.stat_lists
|
||||||
|
|
||||||
|
|
||||||
|
#============================#
|
||||||
|
# Create stat file in server #
|
||||||
|
#----------------------------#
|
||||||
|
def create_stats_file(file_uri):
|
||||||
|
sti = \
|
||||||
|
'# Statistics file created by %s\n'%tyto.Tyto + \
|
||||||
|
'# Website: %s\n'%domain_srv + \
|
||||||
|
'\n' + \
|
||||||
|
'stats_articles = %d\n'%int(sti_articles)
|
||||||
|
|
||||||
|
|
||||||
|
tyto.set_file(file_uri, 'New', sti)
|
||||||
|
logs.out("33", file_uri, False)
|
||||||
|
|
Loading…
Reference in New Issue