tblancher / pymazon

Automatically exported from code.google.com/p/pymazon
Other
0 stars 0 forks source link

Files do not download properly #53

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Note: Amazon no longer allows Linux users to download *.amz files from their 
Cloud music player, but still allows these files for new MP3 purchases.

1. Purchase an album (for example, http://amzn.com/B003IYOR9A), download *.amz 
file, and open with Pymazon
2. Click Download.

What is the expected output? What do you see instead?
Obviously I expect it to start downloading files, but the downloads don't 
start, and the text over their progress bars says "Connecting..."

Related, if I use Firefox with a Windows user agent I get files that work 
properly with Pymazon. The files appear to contain valid URLs, but I haven't 
done much debugging.

What version of the product are you using? On what operating system?
Pymazon 0.9.1, on Linux, Python 2.7

Please provide any additional information below.
Pymazon error log is attached.

Original issue reported on code.google.com by jsphs...@gmail.com on 20 Sep 2012 at 5:20

Attachments:

GoogleCodeExporter commented 8 years ago
Upon a quick look, it appears that the *.amz files that I get from purchasing 
an album do not contain a fileSize parameter, no matter whether they are 
downloaded under a Linux or Windows user agent.

Original comment by jsphs...@gmail.com on 20 Sep 2012 at 5:37

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
OK, I'm attaching my patch. This isn't very elegant, but it definitely works.

*If the 'fileSize' element isn't found its value is estimated from the duration 
(assuming 256 kbps mp3s, which is at least heuristically correct).

*If the 'image' element (the thumbnail url) isn't found it's guessed based on 
the standard url format for Amazon product thumbnail images.

Consequently the parser now recognizes the following three tags:
*'duration'
*'ASIN'
*'albumASIN'

Original comment by jsphs...@gmail.com on 23 Sep 2012 at 5:03

GoogleCodeExporter commented 8 years ago
Found some errors in the first diff.

Original comment by jsphs...@gmail.com on 23 Sep 2012 at 8:10

GoogleCodeExporter commented 8 years ago
Hello,

i was trying to apply your patch to the pymazon source, can you help me to do 
this?
"patch -p1 <"  was only give an error message that the patch input is garbage.

I have also tried to insert the diff manualy at the files item_model.py and 
parser.py
but uhhh i am not a programmer ;) so the files compile fine when i install with 
setup.py but when i tried to load an .amz file nothing appears and nothing 
happan :(

Can you help me pls...thank you

Original comment by salvadu....@googlemail.com on 8 Oct 2012 at 8:48

GoogleCodeExporter commented 8 years ago
Well, what I attached was a *.diff file, and in all honesty I don't remember 
how to apply such a file now that I think about it.

However, I've created a *.patch file that should do the trick.
Save the patch file in the same folder that you save the source tarball in 
(e.g. ~/Downloads/).

Then, the following commands should patch the source and install it:
tar -xf Pymazon-0.9.1.tar.gz
patch -p0 < pymazon.patch
cd pymazon
chmod +x setup.py
./setup.py install --user (or sudo ./setup.py install)

Original comment by jsphs...@gmail.com on 8 Oct 2012 at 9:42

Attachments:

GoogleCodeExporter commented 8 years ago
Wow, thank you! 
well, a diff file is not a patch, but i was thinking that there is an python 
patch tool to do this... so there isn't ;)

Now all the files are load right and the download is ok, but there is another 
Problem:

Make a Playlist with some Tracks, click all Tracks at the Playlist and download 
the amz file. Then load the amz with pymazon.
I have two results:

Vanilla pymazon - the Tracks are shown with some weird Media Files? If you 
click download, pymazon hangs at "connecting".

With patch pymazon - Nothing was shown,,, here is the Traceback from the console

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/pymazon/qt/ui.py", line 150, in on_actionLoadFiles_triggered
    self.new_amz()
  File "/usr/local/lib/python2.7/site-packages/pymazon/qt/ui.py", line 183, in new_amz
    self.load_new_amz_files(files)
  File "/usr/local/lib/python2.7/site-packages/pymazon/qt/ui.py", line 188, in load_new_amz_files
    parser.parse(f)
  File "/usr/local/lib/python2.7/site-packages/pymazon/core/parser.py", line 213, in parse
    self.parser.Parse(xml)        
  File "/usr/local/lib/python2.7/site-packages/pymazon/core/parser.py", line 93, in end_element
    self.add_track()
  File "/usr/local/lib/python2.7/site-packages/pymazon/core/parser.py", line 170, in add_track
    self.add_track_to_album(new_album)
  File "/usr/local/lib/python2.7/site-packages/pymazon/core/parser.py", line 176, in add_track_to_album
    self.current_track['filesize']=str(32768*int(self.current_track['duration'])/1000)
ValueError: invalid literal for int() with base 10: ''

So, i think the Problem are the Playlist amz from the Cloud Player. Is there 
any fix for this, do you need my amz??

cu

Original comment by salvadu....@googlemail.com on 9 Oct 2012 at 8:04

GoogleCodeExporter commented 8 years ago
I don't think I need the amz files. Almost certainly the problem is similar to 
that from before. Pymazon is very dependent on a certain set of properties 
being in the *.amz files, and without those properties it fails.

When I say my patch is hacky it's because it is really only targeted at one use 
case: downloading tracks that have been purchased. In order to really solve 
this, we'd need a patch that checked if the necessary fields (fileSize and 
image, and now 'duration') exist, and if they don't, react gently.

