#!/bin/bash #Author: Copyright Jelle de Jong #Note: Please send me an email if you enhanced this script #Version: 0.0.3 #Date: 24-05-2008 / 2008-10-03 / 2008-10-10 / 2009-07-05 #System: Ubuntu/Debian GNU/Linux #Information: man mkisofs, man isoinfo #Category Thunar scripts #Name: Create DVD #Description: Create a DVD iso file-image out of the directory name #Command: xfce4-terminal --disable-server --hide-toolbars --execute /usr/share/pct-thunar-scripts/scripts/create-dvd %F #Patterns: * #Directories: True # Did the script work for you? # Yes # Yes, but with some errors # Yes, but I had to change some things # Not at all # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. TEXTDOMAINDIR=/usr/share/locale TEXTDOMAIN=${0##*/} NAME=$"Create DVD" DESCRIPTION=$"Create a DVD iso file-image out of the directory name" cecho() { case "$1" in "black") echo -ne "\E[30m" ;; "red") echo -ne "\E[31m" ;; "green") echo -ne "\E[32m" ;; "yellow") echo -ne "\E[33m" ;; "blue") echo -ne "\E[34m" ;; "magenta") echo -ne "\E[35m" ;; "cyan") echo -ne "\E[36m" ;; *) echo -ne "\E[30m" exit ;; esac echo "$2" "$3" tput sgr0 } cecho "green" $"program:" echo "$0" cecho "green" $"description:" echo "$DESCRIPTION" check_program() { application="$1" if [ ! -e /usr/bin/$application ] then cecho "red" $"$application not found, installing now" sudo apt-get install "$application" fi } scan_directory() { subdir="$2" for file in "$1"/* do if [ -f "$file" ] then extension=${file##*.} extension=$(echo $extension | tr '[:upper:]' '[:lower:]') [[ "$extension" = bup ]] && mv "$file" "$I/$subdir/VIDEO_TS/" [[ "$extension" = ifo ]] && mv "$file" "$I/$subdir/VIDEO_TS/" [[ "$extension" = vob ]] && mv "$file" "$I/$subdir/VIDEO_TS/" fi if [ -d "$file" ] && [ ! "$file" == "$I/$subdir/" ] then scan_directory "$file" "$subdir" fi done } check_program mkisofs check_program zenity location=$(zenity --title=create-dvd.sh --text "Please choose cpu prossessing location" --list --radiolist --column "Select Item" --column "Location" False Server True Local) echo $"location: $location" for I in "$@" do cecho "green" $"starting: " dirname=${I%/*} file=${I##*/} filename=${I##*/}; filename=${filename%.*} extension=${I##*.} echo $"filling: query:" "$filename" if [ -d "$I" ] then if [ ! -e "$I/VIDEO_TS" ] then subdir="temp" [ ! -e "$I/$subdir/" ] && mkdir "$I/$subdir/" [ ! -e "$I/$subdir/VIDEO_TS" ] && mkdir "$I/$subdir/VIDEO_TS" [ ! -e "$I/$subdir/AUDIO_TS" ] && mkdir "$I/$subdir/AUDIO_TS" scan_directory "$I" "$subdir" fi savepath=$(zenity --title=create-dvd.sh --file-selection --filename="$filename.iso" --save --confirm-overwrite) if [ -z "$savepath" ] then echo $"no savepath selected, closing now" exit fi if [ "$location" = "Server" ] then MOUNT=$(awk '/^sshfs/ && $2 != "" {print $2}' /etc/fstab) MOUNT=${MOUNT%/*} find="$MOUNT/home/jelle/" replace='/home/jelle/' savepath=$(echo "$savepath" | sed "s,$find,$replace,g") echo $"savepath: $savepath" POINT=${MOUNT%/*} find="$POINT/prive/" replace='/home/jelle/' source=$(echo "$I/$subdir" | sed "s,$find,$replace,g") echo $"source: $source" ssh jelle@powercraft.nl "( nice -n 19 mkisofs -V \"$filename\" -dvd-video -o \"$savepath\" \"$source\" )" else source="$I/$subdir" echo $"source: $source" echo $"savepath: $savepath" #nice -n 19 mkisofs -V "$filename" -dvd-video -o "$savepath" "$source" 2>&1 | awk '{ print $1; fflush() }' | zenity --title=create-dvd.sh --progress --auto-close --text "Creating iso file" nice -n 19 mkisofs -V "$filename" -dvd-video -o "$savepath" "$source" #zenity --info --title=create-dvd.sh --text="dvd creation finished" eject /dev/sr0 fi #~ mkisofs -V "$filename" -dvd-video -o "$filename.iso" "$I/source/" #~ mkisofs -V VOLUME_S01D01A -dvd-video -o VOLUME_S01D01A.ISO VOLUME_S01D01A #~ nice -n 19 mkisofs -V "$filename" -dvd-video -o "/mnt/powercraft-server-jelle/prive/download/usenet/movies/$filename.iso" "$I" #~ isoinfo -d -i VOLUME_S01D01A.ISO fi cecho "green" $"completed:" cecho "blue" "---------------" done echo -n $"are you sure you want to exit [Y/n]? " read input if [ "$input" = "n" ] then exit 0 fi exit #~ ssh jelle@powercraft.nl '( nice -n 19 mkisofs -V NUMB3RS_S03D01 -dvd-video -o /home/jelle/download/usenet/NUMB3RS_S03D01.iso /home/jelle/download/usenet/NUMB3RS_S03D01/source/ )'