Browse Source

Clean up unnecessary files and add a timeout to all curl commands.

Michael Taboada 3 months ago
parent
commit
0f182f4ee5
10 changed files with 7 additions and 309 deletions
  1. 0 22
      contrib/vclip
  2. 1 1
      em.tin
  3. 2 2
      modules/communication.tin
  4. 2 2
      modules/mud_info.tin
  5. 1 1
      modules/music.tin
  6. 1 1
      modules/social_media.tin
  7. 0 133
      modules/socials.tin
  8. 0 34
      scripts/downloadclip.sh
  9. 0 89
      scripts/music.sh
  10. 0 24
      uploadclip.sh

+ 0 - 22
contrib/vclip

@@ -1,22 +0,0 @@
-#!/bin/bash
-
-#vclip by Storm Dragon
-#License: WTFPL http://wtfpl.net/
-#This script makes recording and pasting sound clips to Alter Aeon's sound clip channel easier.
-
-#record sound file, press control+c to quit and send.
-echo "Recording, press control+c to post your clip."
-rec -qV0 clip.ogg
-#add blank line so the ^C doesn't show up on the same line as the link
-echo
-#Reduce file size for faster uploads, and to be nice to the sndup server
-sox clip.ogg -c 1 -r 22050 tmpclip.ogg
-mv tmpclip.ogg clip.ogg
-#upload the file and extract the url from the json
-upload="$(curl -s --form file=@clip.ogg --form submit=upload http://sndup.net/post.php)"
-jsonInfo="$(echo "$upload" | sed 's/,/\n/g')"
-#save channel command to the file and show link in the terminal
-echo -n "soundclip " > cliplink.txt
-echo -n "$jsonInfo" | grep 'url' | sed -e 's/^{"url":"//' -e 's/a$/d/' | tr -d '"\\' | tee -a cliplink.txt
-echo
-exit 0

+ 1 - 1
em.tin

@@ -78,7 +78,7 @@
 	#nop {This is the only time we need the date number, so may as well clear it.};
 	#unvariable {introDate};
 	#nop {Get the last modified date of the news file.};
-	#script {motd} {curl -sI "$MOTDURL"};
+	#script {motd} {curl --connect-timeout 10 -sI "$MOTDURL"};
 	#regexp {${motd[1]}} {HTTP/1.1 {.*} {.*}} {#variable {motdStatus} {&1}};
 	#regexp {${motd[4]}} {Last-Modified: {.*}} {#variable {motdTime} {News updated &1}};
 	#nop {DisPLAY intro message.};

+ 2 - 2
modules/communication.tin

@@ -277,7 +277,7 @@
 
 #ALIAS {^pimptell %S %2}
 {
-	#script {echo -n "tell %1 "; curl -s --data-urlencode English="%2" --data-urlencode submit="Talk Like a Pimp " http://joel.net/EBONICS/translator/ | grep -A9 '<div class="bubble1 comicfont">' | $sed -e '/<div/d' -e '/<\/div>/d' -e "s/&#39;/'/g" | tr "\n" " "}
+	#script {echo -n "tell %1 "; curl --connect-timeout 10 -s --data-urlencode English="%2" --data-urlencode submit="Talk Like a Pimp " http://joel.net/EBONICS/translator/ | grep -A9 '<div class="bubble1 comicfont">' | $sed -e '/<div/d' -e '/<\/div>/d' -e "s/&#39;/'/g" | tr "\n" " "}
 }
 {8}
 
@@ -323,7 +323,7 @@
 
 #ALIAS {^pimp%+ %2}
 {
-	#script {echo -n "%1"; curl -s --data-urlencode English="%2" --data-urlencode submit="Talk Like a Pimp " http://joel.net/EBONICS/translator/ | grep -A9 '<div class="bubble1 comicfont">' | $sed -e '/<div/d' -e '/<\/div>/d' -e "s/&#39;/'/g" | tr "\n" " "}
+	#script {echo -n "%1"; curl --connect-timeout 10 -s --data-urlencode English="%2" --data-urlencode submit="Talk Like a Pimp " http://joel.net/EBONICS/translator/ | grep -A9 '<div class="bubble1 comicfont">' | $sed -e '/<div/d' -e '/<\/div>/d' -e "s/&#39;/'/g" | tr "\n" " "}
 }
 {9}
 

+ 2 - 2
modules/mud_info.tin

@@ -1,5 +1,5 @@
-#VARIABLE         {MOTDURL}  {http://stormdragon.tk/scripts/emotd.ogg}
+#VARIABLE         {MOTDURL}  {https://michaels.world/emotd.opus}
 #VARIABLE         {mudAddress}  {empiremud.net}
