From 4af37042fd723e4999dc3047b5104d0cc6f2781e Mon Sep 17 00:00:00 2001 From: Christian Pierre MOMON Date: Sat, 13 Apr 2019 04:23:36 +0200 Subject: [PATCH] Fixed bad pasword case. Improved help message. --- ccfmstat/ccfmstat.sh | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/ccfmstat/ccfmstat.sh b/ccfmstat/ccfmstat.sh index 76f3212..d1ea3ee 100755 --- a/ccfmstat/ccfmstat.sh +++ b/ccfmstat/ccfmstat.sh @@ -27,6 +27,7 @@ help() echo "Usage:" echo " ccfmstat [ -h | -help | --help ]" echo "If no parameter set then password is requested." + echo "Number of result per page has to be fixed un web GUI page." } # ############################################ @@ -112,23 +113,25 @@ run() idsFile="${tmpPrefix}-listmiens" curl -s -b "$cookieFile" "$pageUrl" | grep row-title > "$idsFile" + if [ $? -eq 0 ]; then + # Wikipédia – chronique « Partager est bon » sur écoles et logiciels libres - # Wikipédia – chronique « Partager est bon » sur écoles et logiciels libres + echo -e "id\ttotalListens\ttotalListeners\tiTunes\tpocketcasts\tovercast\tdirectDownload\tplayedInNewWindow\taudioPlayer\tpodcastAddict\tplayerFM\tother\trecordedDate\ttitle" + while read line; do + #echo $line + [[ $line =~ post=([0-9]+)\& ]] && id=${BASH_REMATCH[1]} + #echo "TRACE id=$id" - echo -e "id\ttotalListens\ttotalListeners\tiTunes\tpocketcasts\tovercast\tdirectDownload\tplayedInNewWindow\taudioPlayer\tpodcastAddict\tplayerFM\tother\trecordedDate\ttitle" - - while read line; do - #echo $line - [[ $line =~ post=([0-9]+)\& ]] && id=${BASH_REMATCH[1]} - #echo "TRACE id=$id" - - [[ $line =~ aria-label=\".+\"\>(.+)\ ]] && title=${BASH_REMATCH[1]} - #echo "TRACE title=$title" + [[ $line =~ aria-label=\".+\"\>(.+)\ ]] && title=${BASH_REMATCH[1]} + #echo "TRACE title=$title" - getInfoFromId "$id" "$title" "$cookieFile" + getInfoFromId "$id" "$title" "$cookieFile" - done < "$idsFile" + done < "$idsFile" + else + echo "Connexion error. Bad password?" + fi } # ########################################### @@ -148,7 +151,6 @@ else # Clean temporary files. # Clean. if [ -n "${tmpPrefix}" ]; then - ls "${tmpPrefix}-"* rm -f "${tmpPrefix}-"* fi fi