I hope I am asking this in the correct place.
I have a number of video serials that I have downloaded from the archives.
They are old but have nice plots.
What I wanted to do was write a bash script that would keep track of what
episode I was watching and return to the next one what I started the script
again. I also wanted the script to begin playing the next one if I made no
command to stop playing.
My first attempt at this was to setup a hidden file that would keep track of
the next episode. I then used a case statement that would branch to the
correct episode that was found in the hidden file.
What I wanted to have happen is if I didn't stop execution of the episode to
have the case staement fall through and play the next episode. If I did
want to stop watching I could use a goto statement that was controled by the
return value from the player I was using.
Now here is the rub. It seems that, at least in the version of bash I have
in openSuse 11, the case statement will not fall through. The ;; at the end
of the list of commands for each section is manditory. But hey no problem I
can just use a goto and jump back up to run the case statement again or use
a goto to brake out and update the hidden file and end the script. But alas
goto is not supporten. Yes I know the goto police will fall from the sky
and do horrible things to my persons but I beleive that goto is a very
important command and when used properly will make code much titghter.
I did think of a solution where I use if statements for each episode number
and the reading of the hidden file will allow only that if statement to run.
But what happens when I want the next epeisode to automaticly start playing?
I could set a flag for this and recursively call the script again with the
updated hidden file. But in my way of looking at code this is ugly.
I could write this in C in just a couple of minutes. But that's not the
point. My bash scripting leaves a lot to be learned and this is why I am
using bash in the first place.
So to reiterate the situation. I have a number, say a dozen, video files
that need to be played in order. I want to use bash to make this happen. I
also want to stop exicutuon and return to the place I left when I stopped
exicution. If I didn't stop exicution I want the next video file to play in
order. And I want an elegant solution ( that's actually the hard part. ) I
really dislike writting crappy code just so it "works." In my mind if it
does what one wnats but does in in a crapy way it doesn't "work" well.
Thank you all for your help with this.
In the past I have always fallen back on C for a problem like this, mainly
because I know it, and if I ran into any problems I would pull out Steven's
book, May God rest his sole, and the answer would always be there. But I
think it's time for me to expand my mind a little. Not to much but just a
little.
--
View this message in context:
http://www.nabble.com/Fishing-for-suggestions.-tp21992308p21992308.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.