-#VARIABLE         {mudIntroMessage}  {Thanks for using tintin-empiremud, brought to you by Storm Dragon.\nVisit me on the web at http://stormdragon.tk. If you enjoy this package, feel free to leave a tip in the tip jar on the site.\nIf you have questions or feed back, you can post on the cowsay channel by typing /cowsay followed by your message, E.g. /cowsay hello.}
+#VARIABLE         {mudIntroMessage}  {Thanks for using tintin empire mud, brought to you by Michael "Lilmike" Taboada and originally created by storm dragon.\nVisit me on the web at https://michaels.world.\nIf you enjoy this tintin package feel free to leave a tip on my site. You can also provide feedback by contacting lilmike in game, or emailing michael@michaels.world. Suggestions welcome!}
 #VARIABLE         {mudPort}  {4000}
 #VARIABLE         {mudSessionName}  {Empire Mud}

+ 1 - 1
modules/music.tin

@@ -124,7 +124,7 @@
 		#variable {music[links[longUrl]]} {https://www.youtube.com/results?search_query=${music[newAutoTitleString]}};
 		#replace {music[links[longUrl]]} { } {+};
 		#replace {music[links[longUrl]]} {&} {%%26};
-		#script {i} {curl -s --data "signature=${music[links[apiKey]]}" --data "action=shorturl" --data "format=text" --data-urlencode "url=${music[links[longUrl]]}" ${music[links[apiUrl]]}};
+		#script {i} {curl --connect-timeout 10 -s --data "signature=${music[links[apiKey]]}" --data "action=shorturl" --data "format=text" --data-urlencode "url=${music[links[longUrl]]}" ${music[links[apiUrl]]}};
 		#variable {music[links[shortUrl]]} {${i[1]}};
 		%2 Now playing: $msg via ${music[player]}\. ${music[links[shortUrl]]}
 	}

+ 1 - 1
modules/social_media.tin

@@ -80,7 +80,7 @@ post $name has specialized in %1.
 {
 #variable {gnuSocialMudGroup} {muds}
 };
-		#system {curl -s -u "$gusername:$gpassword" -d status="$(echo -e "%1") #EmpireMUD !$gnuSocialMudGroup" -d source="tintin-empiremud" $gurl/api/statuses/update.xml &> /dev/null&}
+		#system {curl --connect-timeout 10 -s -u "$gusername:$gpassword" -d status="$(echo -e "%1") #EmpireMUD !$gnuSocialMudGroup" -d source="tintin-empiremud" $gurl/api/statuses/update.xml &> /dev/null&}
 	}
 }
 {9}

+ 0 - 133
modules/socials.tin

@@ -1,133 +0,0 @@
-#ACTION {^You howl at the moon.$}
-{
-	PLAY socials/howl
-}
-{8}
-
-#ACTION {%1 burps at %2.$}
-{
-	PLAY socials/burp
-}
-{9}
-
-#ACTION {%1 burps in your general direction.$}
-{
-	PLAY socials/burp
-}
-{9}
-
-#ACTION {%1 bur{ps|p}.$}
-{
-	PLAY socials/burp
-}
-{9}
-
-#ACTION {%1 enjoys a cup of coffee.$}
-{
-	PLAY socials/coffee
-}
-{9}
-
-#ACTION {%S lets off a real rip-roarer!$}
-{
-	PLAY socials/fart
-}
-{9}
-
-#ACTION {%1 po{p|ps} open a bottle of beer and enjo{y|ys}.$}
-{
-	PLAY socials/beer
-}
-{9}
-
-#ACTION {%1 {get|gets} down on all fours and {bark|barks} like a dog.$}
-{
-	PLAY socials/bark
-}
-{9}
-
-#ACTION {%1 {bark|barks loudly} at %2.$}
-{
-	PLAY socials/bark
-}
-{9}
-
-#ACTION {^Where are your manners?$}
-{
-	PLAY socials/fart
-}
-{9}
-
-#ACTION {^%S howls like a forlorn coyote.$}
-{
-	PLAY socials/howl
-}
-{9}
-
-#ACTION {^%S {give|gives} %3 the birdie.$}
-{
-	PLAY socials/bird
-}
-{9}
-
-#ACTION {^%S {throw|throws} back {her|his|its|your} head and {howl|howls} mournfully at %5's misfortune.$}
-{
-	PLAY socials/howl
-}
-{9}
-
-#ACTION {^%S {throw|throws} back {her|his|its|your} head and {howl|howls} mournfully at {her|his|its|your} own misfortune.$}
-{
-	PLAY socials/howl
-}
-{9}
-
-#ACTION {^%S {throw|throws} back {her|his|its|your} head and {howl|howls} mournfully.$}
-{
-	PLAY socials/howl
-}
-{9}
-
-#ACTION {^Arf! Woof! Aroooo!$}
-{
-	PLAY socials/bark
-}
-{9}
-
-#ACTION {^You attempt to use %1 as a lure.$}
-{
-	PLAY socials/perv
-}
-{9}
-
-#ACTION {^%S bur{p|ps} loudly.$}
-{
-	PLAY socials/burp
-}
-{9}
-
-#ACTION {^You hold your precious coffee mug with care and love and sip the elixir within.$}
-{
-	PLAY socials/coffee
-}
-{9}
-
-#ACTION {^You {fart, and are totally amazed at the resulting smell|fart then look around innocently|smell something foul\. Ok, who farted}{\.|\?}$}
-{
-	PLAY socials/fart
-}
-{9}
-
-#ACTION {^You're a pervert and you know it.$}
-{
-	PLAY socials/perv
-}
-{9}
-
-#ALIAS {^salts$}
-{
-	emote smiles a little, then stops.
-}
-{9}
-
-#SUBSTITUTE       {^You emote: %S smiles a little, then stops.$}                          {You smile a little, then stop.}       {5}

