tblancher / pymazon

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

amz's with playlist entries parse incorrectly #58

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Using whatever method you need to (e.g. in Linux spoofing your User Agent), 
create a playlist on Amazon CloudPlayer and attempt to download that playlist 
(or the songs in it). Otherwise, you can try the amz file, attached. (The songs 
are ones I own distribution rights to)

What is the expected output? What do you see instead?
In a properly functioning version of pymazon (see 
code.google.com/p/michaelstrecke-pymazon for a patch that can handle amz's 
without 'fileSize' or 'image') the tracks from that playlist should show up in 
one way or another.

They do show up, but pymazon has also created extra, essentially blank 
TreeModel entries for each track that was in the playlist. (See attached 
screenshot).

What version of the product are you using? On what operating system?
Pymazon 0.9.1 (actually, the clone listed above)
Python 2.7
Ubuntu 12.04.1

Please provide any additional information below.
I've created (and attached) a patch for parser.py that handles these entries by 
ignoring them. Ideally the playlists would be parsed and the associated tracks 
would be added to a Playlist class and handled in that way.

Original issue reported on code.google.com by jsphs...@gmail.com on 10 Oct 2012 at 3:19

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Attached is a more extensive patch, hopefully following in the original vein of 
this project. It takes the Amazon ASIN numbers listed for each entry in the 
'playlists' section of the file and creates Playlist objects, similar to Album 
objects, and groups tracks first by playlist, then by album.

See the screenshot.

And just for good measure, I zipped the whole thing up and attached it below.

Original comment by jsphs...@gmail.com on 10 Oct 2012 at 7:56

GoogleCodeExporter commented 8 years ago
This seems to be caused by the fact that pymazon did not skip the <extension> 
block and got confused by the <trackList> there.

I fixed it my clone repo.

Original comment by Michael.Strecke on 11 Oct 2012 at 12:20

GoogleCodeExporter commented 8 years ago
I guess it's a design decision which way you/we want to go with this.

The first way, like you've done, and like my initial patch sort of did, is to 
simply ignore the information in the <extension> block.

The second way, like my second patch did, is to check if a playlist is defined, 
and if so to organize its contents as part of that playlist instead of as parts 
of separate albums.

I prefer the second method, and I created my second patch for the following 
reason:
The playlist structure that exists in the amz files that cause this problem 
exists specifically because the user created that playlist. Thus, it makes 
sense to organize the downloaded tracks as part of a playlist and not as part 
of an album.

Original comment by jsphs...@gmail.com on 11 Oct 2012 at 2:28

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Could you please lay out step by step, how to apply this patch?  I keep getting 
this error:

"$ patch -p0 < pymazon-playlists.patch
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 michaelstrecke-pymazon/pymazon/core/item_model.py 
pymazon-playlists/pymazon/core/item_model.py
|--- michaelstrecke-pymazon/pymazon/core/item_model.py  2012-10-10 
14:34:42.141701510 -0500
|+++ pymazon-playlists/pymazon/core/item_model.py   2012-10-10 14:16:39.165723513 
-0500
--------------------------
File to patch: "

Original comment by deerewri...@gmail.com on 26 Oct 2012 at 1:32

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I've created a clone repository to hold these changes. You can browse it at 
http://code.google.com/r/jsphslgr-pymazon
To download the source, install Mercurial and run:
hg clone https://code.google.com/r/jsphslgr-pymazon/

Original comment by jsphs...@gmail.com on 4 Nov 2012 at 3:18

GoogleCodeExporter commented 8 years ago
I can't seem to get Amazon to give me a .amz file anymore, not even with the 
useragent set to something windowzish.  Anyone have a trick for that?

Original comment by juergenb...@gmail.com on 20 Mar 2013 at 5:53

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Thanks, jsphslgr, for working on pymazon. I downloaded your zip file from 
http://code.google.com/r/jsphslgr-pymazon/source/browse and unzipped it. I 
renamed my ~/Downloads/pymazon directory to ~/Downloads/pymazon.old, and then 
from within the ~/Downloads/jsphslgr-pymazon-c04e94386c4b/ directory that was 
created by "unzip", I ran
          sudo python setup.py install

Something isn't working right. When I ran pymazon after that install operation, 
I was able to load the .amz file, but when I clicked the Download button, I got 
an error alert that said something about not having permission to write to the 
target directory (the target was ~/Downloads/pymazon/). I am the owner of that 
directory. I opened the Preferences anyway, but was unable to edit the textbox 
that contained the target directory. I'm pretty sure your clone rather than the 
original pymazon is running, because I never had this permission issue with the 
original.

I tried starting pymazon as root (sudo pymazon) but got the same result (lack 
of permission or authorization, I forget exactly what term was used).

I renamed the jsphslgr-pymazon-c04e94386c4b/ directory to pymazon/. I don't 
think that had any obvious effect.

I edited ~/.pymazon/pymazonrc and changed the target directory to ~/Downloads/. 
That got rid of the error about permissions, but then I got the same result I 
was trying to cure by installing your clone, that is, pymazon reports that it's 
connecting, but the download never starts, and there's maybe 20 lines of output 
in the console that suggest a problem with the URL. The output is attached. 

Should I have downloaded the zip file from your Oct. 12, 2012 post above 
instead of the zipfile from the google site that I listed above? Or, if I 
understood how to apply parser.patch I would try that. 

Thanks for any ideas. 

Original comment by Will.Sti...@gmail.com on 21 Jan 2014 at 2:13

Attachments:

GoogleCodeExporter commented 8 years ago
The permissions problem seems unfamiliar to me. If you're getting the error as 
a popup dialog, either the directory doesn't exist, or you don't have 
permission to write to it. One thing you may check is whether your pymazonrc 
file uses the ~ for your home folder - you must explicitly include the path, 
because pymazon/python will not expand that for you. So you would need the line 
to say "save_dir = /home/USERNAME/Downloads/".

The urllib error seems a touch more familiar, and looks like an older version 
of pymazon. I would suggest you remove your old installation and try 
reinstalling. If you installed using default settings you would want to remove:
/usr/local/lib/python2.7/dist-packages/pymazon/
/usr/local/bin/pymazon
/usr/local/lib/python2.7/dist-packages/Pymazon-0.9.1.egg-info

If you installed with the --user flag you would want to remove:
~/.local/lib/python2.7/site-packages/pymazon/
~/.local/bin/pymazon
~/.local/lib/python2.7/site-packages/Pymazon-0.9.1.egg-info

Then go back to ~/Downloads/pymazon and try installing again
sudo python setup.py install

Original comment by jsphs...@gmail.com on 21 Jan 2014 at 5:53