All about Post Stats
This commit is contained in:
parent
a2c340be3d
commit
ea8940a870
|
@ -194,6 +194,10 @@ case "$1" in
|
|||
gsl__check_file "$gsl_dir_helps/gsl_help_write_post" || exit 1
|
||||
cat "$gsl_dir_helps/gsl_help_write_post"
|
||||
;;
|
||||
stats)
|
||||
gsl__check_file "$gsl_dir_helps/gsl_help_stats" || exit 1
|
||||
cat "$gsl_dir_helps/gsl_help_stats"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -5,6 +5,7 @@ $ gsl [ARG]
|
|||
help | -h [OPT] : This Help. Add FULL [ARG] for specifics
|
||||
install : Show process installation
|
||||
write | -w : How to write a Post
|
||||
stats : What are thes numbers in stats DB ?
|
||||
|
||||
new | -N : Add and configure a new DOMAIN
|
||||
|
||||
|
@ -19,6 +20,6 @@ $ gsl [ARG]
|
|||
add : Add author(s) for DOMAIN
|
||||
remove : Remove author(s) for DOMAIN
|
||||
|
||||
check | -C [OPT] : Check Posts erors from PWD folder
|
||||
-F : Force check again all Posts
|
||||
check | -C [OPT] [FILE] : Check Posts erors from PWD folder or [FILE]
|
||||
-F : Force check again
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
# Stats are one Post per line
|
||||
Format : txt
|
||||
Separator : |
|
||||
|
||||
# Fields:
|
||||
1 : Post Filename
|
||||
2 : Words
|
||||
3 : Paragraphs
|
||||
4 : Abbr
|
||||
5 : Header Links
|
||||
6 : Header Images
|
||||
7 : Header Files
|
||||
8 : Citations
|
||||
9 : Block-code Files
|
||||
10 : Posted Links
|
||||
11 : Italic
|
||||
12 : Strong
|
||||
13 : Bold
|
||||
14 : Inline-Code
|
||||
15 : Posted files
|
||||
|
|
@ -15,12 +15,25 @@ grep "$gsl_post" \
|
|||
}
|
||||
|
||||
#=======================================================================
|
||||
# Check Post exists and get line NBR in DB
|
||||
# Check Post exists and get line NBR in DB | $1 DB file
|
||||
#=======================================================================
|
||||
gsl__db_post_exists() {
|
||||
gsl_db_post_exists=`grep -n "$gsl_post" "$1"`
|
||||
gsl_db_post_line_nbr=`awk -F":" '{print $1}' <<< "$gsl_db_post_exists"`
|
||||
gsl_db_post_status=`awk -F"|" '{print $4}' <<< "$gsl_db_post_exists"`
|
||||
case "$1" in
|
||||
"$gsl_file_db_posts")
|
||||
gsl_db_post_exists=`
|
||||
grep -n "$gsl_post" "$1"`
|
||||
gsl_db_post_line_nbr=`
|
||||
awk -F":" '{print $1}' <<< "$gsl_db_post_exists"`
|
||||
gsl_db_post_status=`
|
||||
awk -F"|" '{print $4}' <<< "$gsl_db_post_exists"`
|
||||
;;
|
||||
"$gsl_file_db_stats")
|
||||
gsl_db_stat_exists=`
|
||||
grep -n "$gsl_post" "$1"`
|
||||
gsl_db_stat_line_nbr=`
|
||||
awk -F":" '{print $1}' <<< "$gsl_db_stat_exists"`
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
|
@ -29,7 +42,47 @@ gsl_db_post_status=`awk -F"|" '{print $4}' <<< "$gsl_db_post_exists"`
|
|||
gsl__db_line_post() {
|
||||
case "$gsl_process" in
|
||||
Checked)
|
||||
#-------------------------------------------------------------------
|
||||
# Check if post exists in DB stats.db and get line
|
||||
#-------------------------------------------------------------------
|
||||
if ! [[ "$gsl_checker_err" ]];then
|
||||
gsl_db_stat_line=`
|
||||
printf '%s%s%s%s%s%s%s%s%s%s\n' \
|
||||
"$gsl_post|" \
|
||||
"$gsl_post_stat_w|" \
|
||||
"$gsl_post_stat_p|" \
|
||||
"$gsl_post_stat_abbr|" \
|
||||
"$gsl_post_stat_link|" \
|
||||
"$gsl_post_stat_image|" \
|
||||
"$gsl_post_stat_file|" \
|
||||
"$gsl_post_stat_bq|" \
|
||||
"$gsl_post_stat_bcode|" \
|
||||
"${gsl_post_stat_mdb// /|}|"`
|
||||
|
||||
gsl__db_post_exists "$gsl_file_db_stats"
|
||||
if [[ "$gsl_db_stat_line_nbr" ]];then
|
||||
sed -i "${gsl_db_stat_line_nbr}s/.*/$gsl_db_stat_line/" \
|
||||
"$gsl_file_db_stats" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"DB" \
|
||||
"Stat" \
|
||||
"Line:$gsl_db_stat_line_nbr $gsl_post" \
|
||||
"$gsl_file_db_stats"
|
||||
else
|
||||
echo "$gsl_db_stat_line" >> "$gsl_file_db_stats" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"DB" \
|
||||
"Stat" \
|
||||
"Line:NEW $gsl_db_stat_line" \
|
||||
"$gsl_file_db_stats"
|
||||
fi
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# Check if post exists in DB posts.db and get line / status
|
||||
#-------------------------------------------------------------------
|
||||
gsl__db_post_exists "$gsl_file_db_posts"
|
||||
[[ "$gsl_checker_err" ]] && \
|
||||
[[ "$gsl_db_post_line_nbr" ]] \
|
||||
|
@ -42,7 +95,7 @@ case "$gsl_process" in
|
|||
"$gsl_file_db_posts" \
|
||||
&& return
|
||||
|
||||
gsl_db_line=`
|
||||
gsl_db_post_line=`
|
||||
printf '%s%s%s%s%s\n' \
|
||||
"$gsl_post_type|" \
|
||||
"$gsl_post|" \
|
||||
|
@ -51,7 +104,7 @@ case "$gsl_process" in
|
|||
"$gsl_process|"`
|
||||
|
||||
if [[ "$gsl_db_post_exists" ]];then
|
||||
sed -i "${gsl_db_post_line_nbr}s/.*/$gsl_db_line/" \
|
||||
sed -i "${gsl_db_post_line_nbr}s/.*/$gsl_db_post_line/" \
|
||||
"$gsl_file_db_posts" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
|
@ -62,7 +115,7 @@ case "$gsl_process" in
|
|||
gsl_checker_war=true
|
||||
|
||||
else
|
||||
echo "$gsl_db_line" \
|
||||
echo "$gsl_db_post_line" \
|
||||
>> "$gsl_file_db_posts" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
|
|
|
@ -34,6 +34,8 @@ echo -ne "\r\033[2K: Searching for IMAGES..."
|
|||
gsl__post_check_images
|
||||
echo -ne "\r\033[2K: Searching for BLOCK-CODES..."
|
||||
gsl__post_check_bcodes
|
||||
echo -ne "\r\033[2K: Searching for some STATS..."
|
||||
gsl__post_check_stats
|
||||
|
||||
echo -ne "\r\033[2K"
|
||||
|
||||
|
@ -284,7 +286,7 @@ do
|
|||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"${gsl_i_markers[gsl_i]}" \
|
||||
"Line $gsl_line_nbr: Mismatch ${gsl_u_markers[gsl_i]}" \
|
||||
"Line:$gsl_line_nbr > Mismatch ${gsl_u_markers[gsl_i]}" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
else
|
||||
|
@ -296,6 +298,8 @@ done < <(awk -v line="$gsl_post_begin" \
|
|||
'NR >= line {print NR":",$0}' \
|
||||
"$gsl_post")
|
||||
|
||||
gsl_post_stat_mdb=${gsl_post_stat_m[@]}
|
||||
|
||||
# Show Counts in logs
|
||||
for gsl_i in `seq 0 $gsl_markers_nbr`
|
||||
do
|
||||
|
@ -546,3 +550,16 @@ do
|
|||
|
||||
done < <(gsl__get_header "$gsl_marker_image" "$gsl_post")
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Check for more STATS
|
||||
#=======================================================================
|
||||
gsl__post_check_stats() {
|
||||
gsl_post_stat_w=`
|
||||
awk -v l="$gsl_post_begin" \
|
||||
'NR >= l' \
|
||||
"$gsl_post" \
|
||||
| wc -w`
|
||||
|
||||
gsl_post_stat_w=$(( $gsl_post_stat_w - 2*$gsl_post_stat_p ))
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
# file: gsl__post_makers
|
||||
# Folder: /var/lib/gsl/scripts
|
||||
# By echolib
|
||||
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
|
@ -65,15 +65,21 @@ do
|
|||
make)
|
||||
gsl_process="Made"
|
||||
gsl__db_post_exists "$gsl_file_db_posts"
|
||||
if [[ "$gsl_db_post_status" == "Made" ]];then
|
||||
gsl__logs_print
|
||||
"$gsl_log_w" \
|
||||
"Post" \
|
||||
"Make" \
|
||||
"$gsl_post already Made (Converted)" \
|
||||
"$gsl_file_db_posts"
|
||||
continue
|
||||
fi
|
||||
case "$gsl_db_post_status" in
|
||||
Checked)
|
||||
true # gsl__post_makers
|
||||
;;
|
||||
|
||||
Made)
|
||||
gsl__logs_print
|
||||
"$gsl_log_w" \
|
||||
"Post" \
|
||||
"Make" \
|
||||
"$gsl_post already Converted" \
|
||||
"$gsl_file_db_posts"
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue