Open trevorgithub opened 5 years ago
I was able to use the sample
search.py
to look up a particular artist album. That worked great. Then I used the returnedalbum_id
as an argument toplay-album.py
Could you give me an example of the search you used, and the JSON you got back? Searching's still a bit rough around the edges, but the JSON I get back from Amazon for that ASIN is:
{
"trackList": [],
"albumList": [],
"artistList": [],
"playlistList": [],
"metadata": {
"trackList": null,
"albumList": null,
"artistList": null,
"playlistList": null
}
}
So, I'm not sure what happened, but now I can't even search for an album. Looks like a configuration issue on my side. Now, when I run this:
python examples/search.py Adele 25
The output I get is:
Traceback (most recent call last): File "examples/search.py", line 19, in <module> from amazonmusic import AmazonMusic ImportError: No module named amazonmusic
I'm running the command from the folder that contains amazonmusic.py. I was prompted for my credentials the first time, and after supplying them, I got the above error message. I thought maybe I messed with the source in some way (I'm not a python programming), but git status
shows no changes. To be safe, I cloned the repository again, but got the same resutls. This part was working before, so I feel like this is a user error....
I got past my earlier ImportError problem by first using this command:
export PYTHONPATH='.'
at the terminal,in the folder containing amazonmusic.py. I then typed this at the command line:
python examples/search.py Adele 25
And I got some reasonable output. Here's a small subset:
{ "blockRef": "1|T|4|6|HH65XDRKRMP71MADWCX1|0|0|0|B073JDL2G5|-1|null", "document": { "__type": "com.amazon.music.platform.model#CatalogAlbum", "artFull": { "URL": "https://m.media-amazon.com/images/I/A170tH1apiL._AA500.jpg", "__type": "com.amazon.music.platform.model#ArtURL", "artUrl": "https://m.media-amazon.com/images/I/A170tH1apiL._AA500.jpg" }, "artistAsin": "B0014DEFTE", "artistName": "Adele", "asin": "B073JDL2G5", "isMusicSubscription": "true", "originalReleaseDate": 1447977600.0, "primaryGenre": "Pop", "primeStatus": "PRIME", "title": "25", "trackCount": 11 } },
I grabbed the ASIN from the above output and tried this command:
PYTHONPATH=. python examples/play-album.py B073JDL2G5
Music played! Wow, awesome. Unfortunately, it kept pausing after playing about 15-20 seconds of a track, and then skipping to the next track. Here's some sample terminal output, for Van Halen's 1984 album, showing a few tracks starting to play:
trevor@trevor-ubuntu:~/amazon-music$ PYTHONPATH=. python examples/play-album.py B00UP0VOF0 Art: https://m.media-amazon.com/images/I/51Oy+rfg0YL.jpg Playing album 1984 by Van Halen (0/5)... Playing 1984 (2015 Remastered Version)... VLC media player 2.2.2 Weatherwax (revision 2.2.2-0-g6259d80) [000000000164da68] dummy interface: using the dummy interface module... [00007fcf40028aa8] httplive stream: HTTP Live Streaming (amzmusichls-us-a.akamaihd.net/DigitalMusicDeliveryService/HPS.m3u8?m=m&dmid=256512540&c=a_us&f=ts&t=10&bl=48k128k&s=true&e1=1544399100000&e2=1544399100000&v=V2&n=YTW5CBES66HNE&h=729cada9ed60c66a0115d1c6b8b2bd6b69723ea37a53f4f326c74e8eaff3f6e9) [00007fcf4044bde8] ts demux: MPEG-4 descriptor not found for pid 0x100 type 0xf [00007fcf400403d8] packetizer_mpeg4audio packetizer: AAC channels: 2 samplerate: 22050 [00007fcf4044bde8] ts demux error: libdvbpsi error (PSI decoder): TS discontinuity (received 0, expected 9) for PID 4096 [00007fcf34000a88] http access error: cannot connect to amzmusichls-us-a.akamaihd.net:443 [00007fcf40028aa8] core stream error: no suitable access module for
https://amzmusichls-us-a.akamaihd.net/1997b5b0-f256512540/944917a1-683b-3363-ad85-317ab9c7a6d5.ts?hdnea=exp=1544399110~acl=/1997b5b0-f256512540/944917a1-683b-3363-ad85-317ab9c7a6d5.ts*~hmac=e46c75a837bfabffce8f370abf3414bf46c826b454d7f465e48ad5e59e981ee1'
[00007fcf40028aa8] httplive stream error: downloading segment 0 from stream 0 failed
[0000000001606348] core playlist: end of playlist, exitinghttps://amzmusichls-us-a.akamaihd.net/9e563182-6256512533/16dafafc-c2df-3780-b0d0-cdff3eeaf18f.ts?hdnea=exp=1544399170~acl=/9e563182-6256512533/16dafaf' [00007f096c028aa8] httplive stream error: downloading segment 6 from stream 0 failed [00007f096c029e18] ts demux error: libdvbpsi error (PSI decoder): TS discontinuity (received 0, expected 9) for PID 4096 [00007f0968000958] http access error: cannot connect to amzmusichls-us-a.akamaihd.net:443 [00007f096c028aa8] core stream error: no suitable access module for
https://amzmusichls-us-a.akamaihd.net/9e563182-6256512533/ed69c044-704a-3ce4-9271-1e82251b2f7d.ts?hdnea=exp=1544399110~acl=/9e563182-6256512533/ed69c044-704a-3ce4-9271-1e82251b2f7d.ts*~hmac=0420b78fe7f926c957a3b3ac7f648b281e8e25a444920c40dd295c14cd6441fb'
[00007f096c028aa8] httplive stream error: downloading segment 0 from stream 0 failed
[000000000165f348] core playlist: end of playlist, exiting`
Hi,
Thank you for putting this library together. I'm really excited to try to use it.
I was able to use the sample search.py to look up a particular artist album. That worked great. Then I used the returned album_id as an argument to play-album.py
PYTHONPATH=. python examples/play-album.py B00UP0VOF0
It fails with this error message (I tried different album Ids with the same result):
Traceback (most recent call last): File "examples/play-album.py", line 32, in
album = am.get_album(asin)
File "/home/trevor/amazon-music/amazonmusic.py", line 236, in get_album
)['albumList'][0]
IndexError: list index out of range
I'm an Amazon prime customer, in Canada, if it helps. I'm running on Ubuntu 16.04, using python 2.
Thank you!