Issue #67 new

off after 30 minutes : "KeyError: 'result'"

kepon avatarkepon created an issue

Ubuntu 12.04 / gsharkdown 0.7.0

(always) After 30 minutes If I restart gsharkdown it's OK...

I think "[Grooveshark initialized]" is necessary all 30 minutes...

look out :

 time python gsharkdown.py 
[Initializing Grooveshark]
[Grooveshark initialized]
[Key for song streaming 26528872 ] {u'header': {u'prefetchEnabled': True, u'serviceVersion': u'20100903', u'session': u'c12bc40dcd3232c69a46ca982a3ee4c9'}, u'result': {u'26528872': {u'streamServerID': 2048, u'Expires': 1353668986, u'ts': 1353667186, u'uSecs': u'149000000', u'ip': u'stream128a-he.grooveshark.com', u'FileToken': u'31oLqP', u'streamKey': u'6a24837ec6b311edec7beb73283790ae026ccf5e_50af597a_194cc68_1a68712_a4e421d8_1_0', u'isMobile': False, u'FileID': u'27690770'}}}
[Playing] 26528872 http://stream128a-he.grooveshark.com/stream.php?streamKey=6a24837ec6b311edec7beb73283790ae026ccf5e_50af597a_194cc68_1a68712_a4e421d8_1_0
[Key for song streaming 26532921 ] {u'header': {u'prefetchEnabled': True, u'serviceVersion': u'20100903', u'session': u'c12bc40dcd3232c69a46ca982a3ee4c9'}, u'result': {u'26532921': {u'streamServerID': 1048576, u'Expires': 1353669139, u'ts': 1353667339, u'uSecs': u'188000000', u'ip': u'stream66c.grooveshark.com', u'FileToken': u'31oM34', u'streamKey': u'1087b42268c04888ee80e00f3a361d5cfa305df1_50af5a13_194dc39_1a6872a_a4e421d8_1_0', u'isMobile': False, u'FileID': u'27690794'}}}
[Playing] 26532921 http://stream66c.grooveshark.com/stream.php?streamKey=1087b42268c04888ee80e00f3a361d5cfa305df1_50af5a13_194dc39_1a6872a_a4e421d8_1_0
[Key for song streaming 26528616 ] {u'header': {u'prefetchEnabled': True, u'serviceVersion': u'20100903', u'session': u'c12bc40dcd3232c69a46ca982a3ee4c9'}, u'result': {u'26528616': {u'streamServerID': 16384, u'Expires': 1353669331, u'ts': 1353667531, u'uSecs': u'194000000', u'ip': u'stream126.grooveshark.com', u'FileToken': u'31l7SV', u'streamKey': u'beab239c4ebf76e3de8f11a1fd330d6ff756a7af_50af5ad3_194cb68_1a66534_a4e421d8_1_0', u'isMobile': False, u'FileID': u'27682100'}}}
[Playing] 26528616 http://stream126.grooveshark.com/stream.php?streamKey=beab239c4ebf76e3de8f11a1fd330d6ff756a7af_50af5ad3_194cb68_1a66534_a4e421d8_1_0
[Key for song streaming 26528819 ] {u'header': {u'prefetchEnabled': True, u'serviceVersion': u'20100903', u'session': u'c12bc40dcd3232c69a46ca982a3ee4c9'}, u'result': {u'26528819': {u'streamServerID': 16384, u'Expires': 1353669529, u'ts': 1353667729, u'uSecs': u'221000000', u'ip': u'stream126.grooveshark.com', u'FileToken': u'31oK1c', u'streamKey': u'74501125184711d1dbd7ff97d8748f091647d3a5_50af5b99_194cc33_1a686dc_a4e421d8_1_0', u'isMobile': False, u'FileID': u'27690716'}}}
[Playing] 26528819 http://stream126.grooveshark.com/stream.php?streamKey=74501125184711d1dbd7ff97d8748f091647d3a5_50af5b99_194cc33_1a686dc_a4e421d8_1_0
[Key for song streaming 26528849 ] {u'header': {u'prefetchEnabled': True, u'serviceVersion': u'20100903', u'session': u'c12bc40dcd3232c69a46ca982a3ee4c9'}, u'result': {u'26528849': {u'streamServerID': 64, u'Expires': 1353669754, u'ts': 1353667954, u'uSecs': u'235000000', u'ip': u'stream124d-he.grooveshark.com', u'FileToken': u'31oKZT', u'streamKey': u'6599969ef1c0d687de8b73dec3356dd80ee1af85_50af5c7a_194cc51_1a68701_a4e421d8_1_0', u'isMobile': False, u'FileID': u'27690753'}}}
[Playing] 26528849 http://stream124d-he.grooveshark.com/stream.php?streamKey=6599969ef1c0d687de8b73dec3356dd80ee1af85_50af5c7a_194cc51_1a68701_a4e421d8_1_0
[Key for song streaming 26528880 ] {u'header': {u'prefetchEnabled': True, u'serviceVersion': u'20100903', u'session': u'c12bc40dcd3232c69a46ca982a3ee4c9'}, u'result': {u'26528880': {u'streamServerID': 1048576, u'Expires': 1353669992, u'ts': 1353668192, u'uSecs': u'197000000', u'ip': u'stream66c.grooveshark.com', u'FileToken': u'31oLAl', u'streamKey': u'7e8c04605eb9c17d158f3411c83b1d1a5e4d085d_50af5d68_194cc70_1a68718_a4e421d8_1_0', u'isMobile': False, u'FileID': u'27690776'}}}
[Playing] 26528880 http://stream66c.grooveshark.com/stream.php?streamKey=7e8c04605eb9c17d158f3411c83b1d1a5e4d085d_50af5d68_194cc70_1a68718_a4e421d8_1_0
[Key for song streaming 26528671 ] {u'header': {u'prefetchEnabled': True, u'serviceVersion': u'20100903', u'session': u'c12bc40dcd3232c69a46ca982a3ee4c9'}, u'result': {u'26528671': {u'streamServerID': 2048, u'Expires': 1353670194, u'ts': 1353668394, u'uSecs': u'242000000', u'ip': u'stream128a-he.grooveshark.com', u'FileToken': u'31l9SF', u'streamKey': u'421e584a7901f8b3322788de253dbee41560f912_50af5e32_194cb9f_1a66581_a4e421d8_1_0', u'isMobile': False, u'FileID': u'27682177'}}}
[Playing] 26528671 http://stream128a-he.grooveshark.com/stream.php?streamKey=421e584a7901f8b3322788de253dbee41560f912_50af5e32_194cb9f_1a66581_a4e421d8_1_0
[Key for song streaming 26528872 ] {u'header': {u'prefetchEnabled': True, u'serviceVersion': u'20100903', u'session': u'c12bc40dcd3232c69a46ca982a3ee4c9'}, u'result': {u'26528872': {u'streamServerID': 1, u'Expires': 1353670441, u'ts': 1353668641, u'uSecs': u'149000000', u'ip': u'stream79b-he.grooveshark.com', u'FileToken': u'31oLqP', u'streamKey': u'011b02186b0dbccf7b49412d8ee6a30b0315d5d3_50af5f29_194cc68_1a68712_a4e421d8_1_0', u'isMobile': False, u'FileID': u'27690770'}}}
[Playing] 26528872 http://stream79b-he.grooveshark.com/stream.php?streamKey=011b02186b0dbccf7b49412d8ee6a30b0315d5d3_50af5f29_194cc68_1a68712_a4e421d8_1_0
[Key for song streaming 26528827 ] {u'header': {u'prefetchEnabled': True, u'serviceVersion': u'20100903', u'session': u'c12bc40dcd3232c69a46ca982a3ee4c9'}, u'result': {u'26528827': {u'streamServerID': 1048576, u'Expires': 1353670594, u'ts': 1353668794, u'uSecs': u'188000000', u'ip': u'stream66c.grooveshark.com', u'FileToken': u'31oKh7', u'streamKey': u'caaf2da2950039cc4026172f4fa843b38a70fce6_50af5fc2_194cc3b_1a686e5_a4e421d8_1_0', u'isMobile': False, u'FileID': u'27690725'}}}
[Playing] 26528827 http://stream66c.grooveshark.com/stream.php?streamKey=caaf2da2950039cc4026172f4fa843b38a70fce6_50af5fc2_194cc3b_1a686e5_a4e421d8_1_0
[Streaming URL error] 'result'
Traceback (most recent call last):
  File "/data/home/lyon/mercereau/bin/gsharkdown/lib/tfuncs.py", line 52, in run
    play_url = self.song.get_streaming_url()
  File "/data/home/lyon/mercereau/bin/gsharkdown/lib/Song.py", line 342, in get_streaming_url
    raise e
KeyError: 'result'

real    31m6.838s
user    1m35.998s
sys 0m8.765s

Comments (3)

  1. Damián Nohales

    Yeah... I also noticed this bug, maybe the best way to behave is when an error occur on song playing, then gSharkDown restart the connection and increment a tries counter, when a song is loaded successfully, the counter resets, but when a song fails to load, counter should increment by one and try to reconnect again, if gSharkDown tries to reconnect more than X times, throw an error to the user.

  2. Andres Vargas

    here the patch

    diff -r 28117581010b lib/groove.py
    --- a/lib/groove.py Fri Jul 19 09:18:10 2013 +0200
    +++ b/lib/groove.py Sun Jan 12 21:37:00 2014 -0600
    @@ -175,8 +175,7 @@
    
         gzipfile = gzip.GzipFile(fileobj = (StringIO.StringIO(resp)))
         j = json.JSONDecoder().decode(gzipfile.read())
    -
    -    if len(j["result"][str(_id)]) == 0:
    +    if "result" in j and len(j["result"][str(_id)]) == 0:
             raise Exception("The song streaming key is empty")
    
         return j
    
  3. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.