Robbie and Eric take a look at the new MK602 from Rikomagic, a device which turns your normal TV (even an old CRT) into a smart TV.
Topics Covered:
#!/bin/bash
# Batch Image Resizer 1.0 by Roy W Nash 2013
#
# Requirments Zenity, ImageMagick
#
# Allows user to select a directory with images and copy them to a chosen # directory where they can choose to resize the copied images, leaving the # original images unchanged.
# Check for error
error=`pwd`/`basename $0`
function catch_errors() {
zenity --question --text="Cancel detected. Do you want to Quit or Restart" --cancel-label="Quit" --ok-label="Restart";
[ "$?" = "0" ] && ( bash -c $error & );
exit 0;
}
function func_error2() {
echo `date +%h:%m:%s`
}
trap catch_errors ERR;
zenity --info --text="Batch Image Resizer 1.0 by R.W.Nash ImageMagic required. Use at your own risk!" --title="Batch Image Resizer version 1.0 By Roy W Nash 2013"
# Ask user to select source directory
SourcePath=$(zenity --file-selection --directory --title="Select a directory containing images");echo $SourcePath
cd $SourcePath
zenity --question --text="Select target directory to save converted pictures." --title="Batch Image Resizer 1.0 by Roy W Nash 2012"
TargetPath=$(zenity --file-selection --directory --title="Select a target directory to save converted images");echo $TargetPath
zenity --info --text="Click OK to copy files from $SourcePath to $TargetPath"
(
cp $SourcePath/*.* $TargetPath
(for x in 10 20 30 40 50 60 70 80 90 100 ; do echo $x ; sleep 1 ; done)
#echo "10" ; sleep 1
#echo "# File transfer in progress" ; sleep 1
#echo "20" ; sleep 1
#echo "# File transfer 25% done." ; sleep 1
#echo "50" ; sleep 1
#echo "# File transfer 50% done." ; sleep 1
#echo "75" ; sleep 1
#echo "# File transfer 75% done." ; sleep 1
#echo "100" ; sleep 1
echo "# File transfer complete, click ok." ; sleep 1
) |
zenity --progress \
--title="Batch Image Resizer 1.0 by Roy W Nash 2013" \
--text="Please wait copying files from $SourcePath to $TargetPath" \
--percentage=10
if ["$?" = -1 ] ; then
zenity --error \
--text="File Transfer Cancelled"
fi
cd $TargetPath
Hsize=$(zenity --entry --text="Enter horizontal size");echo $Hsize
Vsize=$(zenity --entry --text="Enter vertical size");echo $Vsize
# Do conversion
(
mogrify -resize $Hsizex$Vsize *
(for x in 10 20 30 40 50 60 70 80 90 100 ; do echo $x ; sleep 1 ; done)
#echo "# Image resize 10% done" ; sleep 1
#echo "20" ; sleep 1
#echo "# Image resize 25% done" ; sleep 1
#echo "50" ; sleep 1
#echo "# Image resize 50% done" ; sleep 1
#echo "75" ; sleep 1
#echo "# Image resize 75% done" ; sleep 1
#echo "100" ; sleep 1
echo "# Image resize complete, click ok." ; sleep 1
# Show progress
) |
zenity --progress \
--title="Batch Image Resizer 1.0 by Roy W Nash 2013" \
--text="Resizing images $SourceName your resized images will be saved in $TargetPath this may take some time." \
--percentage=10
if [ "$?" = -1 ] ; then
zenity --error \
--text="Resize operation cancelled"
fi
#--pulsate \
#--auto-close \
#--auto-kill \
# Inform user where converted images are stored
zenity --info --text="Conversion completed, your converted pictures are in $TargetPath Thank you for using Batch Image Resizer 1.0" --title="Batch Image Resizer 1.0 by Roy W Nash 2013"
Links to Relevant Web Sites:
Lost your password? Please enter your email address. You will receive a link to create a new password.