+ 0 - 34
scripts/downloadclip.sh

@@ -1,34 +0,0 @@
-#!/bin/bash
-
-#This is a helper script for tintin-alteraeon
-#It takes 2 args, player name and sould clip id from the sndup.net link.
-#released under the terms of the WTFPL
-
-if [ $# -ne 2 ] ; then
-exit 1
-fi
-
-fileName="$(curl -Is http://sndup.net/$2/d | grep "filename=" | cut -d "=" -f2)"
-if [ -d $HOME/Downloads ] ; then
-filePath="$HOME/Downloads/$fileName"
-else
-filePath="./$fileName"
-fi
-filePath="$(echo "$filePath" | tr -d [:cntrl:])"
-if [ -f "$filePath" ] ; then
-echo "$filePath already exists. Please move or delete it and try again."
-exit 1
-fi
-echo "Saving sound clip from $1 to $filePath..."
-curl -s -o "${filePath}" http://sndup.net/$2/d
-if [ $? -ne 0 ] ; then
-echo "There was an error saving the file."
-exit 1
-else
-if [ -f "$filePath" ] ; then
-echo "$filePath saved successfully."
-exit 0
-else
-echo "There was an error with the download."
-fi
-fi

+ 0 - 89
scripts/music.sh

@@ -1,89 +0,0 @@
-#!/bin/bash
-#music status helper for TinTin++
-#Written by Storm Dragon
-
-mpd="$(mpc current 2> /dev/null)"
-if [ -n "$mpd" ] ; then
-mpd="true"
-fi
-
-if [[ $(pgrep xmms2) ]] ; then
-xmms="true"
-fi
-
-#check for mpd
-if [ "$mpd" == "true" ] ; then
-musicURL="$1"
-musicProvider="$2"
-artist="$(mpc -f %artist% current)"
-title="$(mpc -f %title% current)"
-album="$(mpc -f %album% current)"
-if [ -n "$musicURL" -a "$musicURL" != false ] ; then
-url="$(curl -s "http://is.gd/create.php?format=simple&url=$(echo "${musicURL}${artist} ${title}" | sed -e 's/"/%22/g' -e 's/&/%26/g' -e "s/'/%27/g" -e 's/</%3c/g' -e 's/>/%3e/g' -e 's/ /%20/g')")"
-fi
-#check for xmms2
-elif [ "$xmms" == "true" ] ; then
-musicURL="$1"
-musicProvider="$2"
-artist="$(nyxmms2 info | grep artist | cut -d '=' -f2-)"
-album="$(nyxmms2 info | grep album | cut -d '=' -f2-)"
-title="$(nyxmms2 info | grep title | cut -d '=' -f2-)"
-if [ -n "$musicURL" -a "$musicURL" != false ] ; then
-url="$(curl -s "http://is.gd/create.php?format=simple&url=$(echo "${musicURL}${artist} ${title}" | sed -e 's/"/%22/g' -e 's/&/%26/g' -e "s/'/%27/g" -e 's/</%3c/g' -e 's/>/%3e/g' -e 's/ /%20/g')")"
-fi
-#check for last.fm:
-elif [ -f "$HOME/.shell-fm/nowplaying" ] ; then
-artist="$(cut -f 1 -d '\' "$HOME/.shell-fm/nowplaying")"
-title="$(cut -f 2 -d '\' "$HOME/.shell-fm/nowplaying")"
-album="$(cut -f 3 -d '\' "$HOME/.shell-fm/nowplaying")"
-if [ "$1" != false ] ; then
-url="$(curl -s "http://is.gd/create.php?format=simple&url=$(cut -f 4 -d '\' "$HOME/.shell-fm/nowplaying")")"
-musicProvider="Last.fm"
-fi
-elif cmus-remote -C >/dev/null 2>&1 ; then
-#If there was no last.fm file assume we're using cmus
-musicURL="$1"
-musicProvider="$2"
-info="$(cmus-remote -Q)"
-artist="$(echo "$info" | sed -n 's/^tag artist //p')"
-title="$(echo "$info" | sed -n 's/^tag title //p')"
-album="$(echo "$info" | sed -n 's/^tag album //p')"
-if [ -n "$musicURL" -a "$musicURL" != false ] ; then
-url="$(curl -s "http://is.gd/create.php?format=simple&url=$(echo "${musicURL}${artist} ${title}" | sed -e 's/"/%22/g' -e 's/&/%26/g' -e "s/'/%27/g" -e 's/</%3c/g' -e 's/>/%3e/g' -e 's/ /%20/g')")"
-fi
-else
-#Fianlly, check for Pianobar
-if [ -f "$HOME/.config/pianobar/nowplaying" ] ; then
-musicURL="$1"
-musicProvider="$2"
-artist="$(cut -f 1 -d '\' "$HOME/.config/pianobar/nowplaying")"
-title="$(cut -f 2 -d '\' "$HOME/.config/pianobar/nowplaying")"
-album="$(cut -f 3 -d '\' "$HOME/.config/pianobar/nowplaying")"
-if [ -n "$musicURL" -a "$musicURL" != false ] ; then
-url="$(curl -s "http://is.gd/create.php?format=simple&url=$(echo "${musicURL}${artist} ${title}" | sed -e 's/"/%22/g' -e 's/&/%26/g' -e "s/'/%27/g" -e 's/</%3c/g' -e 's/>/%3e/g' -e 's/ /%20/g')")"
-fi
-fi
-fi
-
-if [ -n "$artist" -a -n "$title" -a -n "$album" ] ; then
-msg="\"$title\" by \"$artist\" from \"$album\" $url"
-if [ -n "$musicProvider" ] ; then
-msg="$msg (Search results provided by $musicProvider)"
-fi
-msg=$(echo "$msg" | tr -d "\n")
-else
-if [ "$mpd" == "true" ] ; then
-fileName="$(mpc current | rev)"
-else
-fileName="$(cmus-remote -Q | head -2 | tail -1 | rev)"
-fi
-if [ -z "$title" ] ; then
-title="$(echo "$fileName" | cut -f 1 -d '/' | cut -f 2 -d '.' | rev)"
-fi
-if [ -z "$artist" ] ; then
-artist="$(echo "$fileName" | cut -f 2 -d '/' | rev)"
-fi
-msg="$artist - $title"
-fi
-echo "$msg"
-exit 0

+ 0 - 24
uploadclip.sh

@@ -1,24 +0,0 @@
-#!/bin/bash
-
-#vclip by Storm Dragon
-#License: WTFPL http://wtfpl.net/
-#This script makes recording and pasting sound clips to A MUD's channel easier.
-
-#Mac compatability, hopefully
-if [ "$(uname)" == "Darwin" ]; then
-sedCmd="gsed"
-else
-sedCmd="sed"
-fi
-grepCmd="grep"
-
-#Reduce file size for faster uploads, and to be nice to the sndup server
-sox clip.ogg -c 1 -r 17088 tmpclip.ogg norm
-mv tmpclip.ogg clip.ogg
-#upload the file and extract the url from the json
-upload="$(curl -s --form file=@clip.ogg --form submit=upload http://sndup.net/post.php)"
-jsonInfo="$(echo "$upload" | $sedCmd 's/,/\n/g')"
-#save channel command to the file and show link in the terminal
-echo -n "$@ " > cliplink.txt
-echo -n "$jsonInfo" | $grepCmd 'url' | $sedCmd -e 's/^{"url":"//' -e 's/a$/d/' | tr -d '"\\' >> cliplink.txt
-exit 0