Last active
December 22, 2015 13:58
-
-
Save alseambusher/6482377 to your computer and use it in GitHub Desktop.
log manager for Game of thrones
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# log is 1:2 | |
echo -n "how many episodes u wanna see: " | |
read count | |
while [ $count -ne 0 ] | |
do | |
log=`cat log` | |
expr "$log" : "\(.*\):.*" | |
series=`expr "$log" : "\(.*\):.*"` | |
episode=`expr "$log" : ".*:\(.*\)"` | |
if [ `echo "$series<10"|bc` -ne 0 ] | |
then | |
series=0$series | |
fi | |
if [ `echo "$episode<10"|bc` -ne 0 ] | |
then | |
episode=0$episode | |
fi | |
file=S"$series"E"$episode" | |
file=`find . -name "*$file*"` | |
#if file exists then play else go to next series | |
if [ "$file" ] | |
then | |
# vlc is run in full screen. If u r not using vlc change this line | |
vlc -f "$file" | |
count=`expr $count - 1` | |
series=`expr "$log" : "\(.*\):.*"` | |
episode=`expr "$log" : ".*:\(.*\)"` | |
episode=`expr $episode + 1` | |
echo "$series:$episode">log | |
echo "none">error.log | |
else | |
error_log=`cat error.log` | |
if [ "$error_log" == "error" ] | |
then | |
# this will just print a fancy message :P change it if u want | |
figlet end of episodes | |
exit | |
fi | |
echo "error">error.log | |
series=`expr "$log" : "\(.*\):.*"` | |
series=`expr $series + 1` | |
echo "$series:1">log | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment