Jump to content

Script Issues


Jamo

Recommended Posts

while working with script to download hak5, tekzilla and tbhs episodes, I come up with issues that Im unable to solve. So here is my code, it has options to choose hak5, tekzilla or tbhs. then format, and is it large/small/hd. I just cant get to point where it downloads feed. Please help.

#!/bin/bash
echo "choose show"
echo "1)Hak5"
echo "2)Tekzilla"
echo "3)The Ben Heck Show"
echo "(1/2/3)"

read show
echo "$show"

if [ "$show" = "1" ]
then video=hak5
else
	if [ "$show" = "2" ]
	then video=tekzilla
	else

		if [ "$show" = "3" ]
		then video=tbhs
		fi
	fi
fi
echo "$video"

echo "choose filetype"
echo "MP4 /WMV /Xvid"
echo "( 1 / 2 / 3)"
echo "closer details will be chosen later"

read filetype
if [ "$filetype" = "1" ]
then format=MP4
else
        if [ "$filetype" = "2" ]
        then format=WMV
        else

       		if [ "$filetype" = "3" ]
      	 	then format=Xvid
       		fi
        fi
fi

echo "closer details"
#####################################################
#format mp4
if [ "$format" = "MP4" ]
then
formaat=mp4 #for egrep
echo "1) MP4 HD"
echo "2) MP4 HD (30fps)"
echo "3) MP4 Large"
echo "4) MP4 Small"

read xform
if [ "$xform" = "1" ]
then zform=MP4-High-Definition
else
        if [ "$xform" = "2" ]
        then zform=MP4-hd30
        else

       		 if [ "$xform" = "3" ]
       		 then zform=MP4-Large
		else
			if [ "$xform" = "4" ]
			then zform=MP4-Small
			fi
        	fi
        fi
fi

###############################################
#
if [ "$format" = WMV ]
then
formaat=wmv #for egrep
echo "1) WMV-Larde"
echo "2) MP4 Small"

read xform
if [ "$xform" = "1" ]
then zform=WMV-Large
else
        if [ "$xform" = "2" ]
        then zform=WMV-Small
        fi
fi

####################################################
#Xvid
if [ "$format" = "Xvid" ]
then
formaat=xvid #for egrep
echo "3) Xvid Large"
echo "4) Xvid Small"

read xform
if [ "$xform" = "1" ]
then zform=Xvid-Large 
else
        if [ "$xform" = "2" ]
        then zform=Xvid-Small
        else

echo "Downloading Feed"
wget -O feed "http://revision3.com/$video/feed/$zform"
filename=`cat feed | egrep "$formaat" | cut -d '"' -f 2 | grep "http" | head -n1`
#else 
#	filename=`cat feed |egrep "mp4" | cut -d '"' -f 2 | grep "http" | head -n1`
#fi


echo "Download file?"
echo $filename
echo "(y/n):"
read input

if [ "$input" = "y" ]
then
echo "\n\n"
#wget -c $filename
axel -a $filename
fi

#echo "Do you want to remove feed?"
#echo "(y/n)"
#read input1

#if [ "$input1" = "y" ]
#then 
rm feed
echo "Feed removed"

:OUTPUT
 ./tekzilla.sh 
choose show
1)Hak5
2)Tekzilla
3)The Ben Heck Show
(1/2/3)
1
1
hak5
choose filetype
MP4 /WMV /Xvid
( 1 / 2 / 3)
closer details will be chosen later
1
closer details
./tekzilla.sh: line 145: syntax error: unexpected end of file

Link to comment
Share on other sites

Link to comment
Share on other sites

Very nice! That is one of the things I hate about code is if even one little mistake is made like a space in the wrong area or something it does not work.. could not tell you about bash shell scripting language (smh..) I should, but dont want to say anything false. My best guess would be right here "./tekzilla.sh: line 145: syntax error: unexpected end of file" start with line 145

Link to comment
Share on other sites

Very nice! That is one of the things I hate about code is if even one little mistake is made like a space in the wrong area or something it does not work.. could not tell you about bash shell scripting language (smh..) I should, but dont want to say anything false. My best guess would be right here "./tekzilla.sh: line 145: syntax error: unexpected end of file" start with line 145