For the missing 'fileSize' property that probably means replacing the moving 
progress bar with a solid "processing" bar. For the 'image' field that would 
mean not trying to download the image.

Unfortunately, my knowledge of Python is very limited. I'm going to play around 
with it a bit, but this problem will probably require some work by someone more 
experienced than I.

Original comment by jsphs...@gmail.com on 9 Oct 2012 at 8:15

GoogleCodeExporter commented 8 years ago
Ok, thanks for your help. 
As a Workaround i don't create the amz File in the Playlist, instead i choose 
my files in the Overview and click Download.

cu

Original comment by salvadu....@googlemail.com on 14 Oct 2012 at 6:47

GoogleCodeExporter commented 8 years ago
You can find a working patch in Issue 58 that both fixes this issue and 
downloads the playlists in a group. (For file renaming the Album is replaced 
with the playlist name).

Original comment by jsphs...@gmail.com on 14 Oct 2012 at 8:29

GoogleCodeExporter commented 8 years ago
I've created a clone of this project and implemented some changes with take 
care of these problems - until Amazon creates new ones... :-)

See links at the top "Source" - "Clones" - "michaelstrecke-pymazon"

Original comment by Michael.Strecke on 14 Oct 2012 at 8:33

GoogleCodeExporter commented 8 years ago
Yeah, this works for me, thank you !!! hope Amazon stop bashing Linuxusers ;)

Original comment by salvadu....@googlemail.com on 16 Oct 2012 at 10:35

GoogleCodeExporter commented 8 years ago
I was having the problem with pymazon not connecting, so I applied the patch as 
above.  Now I just get "error" on each file of an amz album.  I also tried the 
patches in "Issue 58", but was unsuccessful patching - see comment there.  Then 
I tried removing the pymazon folder and rebuilding/installing without the 
patches.  Now I still get the error messages on each file and the following 
console output:

"~$ pymazon
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pymazon/qt/ui.py", line 242, in update_album_info
    self.update_album_art()
  File "/usr/local/lib/python2.7/dist-packages/pymazon/qt/ui.py", line 246, in update_album_art
    img = self.current_album.image
  File "/usr/local/lib/python2.7/dist-packages/pymazon/core/item_model.py", line 100, in image
    return url_image_cache.get(self.image_url)
  File "/usr/local/lib/python2.7/dist-packages/pymazon/util/image.py", line 51, in get
    return self.cache.setdefault(url, self._factory(url))      
  File "/usr/local/lib/python2.7/dist-packages/pymazon/util/image.py", line 45, in _factory
    pixbuf = self._download(url)
  File "/usr/local/lib/python2.7/dist-packages/pymazon/util/image.py", line 38, in _download
    handle = urllib2.urlopen(url)
  File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 392, in open
    protocol = req.get_type()
  File "/usr/lib/python2.7/urllib2.py", line 254, in get_type
    raise ValueError, "unknown url type: %s" % self.__original
