Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle

Notices

Reply
 
Thread Tools Search this Thread
Old 01-17-2011, 08:02 AM   #91
Edzilla
Member
Edzilla began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Dec 2008
Device: none
Quote:
Originally Posted by m0ngr31 View Post
NoWorthWhile: Sorry I don't have an android phone so I can't test the effects of the script

Does android download the cover automatically or something? Isn't there a setting on Calibre to include the cover art in the mobi file? I might just be up in the night though...
I think calibre puts the cover art in the .mobi file.

I've written a small script to automatically add a random ASIN and the EBOK tag to a .mobi file under linux.
I'm pretty sure the range of my random number is not great, but it works well.

Code:
#!/bin/bash

FLOOR=1000000

number=0   #initialize
NUMBER=$[ ( $RANDOM % 9999999 )  + 1000000 ]

str=$(printf "%04d" $NUMBER)

ASIN="B00"
ASIN=$ASIN$str


/path/to/mobi2mobi/binary/mobi2mobi --outfile "$1" --exthtype 113 --exthdata $ASIN "$1"
/path/to/mobi2mobi/binary/mobi2mobi --outfile "$1" --addexthtype 501 --exthdata "EBOK" "$1"
It takes a filename as parameter.

Last edited by Edzilla; 01-17-2011 at 08:32 AM.
Edzilla is offline   Reply With Quote
Old 01-17-2011, 01:15 PM   #92
m0ngr31
Connoisseur
m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.
 
Posts: 66
Karma: 3056
Join Date: Dec 2010
Device: Kindle Paperwhite
Quote:
Originally Posted by Edzilla View Post
I think calibre puts the cover art in the .mobi file
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
m0ngr31 is offline   Reply With Quote
Advert
Old 01-17-2011, 02:53 PM   #93
m0ngr31
Connoisseur
m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.
 
Posts: 66
Karma: 3056
Join Date: Dec 2010
Device: Kindle Paperwhite
Quote:
Originally Posted by Kerenon View Post
I've done some research, and it seems there is a workaround for the android book cover problem I've mentioned before. The problem is that the device needs to be rooted, otherwise you don't have access to the required folder.

If you have a book with the ASIN "B000000001", then put a png formatted image in /data/data/com.amazon.kindle/files with the filename "cover_B000000001.png" and it will show up instead the downloaded garbage.

Hope it helps someone .
So the android kindle program downloads the covers from Amazon depending on what the ASIN number is, and K4PC just uses the cover embedded with the .mobi file?

If this is true, I'll see if I can remember enough python so I can write a script that will search amazon and download the correct ASIN numbers for the books.

If someone with an android will do a test for me: I need to know if a pBook ASIN number will work, or if it needs to be in the actual Kindle store.
m0ngr31 is offline   Reply With Quote
Old 01-17-2011, 03:05 PM   #94
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
So the android kindle program downloads the covers from Amazon depending on what the ASIN number is, and K4PC just uses the cover embedded with the .mobi file?
Sometimes yes, and sometimes no. I've seen many ebooks where the cover that is displayed in K4PC is not the cover that's embedded in the mobi (when it comes to Amazon purchases anyway).

Last edited by DiapDealer; 01-17-2011 at 03:08 PM.
DiapDealer is offline   Reply With Quote
Old 01-17-2011, 04:23 PM   #95
m0ngr31
Connoisseur
m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.
 
Posts: 66
Karma: 3056
Join Date: Dec 2010
Device: Kindle Paperwhite
So I tested it on my wife's Ipod touch. I put a legit ASIN from the kindle store and it used the product image affiliated with that book instead of the embedded image from calibre.

I'll try it with a non Kindle store book with a real ASIN and let you know...
m0ngr31 is offline   Reply With Quote
Advert
Old 01-17-2011, 04:32 PM   #96
m0ngr31
Connoisseur
m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.
 
Posts: 66
Karma: 3056
Join Date: Dec 2010
Device: Kindle Paperwhite
With the book that I gave a pBook ASIN number it just defaulted to the embedded image on both the ipod touch and K4MAC.

I'm guessing it would do the same for a random ASIN number, but I don't have mobi2mobi on this computer, so I'll have to try it a little later...
m0ngr31 is offline   Reply With Quote
Old 01-18-2011, 01:48 AM   #97
m0ngr31
Connoisseur
m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.
 
