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 10-27-2011, 01:23 AM   #46
robcohen
Enthusiast
robcohen began at the beginning.
 
Posts: 37
Karma: 10
Join Date: Jun 2008
Device: Kindle and Kindle Touch
Incidentally, the error message about the "I" character in your new batch code is my fault. I included a line of your message when I copied the script. Must be a sign I should give it up for the night:-)

Will poke around and test to see if my books auto-sync the last page between the various devices. That would be awesome. Would be nice to have the right ASINs but not sure it really matters in terms of function except side-loaded books wouldn't show up in my library when I view from amazon.com/myk but then not sure they would even with correct ASINs if I didn't purchase through Amazon. I always tweak the metadata and re-convert in Calibre anyway.

Thanks for the assist.

Rob

Rob
robcohen is offline   Reply With Quote
Old 10-27-2011, 01:29 AM   #47
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
At just a quick look, I'm not sure why it's throwing that error... But I'm not sure it's affecting the data being saved. That said, I'd just reconvert them in Calibre just in case, and see if you're able to sync across your devices.
m0ngr31 is offline   Reply With Quote
Advert
Old 11-02-2011, 12:01 AM   #48
SetMeOnFire
Junior Member
SetMeOnFire began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Nov 2011
Device: Android
I apologize for coming late to the discussion, but I have a problem that I can't seem to sort out on my own.

I'm fairly sure I've followed all the instructions correctly and I've removed everything and started over from the beginning two times, but I get the same error each time.

The batch file seems to apply fake ASINs to all my books just fine, and I'll be content with that if I have to, but I'd like the real ones.

The error I get is "ImportError: No module named amazonproduct"

I've installed "python-amazon-product-api" using two of the methods on it's homepage. The "setup.py install" from a command prompt, and the "easy_install python-amazon-product-api" using setuptools from a command prompt.

Any help would be appreciated, and thank you in advance for the work you've already done, m0ngr31.
SetMeOnFire is offline   Reply With Quote
Old 11-02-2011, 02:46 AM   #49
robcohen
Enthusiast
robcohen began at the beginning.
 
Posts: 37
Karma: 10
Join Date: Jun 2008
Device: Kindle and Kindle Touch
er, me too

I'm getting the same result as you, all fake ASINs and I've redone my setup at least four times. Something new today is the message below:

amazonproduct.errors.AWSError: AWS.MissingParameters: Your request is missing required parameters. Required parameters include AssociateTag.

Looks like there is a new required parameter for the API effective 11/1/2011. There is an announcement and then more detail here

I went to affiliate-program.amazon.com and signed up and a google search tells me the tracking id shown on that page when I'm signed in is apparently my AssociateTag.

How to pass it to the API is a mystery to me. Maybe the Python wrapper needs an update?

As for the other problem, maybe M0ngr31 will check in. He's probably busy with his day job.

Rob
robcohen is offline   Reply With Quote
Old 11-02-2011, 05:22 PM   #50
robcohen
Enthusiast
robcohen began at the beginning.
 
Posts: 37
Karma: 10
Join Date: Jun 2008
Device: Kindle and Kindle Touch
Need to add a bit to asin_search.py

Hi SetMeOnFire,
Received a note today from the guy Sebastian who maintains bitbucket which (maybe) takes care of the wrapper for the api. He said to use:
Code:
{{{
#!python

api = amazonproduct.API(AWS_KEY, SECRET_KEY, locale='us', AssociateTag='...')
}}}
However I found what I needed was just to make these two changes to the asin_search.py code AFAIK.

After the line:
SECRET_KEY = '..........'
insert this line:
Code:
AssociateTag='....'
Be sure to include your actual AssociateTag value instead of the dots.

Change this one line to add the additional parameter:
api = API(AWS_KEY, SECRET_KEY, "us")
Code:
api = API(AWS_KEY, SECRET_KEY, "us", AssociateTag)
That seems to work for me (sort of). I'm still seeing this error:
AttributeError: 'LxmlItemSearchPaginator' object has no attribute 'Items'
and the counters I to count how many real vs. fake ASINs are assigned is showing all fake after about 10% of my books are processed.

