windows script for used sectors of a dvd
#1
Hello to all ...

I need a windows script that does print out the size of used blocks of a dvd ....
I would like to implement a function to display a progress-bar.

Under linux I allready have a script witch is working ... it gives the exact size in bytes
of a dvd (this is the size a rip would need on the disk)

Code:
#!/bin/bash
###########################################################
# scriptname : dvd2size.sh                                #
###########################################################
#                                                         #
# RELEASE 0.5H luemmels-dvd-ripper                        #
#                                                         #
# This script is part of luemmels-dvd-ripper script for   #
# xbmc and is licenced under the gpl-licence              #
#                                                         #
# http://code.google.com/p/luemmels-dvd-ripper            #
#                                                         #
###########################################################
#                                                         #
# author     : hans weber                                 #
#                                                         #
# parameters :                                            #
#                                                         #
# $1 device for ripping                                   #
#                                                         #
# description :                                           #
# calculates the size of a dvd-rip                        #
###########################################################


# Define the counting commands we expect inside the script

EXPECTED_ARGS=1

# Error-codes

E_BADARGS=1
E_TOOLNOTF=2
E_BADB=3


OUTPUT_ERROR=~/dvdripper/dvdsize-error.log

if [ $# -lt $EXPECTED_ARGS ]; then
  echo "Usage: dvd2size.sh p1"
  echo "                                      "
  echo "[p1] dvd-device"                                
  echo "                                      "
  echo "dvd2size.sh was called with wrong arguments" > $OUTPUT_ERROR                        
  exit $E_BADARGS
fi

# Define the commands we will be using inside the script ...

REQUIRED_TOOLS=`cat << EOF
isoinfo
grep
cut
EOF`

# Check if all commands are found on your system ...

for REQUIRED_TOOL in ${REQUIRED_TOOLS}
do
   which ${REQUIRED_TOOL} >/dev/null 2>&1    
   if [ $? -eq 1 ]; then
        echo "ERROR! \"${REQUIRED_TOOL}\" is missing. ${0} requires it to operate." > $OUTPUT_ERROR  
        echo "       Please install \"${REQUIRED_TOOL}\"." > $OUTPUT_ERROR  
        exit $E_TOOLNOTF
   fi        
done



# Get Blocksize

blocksize=`isoinfo -d -i $1  | grep "^Logical block size is:" | cut -d " " -f 5`
if test "$blocksize" = ""; then
    echo catdevice FATAL ERROR: Blank blocksize > $OUTPUT_ERROR
    exit $E_BADB
fi


# Get Blockcount

blockcount=`isoinfo -d -i $1 | grep "^Volume size is:" | cut -d " " -f 4`
if test "$blockcount" = ""; then
    echo catdevice FATAL ERROR: Blank blockcount > $OUTPUT_ERROR
    exit $E_BADB
fi

# print size of rip in bytes

echo $(($blocksize * $blockcount))

exit 0


Has somebody made something simmilar for windows ?

Regards hans
Reply
#2
But the calculated size is not 100 % exact the size oif the iso
(a few bytes are not correct)

This is a very alpha script for blue-pill for windows 0.5H

Code:
rem ###########################################################
rem # scriptname : blue.cmd                                   #
rem ###########################################################
rem #                                                         #
rem # RELEASE 0.5H luemmels-dvd-ripper                        #
rem #                                                         #
rem # This script is part of luemmels-dvd-ripper script for   #
rem # xbmc and is licenced under the gpl-licence              #
rem #                                                         #
rem # http://code.google.com/p/luemmels-dvd-ripper            #
rem #                                                         #
rem ###########################################################
rem #                                                         #
rem # author     : hans weber                                 #
rem #                                                         #
rem #                                                         #
rem # $1 device                                               #
rem # $2 directory for rip                                    #
rem # $3 name of the iso-rip                                  #
rem # $4 directory of all scripts for windows                 #
rem #                                                         #
rem # description :                                           #
rem # rips a dvd to a rip-directory                           #
rem ###########################################################
@echo on


cd %4%
rem ###########################################################
rem # Script start                                            #
rem ###########################################################


rem ###########################################################
rem # Calculate size of the iso-rip                           #
rem ###########################################################

dd --list 2> temp
echo create list of devices >>%windir%\dvdripper\blue.log
grep  --context=2 "CdRom0" temp 1>temp2
tail -n 1 temp2 > temp3
awk  "{ print $3 }" temp3 >temp4
type temp4 1>%WINDIR%\RIPPING_SIZE
echo calculate size of rip >>%windir%\dvdripper\blue.log

rem ###########################################################
rem # Cleanup                                                 #
rem ###########################################################

erase  temp temp2 temp3 temp4
echo cleanup >>%windir%\dvdripper\blue.log


rem ###########################################################
rem # Prepare hstart                                          #
rem ###########################################################

pwd 1> directory
set /P script= < directory
set Device=%1%
set RIPDir=%2%
set ISO=%3%
hstart /NOCONSOLE /IDLE /D="%script%" "cmd.exe /c "%script%\ddrip.cmd %Device% %RIPDir% %ISO% %script%""
erase directory
echo hstart.exe executed >>%windir%\dvdripper\blue.log


rem ###########################################################
rem # Write name including path to RIPPING_FILE               #
rem ###########################################################

echo %RIPDir%\%ISO% > %WINDIR%\RIPPING_FILE


rem ###########################################################
rem # Wait 8 seconds for dd                                   #
rem ###########################################################

echo wait 8 secounds
sleep 8


rem ###########################################################
rem # Get PID of dd                                           #
rem ###########################################################
tasklist > temp
grep  "dd.exe" temp 1>temp1
set /P task = < temp1
erase temp1 temp
if not exist %task% (
   echo dd is not executed
   echo error > %windir%\RIPPING_ERROR
   goto END
)

rem ###########################################################
rem # We found a running dd.exe                               #
rem ###########################################################

awk  "{ print $2 }" temp1 >temp2
set /P pid_dd = < temp2
echo %pid_dd% 1>%windir%\RIPPING_STARTED  
erase temp2




rem ###########################################################
rem # Script end                                              #
rem ###########################################################

echo blue-ends  >>%windir%\dvdripper\blue.log
Reply

Logout Mark Read Team Forum Stats Members Help
windows script for used sectors of a dvd0