View Single Post
Old 10-23-2013, 11:45 AM   #2
paolog
Zealot
paolog can name that ebook in five wordspaolog can name that ebook in five wordspaolog can name that ebook in five wordspaolog can name that ebook in five wordspaolog can name that ebook in five wordspaolog can name that ebook in five wordspaolog can name that ebook in five wordspaolog can name that ebook in five wordspaolog can name that ebook in five wordspaolog can name that ebook in five wordspaolog can name that ebook in five words
 
paolog's Avatar
 
Posts: 117
Karma: 37584
Join Date: Nov 2012
Location: Milan / Italy
Device: pocketbook touch 622
at the end I did a script to modify the gamma settings for Adobe and DjVu viewer, with the use of iv_shtool made by rkomar to have a graphic interface

https://www.mobileread.com/forums/sho...d.php?t=163556

below there is my code; I'm not a programmer so it's quite raw and naive

Code:
#!/bin/ash

SH_IVTOOL=/mnt/ext1/system/bin/sh_ivtool.app

STATUS="`cat /mnt/ext1/system/config/global.cfg | grep Gamma`"

ANSWER=`$SH_IVTOOL -q "$STATUS

Change gamma settings for 
Adobe or DjVu reader?"`

if [ $? -eq 0 -a "$ANSWER" == "y" ]; then

	BACKUP=`$SH_IVTOOL -q "Make a backup of global.cfg in the same place?"`
	
	if [ $? -eq 0 -a "$BACKUP" == "y" ]; then
	
	cp /mnt/ext1/system/config/global.cfg /mnt/ext1/system/config/global.cfg.old
	
	fi

		PRG=`$SH_IVTOOL -o Adobe DjVu`

		CHANGE="`echo "$STATUS" | grep "$PRG"`"

		NEW=`$SH_IVTOOL -t "$CHANGE (new x.x)"`


# here would be nice to test that NEW is grather than 0
#if [[ $NEW > 0 ]]; then
#$SH_IVTOOL -s "MAGGIORE DI ZERO"
#fi
	
		if [ $? -eq 0 -a "$PRG" == "Adobe" ]; then
	
		sed -i "s/GammaLevelAdobe=.*/GammaLevelAdobe="$NEW"/" /mnt/ext1/system/config/global.cfg

		fi

		if [ $? -eq 0 -a "$PRG" == "DjVu" ]; then

		sed -i "s/GammaLevelDjVu=.*/GammaLevelDjVu="$NEW"/" /mnt/ext1/system/config/global.cfg	
	
		fi

		$SH_IVTOOL -s "New gamma settings:
`cat /mnt/ext1/system/config/global.cfg | grep Gamma`"

fi

exit
___
edit: note: added bulletproof suggestions ( $? -eq 0 -a ) in the if tests
___

could anyone help me in testing whether $NEW is greather than 0 ?

thanks

paolo

Last edited by paolog; 10-23-2013 at 05:07 PM.
paolog is offline   Reply With Quote