I think there's probably still an issue that's causing all fake ASINs. Also when I reviewed a few of the books processed now even the fake ASIN is not there when I check the mobi file with Mobi2MobiGUI. However if I re-convert the book in Calibre, then the -113 record appears but the fake ASIN looks suspect to me. Here's an example:
EXTH item: 113 - ASIN - 36 - 417b3131-26b4-46e4-bb85-2cfaad5a9117
Looks like hex being produced because character string is not alpha-numeric. First few bytes are:
A{11&'

One step forward and two steps back...

Rob


Quote:
Originally Posted by SetMeOnFire View Post
I apologize for coming late to the discussion, but I have a problem that I can't seem to sort out on my own.

I'm fairly sure I've followed all the instructions correctly and I've removed everything and started over from the beginning two times, but I get the same error each time.

The batch file seems to apply fake ASINs to all my books just fine, and I'll be content with that if I have to, but I'd like the real ones.

The error I get is "ImportError: No module named amazonproduct"

I've installed "python-amazon-product-api" using two of the methods on it's homepage. The "setup.py install" from a command prompt, and the "easy_install python-amazon-product-api" using setuptools from a command prompt.

Any help would be appreciated, and thank you in advance for the work you've already done, m0ngr31.
robcohen is offline   Reply With Quote
Advert
Old 11-11-2011, 08:33 PM   #51
robcohen
Enthusiast
robcohen began at the beginning.
 
Posts: 37
Karma: 10
Join Date: Jun 2008
Device: Kindle and Kindle Touch
Exclamation Python code now fixed - mobi2mobi is broken as far as I can tell

Hey there SMOF,
After some fiddling the Python code in asin_search.py is now fixed and runs perfectly producing real ASINs when it finds them on Amazon. This produces correct ASINs as expected.


Here's the updated asin_search.py code:

Code:
import sys
from amazonproduct import API

AWS_KEY = '........................................'
SECRET_KEY = '.....................................................'
ASSOCIATE_TAG='..........................'

api	 = API(AWS_KEY, SECRET_KEY, "us", ASSOCIATE_TAG)

for book in api.item_search('KindleStore', Title=sys.argv[1], Author=sys.argv[2]):
	for book in book.Items.Item:
		print '%s' % (book.ASIN)
Thanks to m0ngr31 & Sebastian for getting me headed in the right direction.
Rob

Quote:
Originally Posted by SetMeOnFire View Post
I apologize for coming late to the discussion, but I have a problem that I can't seem to sort out on my own.

I'm fairly sure I've followed all the instructions correctly and I've removed everything and started over from the beginning two times, but I get the same error each time.

The batch file seems to apply fake ASINs to all my books just fine, and I'll be content with that if I have to, but I'd like the real ones.

The error I get is "ImportError: No module named amazonproduct"

I've installed "python-amazon-product-api" using two of the methods on it's homepage. The "setup.py install" from a command prompt, and the "easy_install python-amazon-product-api" using setuptools from a command prompt.

Any help would be appreciated, and thank you in advance for the work you've already done, m0ngr31.

Last edited by robcohen; 11-20-2011 at 05:40 AM.
robcohen is offline   Reply With Quote
Old 11-12-2011, 02:05 AM   #52
robcohen
Enthusiast
robcohen began at the beginning.
 
Posts: 37
Karma: 10
Join Date: Jun 2008
Device: Kindle and Kindle Touch
Thumbs up There's no other problem - it works!!

Hi,
Just did a little more testing, this time end to end with my Kindle 1 and Xoom.

The 36 character ASIN is not a problem and it showed up on a new book I had not run through this process so I don't expect these will be a problem either. Will re-convert everything and check a few on both devices later in the week/end.

Only issue I could see was a need to Sync to furthest page on the devices other than the one where I was originally reading the book. Also you have to Sync & Check for Items on the original device when you close the book or it seems the furthest page counter is not updated.

Not completely automatic but something I can live with now I understand a bit more about how it works. I was thinking if I opened a book on my Kindle and read a few pages then went back to Home it would automatically update the page-read counter in the cloud so when I opened the same book on my Xoom it would automatically open to the page where I left off reading on the Kindle.

So, the updated Python code for asin_search.py appears to be good. Sebastian gave me a few basic Python hints and suggested a free book on Python as a resource, Dive Into Python by Mark Pilgrim.

Will edit my previous post(s) to remove my complaint about the odd formatting of the ASIN. It must be one of those esoteric things that Kovid keeps up with in order for Calibre to keep running so well.

Rob
robcohen is offline   Reply With Quote
Old 11-19-2011, 10:48 PM   #53
Bismar
Connoisseur
Bismar has learned how to read e-booksBismar has learned how to read e-booksBismar has learned how to read e-booksBismar has learned how to read e-booksBismar has learned how to read e-booksBismar has learned how to read e-booksBismar has learned how to read e-booksBismar has learned how to read e-books
 
Posts: 76
Karma: 928
Join Date: Jul 2008
Location: Down Under
Device: Kobo eReader
Ok, after some annoying issues with mobi2mobi sometimes parsing the file as binary, and that using the search for the author field with search term 'Author' instead of 'item: 100' is stupid as the tag description or excerpt might have the word author in it, here's a much more stringent bash .sh file.

There's only 3 small changes, and it now works for all my files

Code:
#!/bin/bash

count1=0
asin1="B00"

FILES="*.mobi"

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

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
mobi2mobi --outfile "$f" --delexthtype 113 "$f"> /dev/null 2>&1
mobi2mobi --outfile "$f" --delexthtype 501 "$f"> /dev/null 2>&1

author=$(mobi2mobi "$f" | grep -a "item: 100" | cut -d- -f4)
title=$(mobi2mobi "$f" | grep -a LONGTITLE | cut -c11-100)

echo "Author is $author, and Title is $title"

python asin_search.py "$title" "$author">asin.txt
search1=`head -n 1 asin.txt`

if [ "$search1" ]
then
mobi2mobi --outfile "$f" --exthtype 113 --exthdata $search1 "$f"> /dev/null 2>&1
echo "Gave a real ASIN number to: $title. It's new number is $search1"
else
mobi2mobi --outfile "$f" --exthtype 113 --exthdata $asin1$rand2$rand1 "$f"> /dev/null 2>&1
echo "Gave a fake ASIN number to: $title. It's new number is $asin1$rand2$rand1"
rand1=$[$rand1+1]
fi

mobi2mobi --outfile "$f" --addexthtype 501 --exthdata "EBOK" "$f"> /dev/null 2>&1
rm asin.txt
continue
fi
done
Bismar is offline   Reply With Quote
Old 12-19-2011, 01:40 PM   #54
orgabeke
Junior Member
orgabeke began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Dec 2011
Device: iPad
Error message when running amazon.sh

Hi,
I think I have everything installed correctly on my Mac but I get this error when running the amazon.sh script:
./amazon2.sh: line 34: mobi2mobi: command not found
./amazon2.sh: line 35: mobi2mobi: command not found

I can run mobi2mobi manually without errors. Amazon.sh script is in the same folder as mobi2mobi. This is probably due to something easy, but I´m not a very advanced user. Any help will be greatly appreciated.

Thanks in advance.

Regards,
GB
orgabeke is offline   Reply With Quote
Old 12-19-2011, 02:09 PM   #55
shinew
Addict
shinew ought to be getting tired of karma fortunes by now.shinew ought to be getting tired of karma fortunes by now.shinew ought to be getting tired of karma fortunes by now.shinew ought to be getting tired of karma fortunes by now.shinew ought to be getting tired of karma fortunes by now.shinew ought to be getting tired of karma fortunes by now.shinew ought to be getting tired of karma fortunes by now.shinew ought to be getting tired of karma fortunes by now.shinew ought to be getting tired of karma fortunes by now.shinew ought to be getting tired of karma fortunes by now.shinew ought to be getting tired of karma fortunes by now.
 
Posts: 309
Karma: 1008082
Join Date: Feb 2009
Location: NYC
Device: Kindle PW, K4 Touch, iPad2, Samsung Galaxy S II
you need to have your mobiperl linked or added to your executable path.
shinew is offline   Reply With Quote
Old 12-20-2011, 01:23 AM   #56
orgabeke
Junior Member
orgabeke began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Dec 2011
Device: iPad
Quote:
Originally Posted by shinew View Post
you need to have your mobiperl linked or added to your executable path.
Thanks for replying. I'll double check that. But if that is the case, why doesn't it complain about not finding the command when mobi2mobi is called earlier in the script?

Edit: You were right! Thanks!

Last edited by orgabeke; 12-20-2011 at 10:36 AM.
orgabeke is offline   Reply With Quote
Old 12-20-2011, 10:14 AM   #57
shinew
Addict
shinew ought to be getting tired of karma fortunes by now.shinew ought to be getting tired of karma fortunes by now.shinew ought to be getting tired of karma fortunes by now.shinew ought to be getting tired of karma fortunes by now.shinew ought to be getting tired of karma fortunes by now.shinew ought to be getting tired of karma fortunes by now.shinew ought to be getting tired of karma fortunes by now.shinew ought to be getting tired of karma fortunes by now.shinew ought to be getting tired of karma fortunes by now.shinew ought to be getting tired of karma fortunes by now.shinew ought to be getting tired of karma fortunes by now.
 
Posts: 309
Karma: 1008082
Join Date: Feb 2009
Location: NYC
Device: Kindle PW, K4 Touch, iPad2, Samsung Galaxy S II
what script are you running? If it's the one from the OP, there is no mobi2mobi on line 33 & 34. if you meant the error from line 31 & 32, there is no prior occurrence of calling mobi2mobi.
shinew is offline   Reply With Quote
Old 12-20-2011, 10:38 AM   #58
orgabeke
Junior Member
orgabeke began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Dec 2011
Device: iPad
Quote:
Originally Posted by shinew View Post
what script are you running? If it's the one from the OP, there is no mobi2mobi on line 33 & 34. if you meant the error from line 31 & 32, there is no prior occurrence of calling mobi2mobi.
I´m running the script found in this thread and when I count the lines it is line 33 and 34. Not important though, adding the folder where mobi2mobi is to the path solved the problem.
orgabeke is offline   Reply With Quote
Old 02-07-2012, 01:20 PM   #59
leefa
Member
leefa began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Apr 2011
Device: Kindle/Android
I run the script and it runs fine. I added a statement to print out the mobi info after update and it looks right, but when I open it in mobi2mobiGUI, the changes aren't there. any ideas?

"C:\downloads\mobi\Mobi2Mobi_GUI_VB_v10\mobi2mobi. exe" "!filename!"

***UPDATE*** there were some invalid characters in the last item in the mobi info. this caused the updates not to show in the GUI

Last edited by leefa; 02-07-2012 at 01:24 PM. Reason: more info
leefa is offline   Reply With Quote
Old 02-16-2012, 08:35 AM   #60
aid4n
Junior Member
aid4n began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Feb 2012
Device: kindle touch
Hi all. I've been using this script for awhile now successfully and I've recently reformatted my computer and reinstalled everything. I copied my old folder that stored all the executables and scripts and for some reason I'm now getting an error. Anybody know what I am doing wrong this time around?

This is the error I get when I execute.

edit: On a related note, I was wondering if this can now be done through Calibre and still retain sync information, etc?

Last edited by aid4n; 02-16-2012 at 08:51 AM.
aid4n is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ePub meta data brudigia ePub 4 07-26-2010 12:58 PM
set meta data with ebook-meta and ebook-convert krischik Calibre 6 01-19-2010 11:40 AM
Setting meta data with ebook_meta. krischik Calibre 6 01-15-2010 11:17 AM
Meta data problems melhall Sony Reader 1 03-31-2008 10:58 PM
PRS-500 Meta Data in Vista not available Gamgee72 Sony Reader Dev Corner 2 09-12-2007 05:12 PM


All times are GMT -4. The time now is 06:03 PM.


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