Giter VIP home page Giter VIP logo

thunner's Introduction

thunner

A curses Google Play Music client

'thunner' - thunder (Doric Scots)

Requirements

Usage

Chmod thunner and add to your path. Make sure you have a ~/.thunnerrc file; see below for configuration.

Keys

  • Arrow keys : menu navigation
  • enter : play (plays whatever is under the cursor, be that a song/album/artist or higher level menu item, but also queues the rest of the items in the current menu playing down the list and looping round to the top)
  • ] : play (plays only the item under the cursor, be that a song/album/artist or higher level menu item.
  • . : next
  • , : previous
  • spacebar : pause
  • q : quit

Configuration

Configuration of thunner is via ~/.thunnerrc. An example file is as follows:

      email <your e-mail address here>
      pass <your password here>
      color mycolor blue default
      assign mycolor header-text

email and pass are required (yes, plaintext password is not exactly secure). Spaces are allowed in pass. Any number of color and assign lines are allowed.

color takes three arguements: a name (which the user chooses), a foreground colour and a background colour. Foreground and background colours can be of the following values:

  • default
  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white

default picks up the foreground/background colours of the terminal. I believe black to white are colours 0-7 as per your X resources (e.g. *color0: #575757).

assign takes two arguements a named colour pair (as defined via color) and a destination. The following destinations are defined:

  • thunner - the colour of "thunner" (top left)
  • header-text - colour of text in the header (location in menu tree)
  • header-sep - colour of separators between header text
  • header-border - colour of border below header
  • footer-border - colour of border above footer
  • footer-sep - colour of separators between footer text
  • status - colour of status (playing/paused/stopped)
  • current-artist - colour of currently playing artist in footer
  • current-song - colour of currently playing song in footer
  • current-item - colour of highlighted row in menu
  • text - other rows in menu

Where the above are not defined in ~/.thunnerrc they default to default which in turn is defined as:

  color default default default

For consitency's sake I've spelt "colour" as "color" in the code.

thunner also checks for ~/.thunnerlogo on start-up and will show the contents of said file whilst connecting.

To Do

  • Add a random mode
  • Add the ability to define new playlists
  • Fix compilations under "Artists"
  • Check compatibility with other OSes
  • Add more customisations
  • Add RGB definition to configuration file for terminals that support init_color
  • Add support for pass
  • Hide lag from API calls

Known Issues

  • Compilations aren't currently handled well; Going to "Albums" will show n copies of an compilation album where n is the number of different artists on the album.
  • API calls can be slow causing lag between input and playback. Avoid switching songs too quickly (with 'next', 'previous', etc.)

thunner's People

Contributors

karlodwyer avatar lamby avatar malcolmstill avatar reggna 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

thunner's Issues

Crash while building trees

Software crashes while building trees due to key error. Trace below

Traceback (most recent call last):
File "/home/pi/git/thunner/thunner", line 442, in
main()
File "/home/pi/git/thunner/thunner", line 293, in main
artists, albums = gen_trees(library)
File "/home/pi/git/thunner/thunner", line 233, in gen_trees
"subtree":sorted(tracks,key=itemgetter('track')),
KeyError: 'track'

Playlist error

Upon starting up thunner, I get the following errors. The app never loads. Is it just me...?

$  python --version
Python 2.7.2
$ ./thunner
A traceback follows: Traceback (most recent call last):
File: "/Library/Python/2.7/site-packages/gmusicapi-1.1.0-py2.7.egg/gmusicapi/protocol/shared.py", line 226, in perform cls.validate(response, msg)
File "/Library/Python/2.7/site-packages/gmusicapi-1.1.0-py2.7.egg/gmusicapi/protocol/webclient.py", line 91, in validate
return validictory.validate(msg, cls._res_schema)
File "build/bdist.macosx-10.8-intel/egg/validictory/__init__.py", line 31, in validate
return v.validate(data, schema)
File "build/bdist.macosx-10.8-intel/egg/validictory/validator.py", line 559, in validate
self._validate(data, schema)
File "build/bdist.macosx-10.8-intel/egg/validictory/validator.py", line 562, in _validate
self.__validate("_data", {"_data": data}, schema)
File "build/bdist.macosx-10.8-intel/egg/validictory/validator.py", line 593, in __validate
newschema.get(schemaprop))
File "build/bdist.macosx-10.8-intel/egg/validictory/validator.py", line 223, in validate_properties
properties.get(eachProp))
File "build/bdist.macosx-10.8-intel/egg/validictory/validator.py", line 593, in __validate
newschema.get(schemaprop))
File "build/bdist.macosx-10.8-intel/egg/validictory/validator.py", line 266, in validate_items
(fieldname, old_error), fieldname, e.value)
ValidationException: Failed to validate field 'playlist' list schema: additional property 'origin' not defined by 'properties' are not allowed in list item
2013-05-08 17:46:33,507 - gmusicapi.Webclient1 (shared:238) [ERROR]: the following response format for GetLibrarySongs was not recognized.
If there has not been a compatibility update reported[here](http://goo.gl/jTKNb), please [create an issue](http://goo.gl/qbAW8) that includes the following raw response:
{u'playlist': [{u'origin': [], u'rating': 0, u'lastPlayed': 1349279134551528, u'disc': 0, u'matchedId': u'', u'composer': u'', u'year': 2007, u'id': u'5b1432a8-039b-3ded-a51a-5ef3fbf9d41e', u'subjectToCuration': False, u'album': u'Squanch', u'title': u'CheeseHOG', u'recentTimestamp': 1349279134544000, u'deleted': False, u'albumArtist': u'', u'type': 2, u'titleNorm': u'cheesehog', u'track': 0, u'albumArtistNorm': u'', u'totalTracks': 0, u'beatsPerMinute': 0, u'genre': u'Electronic', u'playCount': 1, u'creationDate': 1349220454665164, u'bitrate': 320, u'comment': u'', u'name': u'CheeseHOG', u'albumNorm': u'squanch', u'artist': u'Bil Bless', u'url': u'', u'totalDiscs': 0, u'artistMatchedId': u'Atsi4kwj44aojhturl4xwsp5qky', u'durationMillis': 242000, u'artistNorm': u'bil bless'} ...

[SNIP - loads more JSON]

Traceback (most recent call last):
  File "./thunner", line 446, in <module>
    main()
  File "./thunner", line 300, in main
    playlists = list_playlists(api,playlist_ids)
  File "./thunner", line 247, in list_playlists
    playlists.append( { "name":name, "subtree":api.get_playlist_songs(pid), "subtreeline":0 } )
  File "/Library/Python/2.7/site-packages/gmusicapi-1.1.0-py2.7.egg/gmusicapi/clients.py", line 670, in get_playlist_songs
    res = self._make_call(webclient.GetPlaylistSongs, playlist_id)
  File "/Library/Python/2.7/site-packages/gmusicapi-1.1.0-py2.7.egg/gmusicapi/clients.py", line 85, in _make_call
    return protocol.perform(self.session, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/gmusicapi-1.1.0-py2.7.egg/gmusicapi/protocol/shared.py", line 221, in perform
    log.debug(cls.filter_response(msg))
  File "/Library/Python/2.7/site-packages/gmusicapi-1.1.0-py2.7.egg/gmusicapi/protocol/webclient.py", line 422, in filter_response
    filtered['playlist'] = ["<%s songs>" % len(filtered['playlist'])]
KeyError: 'playlist'

"No Such Process" on OS X 10.8.4

Trying to choose any of the options on the menu results in the program crashing and displaying the following error. Any tips?

screen shot 2013-08-15 at 12 29 43 am

cache library

a feature request more than an actual problem, would it be possible to cache the library so startup time would be quicker?

Install with Package Manager

Do you use any package managers? Would there be a good way for people to install with Homebrew or Macports? Thanks.

When paused for too long the stream is lost.

When paused for too long subsequent playing plays back a few seconds of the current song (buffered) and the stream is then lost causing the next song to start playing.

I think this is mplayer dropping the stream.

thunner not usable

Hi,

Python 2.7.5 on Arch linux. Tested both against python2-gmusicapi and python2-gmusicapi-git - both produce an empty screen where no keypress influences anything besides q that quits the program.

Pressing space causes thunner to spit this:

Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 808, in __bootstrap_inner
                                                                                                                                           self.run()
                                                                                                                                                       File "/usr/lib/python2.7/threading.py", line 761, in run
                                                                                                                                                                                                                   self.__target(*self.__args, **self.__kwargs)
File "./thunner", line 192, in pause
p.stdin.write(' ')
AttributeError: 'NoneType' object has no attribute 'stdin'

No menu selection is visible (though I don't know how it should look like).

Will this work behind a HTTP proxy?

Doesn't look like it. I should also point out that I am using an application-specific password.

foo@bar:~/code/thunner$ ./thunner
Traceback (most recent call last):
File "./thunner", line 442, in
main()
File "./thunner", line 286, in main
api = apiinit(config['email'],config['pass'])
File "./thunner", line 109, in apiinit
api.login(email, password)
File "/usr/local/lib/python2.7/dist-packages/gmusicapi/clients/webclient.py", line 61, in login
if not self.session.login(email, password):
File "/usr/local/lib/python2.7/dist-packages/gmusicapi/session.py", line 117, in login
response = browser.submit(form, 'https://accounts.google.com/ServiceLoginAuth')
File "/usr/local/lib/python2.7/dist-packages/mechanicalsoup/browser.py", line 90, in submit
response = self.session.send(request)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 415, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(101, 'Network is unreachable'))

Syntax Error in Line 5

Hey, right at the start, this comes up, but i am pretty sure, it is caused by the fact, that i did not install something right.
./thunner
./thunner: line 5: syntax error near unexpected token newline' ./thunner: line 5:'

Cannot conect

Thunner exists with

/usr/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning 2015-09-17 01:25:15,961 - gmusicapi.Webclient1 (shared:405) [WARNING]: Received strange login response: {} You may need to enable less secure logins: https://www.google.com/settings/security/lesssecureapps

Less Secure Logins is enabled.

No current row highlight

I'm not sure if it's a bug, or there is just no highlighting of the currently selected row, but it makes navigation very difficult. The screenshot below was taken on Kubuntu 12.04 with Python 2.7.3.

prob_7

empty playlists result in 'TypeError: list indices must be integers, not str'

If a user has no playlists, the app will crash with the error
TypeError: list indices must be integers, not str

This can be avoided by changing the line
playlists = list_playlists(api,playlist_ids)
with an if loop:

if len(playlist_ids) > 0:
            playlists = list_playlists(api,playlist_ids)
        else:
            playlists = [{'subtreeline': 0, 'name': 'pid', 'subtree': 0}]

This results however in the error:

s = (str(song['track']) if 'track' in song else 'x') + '. ' + song['name']
KeyError: 'name'

Assert Permissions on .thunnerrc

As mentioned in the Readme, storing passwords in plaintext on the FS isn't exactly secure. Obviously, this issue can help be reduced by using proper permissions on the file. In that spirit, doesn't it make sense to assert that .thunnerrc is only read/writeable by its owner? Ssh does this, so this practice has precedence in *nix software.

I'd be glad to implement this and submit a pull request if there's interest in this feature.

SSL Issue in Issue11 branch

Running for the first time on OSX 10.8.4, I get SSL errors. I have installed python 2.7 via homebrew, to get pip to install the Google API unofficial client. I get the following errors when running the script;

python thunner
Traceback (most recent call last):
File "thunner", line 442, in
main()
File "thunner", line 286, in main
api = apiinit(config['email'],config['pass'])
File "thunner", line 109, in apiinit
api.login(email, password)
File "/Users/jc18/homebrew/lib/python2.7/site-packages/gmusicapi/clients/webclient.py", line 38, in login
if not self.session.login(email, password):
File "/Users/jc18/homebrew/lib/python2.7/site-packages/gmusicapi/session.py", line 87, in login
res = ClientLogin.perform(self, True, email, password)
File "/Users/jc18/homebrew/lib/python2.7/site-packages/gmusicapi/protocol/shared.py", line 208, in perform
response = session.send(req_kwargs, cls.required_auth)
File "/Users/jc18/homebrew/lib/python2.7/site-packages/gmusicapi/session.py", line 59, in send
return self._send_without_auth(req_kwargs, rsession)
File "/Users/jc18/homebrew/lib/python2.7/site-packages/gmusicapi/session.py", line 30, in _send_without_auth
res = rsession.request(*_req_kwargs)
File "/Users/jc18/homebrew/lib/python2.7/site-packages/requests/sessions.py", line 354, in request
resp = self.send(prep, *_send_kwargs)
File "/Users/jc18/homebrew/lib/python2.7/site-packages/requests/sessions.py", line 460, in send
r = adapter.send(request, **kwargs)
File "/Users/jc18/homebrew/lib/python2.7/site-packages/requests/adapters.py", line 250, in send
raise SSLError(e)
requests.exceptions.SSLError: [Errno 1] _ssl.c:504: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

I'm not a python coder, so apologies if I've missed something obvious..

Error on importing gmusicapi

Original error message:

$ thunner  
Traceback (most recent call last):
  File "/usr/local/bin/thunner", line 39, in <module>
    from gmusicapi.api import Api
ImportError: No module named api

I fixed this by changing gmusicapi.api to gmusicapi.

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.