LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-22-2008, 08:14 PM   #1
TheMusicGuy
Member
 
Registered: Mar 2004
Distribution: Ubuntu 8.04
Posts: 127

Rep: Reputation: 15
Question How to write a script to rip a season of DVDs?


Hi,

I'm going to try to find the answer to this on my own, but in the mean time I want to know if somebody has already come up with a way to do this.

I want to write a shell script to rip a season of a TV shows that I have on DVD using Handbrake CLI. Also, I want to run each ripped file through a special CLI-based converter (which I already have) so I can watch them on my DS.

The basic format of the shell script would be something like
Code:
ripseason.sh %F_%S_%E.mp4 NUM_DVDS NUM_TITLES_PER_DVD
Where %F is replaced with the name of the series, %S is replaced with the season number, and %E is replaced with the number of the episode in the season.

I already know how to use handbrake CLI and have ripped one whole season but it was tedious and involved a lot of manual intervention. I would like to have a single command to rip subsequent seasons of this show (and others) but I don't know hardly anything about shell scripting except the very basics (cp, rm, ls, mv, how to pipe output, how to set environment variables, etc.). This script would have to be able to stop and wait for the user to switch DVDs after each one was ripped and then wait for a keypress or something to continue.

If anyone knows of a script like this or can at least point me to someplace where I can learn how to write one that would be great. Thanks!
 
Old 11-22-2008, 08:30 PM   #2
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by TheMusicGuy View Post
Hi,
If anyone knows of a script like this or can at least point me to someplace where I can learn how to write one that would be great. Thanks!
Can be done in python within half-hour in a bit simplified form.

Except one thing:
Quote:
Originally Posted by TheMusicGuy View Post
Where %F is replaced with the name of the series,
name of the series will have to be user-provided.

Try to read python tutorial, or take any simple shell script (slackware has bunch of them) and examine it. People often write scripts like that and delete them when they are no longer needed, because such scripts are simple. So I'm not sure if something like this will be available for download somewhere, but someone might write that script for you.
 
Old 11-22-2008, 10:02 PM   #3
TheMusicGuy
Member
 
Registered: Mar 2004
Distribution: Ubuntu 8.04
Posts: 127

Original Poster
Rep: Reputation: 15
This is going to sound odd, but I wanted to see if/how it could be done using only Bash because using Python feels like cheating. That's the main reason I didn't try it already! ^_^
 
Old 11-23-2008, 12:32 AM   #4
johnson_steve
Senior Member
 
Registered: Apr 2005
Location: BrewCity, USA (Milwaukee, WI)
Distribution: Xubuntu 9.10, Gentoo 2.6.27 (AMD64), Darwin 9.0.0 (arm)
Posts: 1,152

Rep: Reputation: 46
Quote:
Originally Posted by TheMusicGuy View Post
This is going to sound odd, but I wanted to see if/how it could be done using only Bash because using Python feels like cheating. That's the main reason I didn't try it already! ^_^
I hope something gets posted here so I can see how it works an use it in my own bash scripts. I don't know any python.
 
Old 11-23-2008, 02:54 AM   #5
unihiekka
Member
 
Registered: Aug 2005
Distribution: SuSE Linux / Scientific Linux / [K|X]ubuntu
Posts: 273

Rep: Reputation: 32
Quote:
using only Bash because using Python feels like cheating
Why? If Python does the job, it does it. No cheating involved!
 
Old 11-23-2008, 03:28 AM   #6
TheMusicGuy
Member
 
Registered: Mar 2004
Distribution: Ubuntu 8.04
Posts: 127

Original Poster
Rep: Reputation: 15
I knew somebody was going to ask that...well, the truth is I don't really know. I guess part of the reason I wanted to do this was so that I could use this as an opportunity to learn how to use Bash better? I already know Python fairly well, and this sort of thing doesn't really require the job of a high-level language like Python as it is basically (I am assuming) just a few loops, a process fork, and some shell commands.

Anyway, though, I've already started on a Python script, but it seems that it's going to take longer than I thought because I won't get a chance to work on it for it until a few days from now. Possibly. But still, I'd like the learning experience of doing it in Shell, so if anyone has an inkling of where one would begin, I'm still open to suggestions...
 
  


Reply

Tags
bash, batch, dvd, rip, script, shell



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Which distro to rip and burn dvds slack31337 Linux - Desktop 8 10-13-2008 08:22 PM
Can K3b Rip, Convert, and Burn DVDs? deepgrewal Linux - Software 4 08-27-2007 10:58 AM
Dvd:rip / transcode users: when you rip dvds, is the output file the size you expect? 144419855310001 Linux - Software 0 09-02-2006 08:56 AM
How can I rip DVDs? 144419855310001 Linux - Software 3 04-19-2006 06:09 AM
Can't rip DVDs with dvd::rip Hammett Linux - Software 2 10-27-2003 08:35 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration