View Single Post
Old 01-18-2011, 03:17 PM   #99
Edzilla
Member
Edzilla began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Dec 2008
Device: none
Quote:
Originally Posted by m0ngr31 View Post
So as long as the coverart is setup correctly in Calibre, it should work fine then right?

I hope you don't mind, but I rewrote your bash file to handle files in batch. Just run this from the directory where all your ebooks are. I haven't tested it though because I don't have mobi2mobi working on my Mac yet haha. Lemme know if you run into any problems.
Code:
#!/bin/bash

count1=0
asin1="B00"

FILES="*.mobi"

for g in $FILES
do
	if [ "$g" ]
	then
		count1=$[$count1+1]
		continue
	fi
done

rand1=$[1000-$count1]

while [ $rand1 -lt 1000 ]
do
	rand1=$[ (( $RANDOM % ( $[ 9999 - 1000 ] + 1 ) ) + 1000) - $count1 ]
done

rand2=$[ ( $RANDOM % ( $[ 999 - 100 ] + 1 ) ) + 100 ]

for f in $FILES
do
	if [ "$f" ]
	then
		/path/to/mobi2mobi/binary/mobi2mobi --outfile "$f" --exthtype 113 --exthdata $asin1$rand2$rand1 "$f"
		/path/to/mobi2mobi/binary/mobi2mobi --outfile "$f" --addexthtype 501 --exthdata "EBOK" "$f"
		rand1=$[$rand1+1]
		continue
	fi
done
I definitely don't mind.
I didn't want to do a batch script because it generates a new asin every time it's used. If you copy the file to your device then run it again, the two copies would not sync
Edzilla is offline   Reply With Quote