2009-10-18, 16:47
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)
Has somebody made something simmilar for windows ?
Regards hans
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