Posts: 66
Karma: 3056
Join Date: Dec 2010
Device: Kindle Paperwhite
Ok, I was able to get it. This is for windows only though. I'll work on the *nix version soon...

Here's what you'll need to do:
-python-amazon-product-api (It's not too hard to install "easy_install python-amazon-product-api" if you have python setup in your PATH properly, if it has dependency problems, you'll have to install http://users.skynet.be/sbi/libxml-python/ and then run that command again)
-All your mobi files in one directory
-Save simple python script (attached) in the folder where you have your mobi files
-An Amazon Product Advertising account (https://affiliate-program.amazon.com...tail/main.html)
-Put the keys you get from this into the asin_search.py file
-Save this file as a .bat in the same folder as above
Code:
@echo off & setLocal EnableDELAYedExpansion
del temp*.txt>null 2>&1
set "asin1=B00"
set /a count=0
for /f %%a IN ('dir /b *.mobi') do (set /a count=count+1)
echo Number of files: %count%

set /a diff=((9999-%count%) - 1000) + 1
set /a divisor = 32767 / %diff%
set /a diff2=(999 - 100) + 1
set /a divisor2 = 32767 / %diff2%

:Random1
set /a asin2=%random% / %divisor%
if /i %asin2% GTR 9999 goto Random1
if /i %asin2% LSS 1000 goto Random1

:Random2
set /a asin3=%random% / %divisor2%
if /i %asin3% GTR 999 goto Random2
if /i %asin3% LSS 100 goto Random2
set /a temp1=!asin2!

for /f "delims=  " %%b IN ('dir /b *.mobi') do (

C:\Users\m0ngr31\desktop\kindle\mobi2mobi.exe --outfile "%%b" --delexthtype 113 "%%b">null 2>&1
C:\Users\m0ngr31\desktop\kindle\mobi2mobi.exe --outfile "%%b" --delexthtype 501 "%%b">null 2>&1

C:\Users\m0ngr31\desktop\kindle\mobi2mobi.exe "%%b" > temp1.txt
findstr /i "longtitle" temp1.txt > temp2.txt
set /p title1=<temp2.txt
set title1=!title1:~11!

findstr /i "item: 100" temp1.txt > temp3.txt
set /p author1=<temp3.txt
set author1=!author1:~33!

python asin_search.py "!title1!" "!author1!" >temp4.txt

set /p temp2=<temp4.txt
set temp2=!temp2:~0!

call :movement %%b
)

:movement
find /c /i "b0" "temp4.txt">null 2>&1
if !ERRORLEVEL! EQU 0 goto :real
if !errorlevel! equ 1 goto :fake

:fake
C:\Users\m0ngr31\desktop\kindle\mobi2mobi.exe --outfile "%%b" --exthtype 113 --exthdata "!asin1!!asin3!!temp1!" "%%b">null 2>&1
echo Gave a fake ASIN number to: !title1!. It's new number is !asin1!!asin3!!temp1!
set /a temp1=!temp1!+1
goto final

:real
C:\Users\m0ngr31\desktop\kindle\mobi2mobi.exe --outfile "%%b" --exthtype 113 --exthdata "!temp2!" "%%b">null 2>&1
echo Gave a real ASIN number to: !title1!. It's new number is !temp2!

:final
C:\Users\m0ngr31\desktop\kindle\mobi2mobi.exe --outfile "%%b" --addexthtype 501 --exthdata "EBOK" "%%b">null 2>&1
del temp*.txt>null 2>&1
-Change the directory where I am pointing to mobi2mobi.exe (all places)
-Run the file!

Should be pretty straight-forward. It'll go through all the mobi files you have, search for the title and author of every book (so you need to have them correct in the meta info) on the kindle store and if it's there, it'll download the correct ASIN number, if it isn't there, it'll insert a random number.

It was kind of slopped together, and it's not perfect, but it seemed for me. Let me know if you run to any problems.

--edit
It wouldn't let me upload my python file, so save this as asin_search.py in the working directory
Code:
import sys
from amazonproduct import API

AWS_KEY = 'put your own key here'
SECRET_KEY = 'put your secret key here'
api = API(AWS_KEY, SECRET_KEY, "us")
node = api.item_search('KindleStore', Title=sys.argv[1], Author=sys.argv[2])

for book in node.Items.Item:
    print '%s' % (book.ASIN)

Last edited by m0ngr31; 01-18-2011 at 01:50 AM.
m0ngr31 is offline   Reply With Quote
Old 01-18-2011, 09:56 AM   #98
neonbible
Addict
neonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watch
 
Posts: 202
Karma: 10802
Join Date: Sep 2010
Device: Kindle Paperwhite, iPhone 5, iPad Air, Nexus 7
Quote:
Originally Posted by m0ngr31 View Post
It appears that it doesn't even need to line up with a book. It just has to match a certain template of number so that Amazon thinks it's legit.

AFAIK, any combination of string that looks like B00******* should work. As long as the book you are trying to read with your different devices share the same ASIN number, it should work.
Great! I must try this sometime.
neonbible is offline   Reply With Quote
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
Old 01-18-2011, 03:39 PM   #100
m0ngr31
Connoisseur
m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.m0ngr31 could sell banana peel slippers to a Deveel.
 
Posts: 66
Karma: 3056
Join Date: Dec 2010
Device: Kindle Paperwhite
Yeah, it was meant as a "run once" type of program. If you run it once and use those as the original files, you shouldn't run into any problems.

I'll write a bash script in the next day or two that will do the same as the windows one I wrote last night. That way if it's a book sold on the amazon store at least it'll have the same ASIN number. That way it won't change if you run it again.
m0ngr31 is offline   Reply With Quote
Old 01-19-2011, 04:46 AM   #101
neonbible
Addict
neonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watch
 
Posts: 202
Karma: 10802
Join Date: Sep 2010
Device: Kindle Paperwhite, iPhone 5, iPad Air, Nexus 7
So if the book isn't in Kindle store, do you just create your own ASIN? Someone mentioned I can use the pBook (does that mean printed?) but not all have one.
neonbible is offline   Reply With Quote
Old 01-19-2011, 05:02 AM   #102
Edzilla
Member
Edzilla began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Dec 2008
Device: none
Quote:
Originally Posted by neonbible View Post
So if the book isn't in Kindle store, do you just create your own ASIN? Someone mentioned I can use the pBook (does that mean printed?) but not all have one.
You can simply create a random ASIN, yes. it has to look like this: B00xxxxxxx
Edzilla is offline   Reply With Quote
Old 01-19-2011, 05:10 AM   #103
neonbible
Addict
neonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watch
 
Posts: 202
Karma: 10802
Join Date: Sep 2010
Device: Kindle Paperwhite, iPhone 5, iPad Air, Nexus 7
And xxxxxxx can be any combination of alpha-numeric characters? I could use the title of book so im sure there arent any conflicts.
neonbible is offline   Reply With Quote
Old 01-19-2011, 05:41 AM   #104
Edzilla
Member
Edzilla began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Dec 2008
Device: none
Quote:
Originally Posted by neonbible View Post
And xxxxxxx can be any combination of alpha-numeric characters? I could use the title of book so im sure there arent any conflicts.
I'm not sure. When generating an ASIN, I've only used random numbers, but an "official" ASIN contains both numbers and letters (B004G60EHS), so it probably does work. You should try and see if it does.
Edzilla is offline   Reply With Quote
Old 01-19-2011, 06:39 AM   #105
neonbible
Addict
neonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watchneonbible is clearly one to watch
 
Posts: 202
Karma: 10802
Join Date: Sep 2010
Device: Kindle Paperwhite, iPhone 5, iPad Air, Nexus 7
Hurrah it works! Great discovery. Thanks to all.
neonbible is offline   Reply With Quote
Reply

Tags
kindle 3, sideloading, sync "furthest page read", whispernet, whispersync


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sideloading MOBI files to Kindle for iPad GRiker Devices 34 08-31-2012 06:02 AM
Whispersync question stustaff Amazon Kindle 11 12-15-2010 08:39 PM
Sideloading with Kindle app? Maggie Leung Apple Devices 10 08-01-2010 09:46 PM
Anyone with a U.S. only K2 have whispersync access outside the U.S? Sheebrook Amazon Kindle 3 06-10-2010 08:58 PM
Whispersync question gandor62 Amazon Kindle 3 03-12-2010 03:54 PM


All times are GMT -4. The time now is 05:02 AM.


MobileRead.com is a privately owned, operated and funded community.