Code Monkey home page Code Monkey logo

pygrooveshark's Introduction

pygrooveshark's People

Contributors

adelq avatar bescu avatar bshillingford avatar davidhalter avatar jmg avatar koehlma avatar mjk3979 avatar pedros avatar quatre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pygrooveshark's Issues

Get Song By ID?

Hello all Devs,

How can I get a Song object by Song ID which I got from search?

Thank You

RequestError: (u' invalid client', 1024)

I tried to use the API today but it seems it has stopped working.

>>> import grooveshark
>>> c = grooveshark.Client()
>>> c.init()
[...]
RequestError: (u' invalid client', 1024)

Examples provided don't work either.

Coding guidelines

On a different note (and this has nothing to do with the PR, I think you should consider to use pep8 for your python files. Some lines exceed 170 characters, which is just too long (imho it should be limited to 80 characters).

Star imports are bad. Get rid of them. You really don't need them.

I would also suggest to get rid of the classes directory (just makes things more complicated).

But it's really up to you. If you don't have the time or anything... I don't care. It just helps contributors to have the typical python code that you'll find in almost all big python projects.

KeyError on grooveshark.py:302

Hi, the library is just great! Thanks for all your effort.

I've ran across this issue while searching for a song:

list(client.search('Acceptable in the 80s'))
Traceback (most recent call last):
File "", line 1, in
File "grooveshark.py", line 910, in
return (Song.from_response(song, self._connection) for song in result)
File "grooveshark.py", line 302, in from_response
return cls(song['SongID'], song['Name'], song['ArtistID'], song['ArtistName'], song['AlbumID'], song['AlbumName'],
KeyError: 'Name'

I suppose that you forgot to change the key to 'SongName' as that is the way it's being stored somewhere else in the code.
Thanks!

Song.safe_download() fails for some songs

I've noticed that this method fails for some, but not all, songs. One song that fails for me is Get Lucky by Daft Punk with song id 38730700.

Stack trace:

File "/home/matthew/projects/HouseDJ/groovesharkplugin.py", line 30, in pickSong
self.songmap[retval] = song.safe_download()
File "/usr/lib/python3.3/site-packages/grooveshark/classes/song.py", line 201, in safe_download
stream = self.stream
File "/usr/lib/python3.3/site-packages/grooveshark/classes/song.py", line 142, in stream
return Stream(stream_info['ip'], stream_info['streamKey'], self._connection)
TypeError: list indices must be integers, not str

In my case, stream_info is the empty list, which is why the error is thrown.

Server error 500 upon listing songs in an album

after receiving an grooveshark.classes.album.Album object and attempting to get the songs iterator a server error 500 is thrown.

>>> import grooveshark
>>> client=grooveshark.Client()
>>> client.init()
>>> results=client.search("Good Morning Susie Soho", client.ALBUMS)
>>> album=results.next()
>>> album.songs
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/grooveshark/classes/album.py", line 92, in songs
    self._connection.header('albumGetSongs'))[1]['songs']]
  File "/usr/lib/python2.7/site-packages/grooveshark/__init__.py", line 136, in request
    with contextlib.closing(self.urlopen(request)) as response:
  File "/usr/lib64/python2.7/urllib2.py", line 410, in open
    response = meth(req, response)
  File "/usr/lib64/python2.7/urllib2.py", line 523, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib64/python2.7/urllib2.py", line 448, in error
    return self._call_chain(*args)
  File "/usr/lib64/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/usr/lib64/python2.7/urllib2.py", line 531, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 500: Internal Server Error
>>> 

Update Licence

Can you please update your Licence to MIT considering:

mopidy/mopidy#1145

As it will enable pygrooveshark to be used in more projects.

Most of recent open source software is using MIT, if you want more information about it, there is a cool thread here: twbs/bootstrap#2054

Here is a example you can use:

The MIT License (MIT)

Copyright (c) 2015 Maximilian Köhl

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Repository too big

screen shot 2015-04-24 at 8 50 57 am

84mb seems like a lot.

Looking at the repo:

166M    webapp/www/desktop/extjs

Seems that folder is taking too much, could it be possible to get it from somewhere else, so you can avoid all that space into the repository?

Client connection doesn't work

Hi, I'm trying establish connection with init method, but seems broken!

>>> cliente.init()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/iron/EntornosVirtuales/wag/local/lib/python2.7/site-packages/grooveshark/__init__.py", line 186, in init
    self.connection.init()
  File "/home/iron/EntornosVirtuales/wag/local/lib/python2.7/site-packages/grooveshark/__init__.py", line 115, in init
    return self.init_token(), self.init_queue()
  File "/home/iron/EntornosVirtuales/wag/local/lib/python2.7/site-packages/grooveshark/__init__.py", line 121, in init_token
    self._get_token()
  File "/home/iron/EntornosVirtuales/wag/local/lib/python2.7/site-packages/grooveshark/__init__.py", line 99, in _get_token
    'client' : 'htmlshark'})[1]
  File "/home/iron/EntornosVirtuales/wag/local/lib/python2.7/site-packages/grooveshark/__init__.py", line 136, in request
    with contextlib.closing(self.urlopen(request)) as response:
  File "/usr/lib/python2.7/urllib2.py", line 404, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 422, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1222, in https_open
    return self.do_open(httplib.HTTPSConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open
    raise URLError(err)
URLError: <urlopen error [Errno 110] Connection timed out>

invalid client

It seems like grooveshark rejects requets from this lib:

In [5]: Client().init()
---------------------------------------------------------------------------
RequestError                              Traceback (most recent call last)
<ipython-input-5-782fa1764871> in <module>()
----> 1 Client().init()

/usr/lib/python3.4/site-packages/grooveshark/__init__.py in init(self)
    199         :rtype: tuple: (:meth:`init_session()`, :meth:`init_token()`, :meth:`init_queue()`)
    200         '''
--> 201         self.connection.init()
    202 
    203     def init_token(self):

/usr/lib/python3.4/site-packages/grooveshark/__init__.py in init(self)
    129         Initiate session, token and queue.
    130         '''
--> 131         return self.init_token(), self.init_queue()
    132 
    133     def init_token(self):

/usr/lib/python3.4/site-packages/grooveshark/__init__.py in init_token(self)
    135         Initiate token.
    136         '''
--> 137         self._get_token()
    138 
    139     def init_queue(self):

/usr/lib/python3.4/site-packages/grooveshark/__init__.py in _get_token(self)
    113                                            'country' : self.session.country,
    114                                            'privacy' : 0,
--> 115                                            'client' : 'htmlshark'})[1]
    116         self.session.time = time.time()
    117 

/usr/lib/python3.4/site-packages/grooveshark/__init__.py in request(self, method, parameters, header)
    155                 return response.info(), result['result']
    156             elif 'fault' in result:
--> 157                 raise RequestError(result['fault']['message'], result['fault']['code'])
    158             else:
    159                 raise UnknownError(result)

RequestError: (' invalid client', 1024)

I checked if the client (const.py) is still valid, it seems like it is. Ctrl+F more.php in http://static-a.gs-cdn.net/static/app_20141029213134.js.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.