its last line, and there is no text,

143 rm feed
144echo "Feed removed"
145 nothing here, what here should be?

Link to comment
Share on other sites

its last line, and there is no text,

143 rm feed
144echo "Feed removed"
145 nothing here, what here should be?

well.. the error is saying the there is a unexpected file ending, so my first guess is that it was not closed properly. I found an article that may help you http://www.computing.net/answers/linux/bash-script-unexpected-end-of-file/27450.html

Link to comment
Share on other sites

common sign of unbalanced if's and fi's (an fi at line 74 may help resolve your problem).

I removed it, it didint sole it.

jarmo@jarmo:~/Desktop$ ./tekzilla.sh.test.sh 
choose show
1)Hak5
2)Tekzilla
3)The Ben Heck Show
(1/2/3)
1
1
hak5
choose filetype
MP4 /WMV /Xvid
( 1 / 2 / 3)
closer details will be chosen later
1
closer details
./tekzilla.sh.test.sh: line 146: syntax error: unexpected end of file

Link to comment
Share on other sites

Thanks, I added some fi's to that file and edited it a bit more. Now it seems to be working. Give it a try and report errors.

newer code

#!/bin/bash
echo "Welcome to Hak5 Downloader v0.5"
echo "Thanks to theSuperman and Jarmo "
echo "and Hak5 community"
echo "For Comming up with the original scripts"

echo "choose show"
echo "1)Hak5"
echo "2)Tekzilla"
echo "3)The Ben Heck Show"
echo "(1/2/3)"

read show
echo "$show"

if [ "$show" = "1" ]
then video=hak5
else
        if [ "$show" = "2" ]
        then video=tekzilla
        else

                if [ "$show" = "3" ]
                then video=tbhs
                fi
        fi
fi
echo "$video"

echo "choose filetype"
echo "MP4 /WMV /Xvid"
echo "( 1 / 2 / 3)"
echo "closer details will be chosen later"

read filetype
if [ "$filetype" = "1" ]
then format=MP4
else
        if [ "$filetype" = "2" ]
        then format=WMV
        else

                if [ "$filetype" = "3" ]
                then format=Xvid
                fi
        fi
fi

echo "closer details"
#####################################################
#format mp4
if [ "$format" = "MP4" ]
then
formaat=mp4 #for egrep
echo "1) MP4 HD"
echo "2) MP4 HD (30fps)"
echo "3) MP4 Large"
echo "4) MP4 Small"

read xform

if [ "$xform" = "1" ]
then zform=MP4-High-Definition
else
        if [ "$xform" = "2" ]
        then zform=MP4-hd30
        else

                 if [ "$xform" = "3" ]
                 then zform=MP4-Large
                else
                        if [ "$xform" = "4" ]
                        then zform=MP4-Small
                        fi
                fi
        fi
fi #added
fi

###############################################
#
if [ "$format" = WMV ]
then
formaat=wmv #for egrep
echo "1) WMV-Larde"
echo "2) MP4 Small"

read xform
if [ "$xform" = "1" ]
then zform=WMV-Large
else
        if [ "$xform" = "2" ]
        then zform=WMV-Small
        fi
fi
fi #added

####################################################
#Xvid
if [ "$format" = "Xvid" ]
then
formaat=xvid #for egrep
echo "3) Xvid Large"
echo "4) Xvid Small"

read xform
if [ "$xform" = "1" ]
then zform=Xvid-Large 
else
        if [ "$xform" = "2" ]
        then zform=Xvid-Small
        fi
fi
fi
echo "downloading..."

###########################################################
echo "Downloading Feed"
wget -O feed "http://revision3.com/$video/feed/$zform"
filename=`cat feed | egrep "$formaat" | cut -d '"' -f 2 | grep "http" | head -n1`


echo "Download file?"
echo $filename
echo "(y/n):"
read input

if [ "$input" = "y" ]
then
echo "\n\n"
#wget -c $filename
axel -a $filename
fi

#echo "Do you want to remove feed?"
#echo "(y/n)"
#read input1

#if [ "$input1" = "y" ]
#then 
rm feed
echo "Feed removed"


Edited by Jarmo
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...