[Linux] Bluray folder structure to ISO

Come up with a useful post-processing script? Share it here!
Post Reply
psy4meuh
Newbie
Newbie
Posts: 1
Joined: August 2nd, 2012, 10:45 am

[Linux] Bluray folder structure to ISO

Post by psy4meuh »

Hi,

Here is my contribution : a post-processing script for linux to create an ISO file from a downloaded bluray folder strucure.
It just needs the genisoimage package.

I use this script daily since a month, and it's working great !
My linux box is on Debian wheezy, and ISO files are all ok to play with Arcsoft Total Media Theatre 5.
I can't guarantee it will work on other distributions, or other bluray players as i didn't test... but your results are welcome !

I'm still a beginner in bash scripting, so don't hesitate to comment and modify it.

Code: Select all

#!/bin/bash
#
CHEMIN_BDMV=`find "$1" -name "BDMV" -print0`
if [[ $CHEMIN_BDMV == *BDMV* ]]; then
	echo "OK : BDMV Path found : $CHEMIN_BDMV"
else
	echo "KO : BDMV Path not found... EXIT"
	exit 1
fi

#  Example : genisoimage -iso-level 4 -allow-lowercase -l -udf -allow-limited-size -V "KING_KONG" -o "/kingking.iso" "/media/kingkong"
genisoimage -iso-level 4 -allow-lowercase -l -udf -allow-limited-size -V "$3" -o "$1/$3.iso" "$CHEMIN_BDMV/.."
exit 0

I also need help for two other functions :
- Uppercase, and replace spaces in volume name ("king kong" -> "KING_KONG")
- and delete the floder structure at the end, but keep the top-level downloaded folder...

so if anybody can sugest something :)
rtbd
Newbie
Newbie
Posts: 1
Joined: January 13th, 2013, 2:08 am

Re: [Linux] Bluray folder structure to ISO

Post by rtbd »

Thank you for this post -- it was really helpfull for me.

There are -- as usual -- several ways to achieve the goal you want:

The ancient way, should work on all *nixes since the 1960's:
use tr

Code: Select all

var="a b"
var=$(echo $var | tr [:lower:] [:upper:] |  tr " " "_")
The new way using bash's string replacements working only with bash 4:

Code: Select all

var="a b"
var=${var^^}
var=${var/ /_}
${var^^} = uppercase
${var..} = lowercase
${var/ab/xy} = substitute "ab" with "xy"
and much more

look for "advanced bash-scripting guide" to learn more.

And you can use sed or awk to do such replacements -- compare man sed and man (or info) (g)awk
Post Reply