Posted by jpope on Wed 20th Jan 05:04 (modification of post by jpope view diff)
diff | download | new post
- #!/bin/bash
- ##############################################################
- ## #! Forums Active Topics Pipe Menu ##
- ## ##
- ## v 1.0 by jpope 01.18.2010 ##
- ## - based on conky config by mrpeachy @ ##
- ## http://crunchbanglinux.org/forums/post/51330/#p51330 ##
- ## ##
- ## v 1.1 by jpope 01.19.2010 ##
- ## ##
- ##############################################################
- ## Settings ##################################################
- browser=$(echo firefox-3.5)
- maxthreads=5
- ##############################################################
- DIR=$(echo /home/$(whoami)/tmp/)
- tmpfile=$(echo forumspipemenu.html)
- forumlink=$(echo http://crunchbanglinux.org/forums/search/recent/)
- curl $forumlink > $DIR$tmpfile
- #tempfile=$(echo file://$DIR$tmpfile)
- tempfile=$DIR$tmpfile
- th=1
- pipeopen=$(echo "echo <openbox_pipe_menu>")
- pipeclose=$(echo "echo </openbox_pipe_menu>")
- title=$(echo "echo <separator label=\"CRUNCHBANGLINUX.ORG FORUM ACTIVITY\"/>")
- itemforums=$(echo "echo <item label=\"Goto Recent Topics -->\">")
- itemforums_execute=$(echo "echo $browser $forumlink")
- item_close=$(echo "echo </item>")
- actionexe=$(echo "echo <action name=\"Execute\">")
- actionexe_close=$(echo "echo </action>")
- execute=$(echo "echo <execute>")
- execute_close=$(echo "echo </execute>")
- separator=$(echo "echo <separator/>")
- $pipeopen
- $title
- $itemforums
- $actionexe
- $execute
- $itemforums_execute
- $execute_close
- $actionexe_close
- $item_close
- $separator
- while [ $th -le $maxthreads ]; do
- topic=$(less $tempfile | grep -n '</span> <a href' | sed -n $th\p | awk -F'/">' '{print $2}' | awk -F'</a>' '{print $1}' | sed "s|'|'|g" | fold -sw 40)
- t_link=$(less $tempfile | grep -n '</span> <a href' | sed -n $th\p | awk -F'href="' '{print $2}' | awk -F'">' '{print $1}')
- timestamp=$(less $tempfile | grep -n '<li class="info-lastpost' | sed -n $th\p | awk -F'>' '{print $6 $9}' | sed -e 's|</a| |' | sed -e 's|</cite||' | sed -e 's/Today/Last post at/')
- ts_link=$(less $tempfile | grep -n '<li class="info-lastpost' | sed -n $th\p | awk -F'href="' '{print $2}' | awk -F'">' '{print $1}')
- item_topic=$(echo "echo <item label=\"$th) $topic\">")
- item_topic_link=$(echo "echo $browser \"$t_link\"")
- item_timestamp=$(echo "echo <item label=\"$timestamp\">")
- item_timestamp_link=$(echo "echo $browser \"$ts_link\"")
- $item_topic
- $actionexe
- $execute
- $item_topic_link
- $execute_close
- $actionexe_close
- $item_close
- $item_timestamp
- $actionexe
- $execute
- $item_timestamp_link
- $execute_close
- $actionexe_close
- $item_close
- $separator
- th=$(( $th + 1 ))
- done
- $pipeclose
- echo $(rm $DIR$tmpfile)
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.