ValueError: unknown url type:"

Is my install fubared?

Original comment by deerewri...@gmail.com on 26 Oct 2012 at 2:00

Attachments:

GoogleCodeExporter commented 8 years ago
Your Oct 8, 2012 patch works! Thanks a ton! Pymazon is awesome.

Original comment by cuc...@gmail.com on 16 Nov 2012 at 4:55

GoogleCodeExporter commented 8 years ago
Comment 13:
Amazon's been changing some things around on their servers. My original patch 
was pretty hacky, and better programmers than I have come up with more 
effective fixes. I believe the error that you're encountering (your AMZ file is 
missing <image> tags) was fixed. Using patchfiles is a clumsy way to keep 
pymazon updated. See below.

Comment 14:
Be advised that the Oct 8 patch was an incomplete solution. If you're going to 
be running a patched version I would suggest that you use either my or 
michaelstrecke's cloned repository:
http://code.google.com/r/michaelstrecke-pymazon/source/checkout
http://code.google.com/r/jsphslgr-pymazon/source/checkout

In case you don't have a Mercurial client, you can download my current version 
source here:
https://www.dropbox.com/s/bn73m2euhkmpugk/jsphslgr-pymazon.zip

Original comment by jsphs...@gmail.com on 16 Nov 2012 at 5:27

GoogleCodeExporter commented 8 years ago
So, are there any plans to add the fixes that are found in michaelstrecke's or 
jsphslgr's source?

Original comment by schnitze...@gmail.com on 4 Jan 2014 at 10:44

GoogleCodeExporter commented 8 years ago
Wow, somehow this thread still manages to be useful. I downloaded jsphslgr's 
pymazon from the Mercurial repo and it works like a charm! Nice work. =)

Original comment by cuc...@gmail.com on 23 May 2014 at 6:28

GoogleCodeExporter commented 8 years ago
Given that it's 2015 this is probably a blast from the past for you all, but I 
need some assistance:
I have the patch, I followed the instructions above, and this is the output of 
the command "pymazon$ patch -p0 < pymazon.patch"

=== Output of the command ===
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -rupNb pymazon/pymazon/core/item_model.py 
pymazon.new/pymazon/core/item_model.py
|--- pymazon/pymazon/core/item_model.py 2011-10-15 13:12:00.000000000 -0500
|+++ pymazon.new/pymazon/core/item_model.py     2012-10-08 16:27:32.813401218 
-0500
--------------------------
File to patch: 

=== end of output ===
That's it. 

Any ideas?
Thanks in advance.

Original comment by raphaela...@gmail.com on 28 Jul 2015 at 6:47

GoogleCodeExporter commented 8 years ago
I would recommend against using the patch. It was pretty iffy when I posted it 
originally, and like I've written above it has been supplanted by a different 
set of changes and is available in the two repos posted above. The Dropbox link 
matches my repo.

In addition to the Google Code repos above, someone created a BitBucket repo to 
rehost the code and to clean up the documentation. It is available at the 
following link:
https://bitbucket.org/wookie/pymazon/downloads

Original comment by jsphs...@gmail.com on 29 Jul 2015 at 5:48

GoogleCodeExporter commented 8 years ago
However, if you really, really want to use the patch, I just tested it and 
didn't find any problems. Make sure that you don't 'cd' into the pymazon folder 
- the patch command as specified assumes that you are in the directory in which 
you extracted the source tarball.

Original comment by jsphs...@gmail.com on 29 Jul 2015 at 5:55