Skip to content

Commit

Permalink
Tiny code and docs fixes for gmusic (#2586)
Browse files Browse the repository at this point in the history
  • Loading branch information
sampsyo committed Jun 14, 2017
1 parent 4563e3b commit 1f2b8ce
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 25 deletions.
9 changes: 6 additions & 3 deletions beetsplug/gmusic.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.

"""Uploads files to Google Play Music"""
"""Upload files to Google Play Music and list songs in its library."""

from __future__ import print_function
import os.path
Expand Down Expand Up @@ -41,6 +41,7 @@ def __init__(self):
def commands(self):
gupload = Subcommand('gmusic-upload',
help=u'upload your tracks to Google Play Music')
gupload.func = self.upload

search = Subcommand('gmusic-songs',
help=u'list of songs in Google Play Music library'
Expand All @@ -51,7 +52,6 @@ def commands(self):
search.parser.add_option('-a', '--artist', dest='artist',
action='store_true',
help='Search by artist')
gupload.func = self.upload
search.func = self.search
return [gupload, search]

Expand All @@ -75,7 +75,10 @@ def search(self, lib, opts, args):
Mobileclient.FROM_MAC_ADDRESS)
files = mobile.get_all_songs()
except NotLoggedIn:
ui.print_('Error occured. Please check your email and password')
ui.print_(
'Authentication error. Please check your email and password.'
)
return
if not args:
for i, file in enumerate(files, start=1):
print(i, ui.colorize('blue', file['artist']),
Expand Down
45 changes: 23 additions & 22 deletions docs/plugins/gmusic.rst
Original file line number Diff line number Diff line change
@@ -1,48 +1,49 @@
Gmusic Plugin
=============

This plugin allows you to manage your Google Play Music library with beets.
The ``gmusic`` plugin lets you upload songs to Google Play Music and query
songs in your library.


Installation
------------

The plugin requires `gmusic`_. You can install it using `pip`::
The plugin requires `gmusicapi`_. You can install it using `pip`::

pip install gmusicapi

.. _gmusic: https://github.com/simon-weber/gmusicapi/
.. _gmusicapi: https://github.com/simon-weber/gmusicapi/

Usage
-----
Then, you can enable the ``gmusic`` plugin in your configuration (see
:ref:`using-plugins`).

To use the ``gmusic`` plugin, enable it in your configuration file.

Then, add your Google email and password to configuration file under a ``gmusic`` section, if you want to be able to search for songs in your library.
It's not necessary if you only upload files. ::

gmusic:
email: email
password: password
Usage
-----

To upload tracks to Google Play Music, use the ``gmusic-upload`` command::

If you want to upload your tracks use ``gmusic-upload`` command::
beet gmusic-upload [QUERY]

beet gmusic-upload [ARGS...]
If you don't include a query, the plugin will upload your entire collection.

If no arguments are provided, it will upload your entire beet collection.
To query the songs in your collection, you will need to add your Google
credentials to your beets configuration file. Put your Google username and
password under a section called ``gmusic``, like so::

In case you want to search for songs in your Google Music library just use::
gmusic:
email: user@example.com
password: seekrit

beet gmusic-songs [OPTS...] [ARGS...]
Then, use the ``gmusic-songs`` command to list music::

Options:
-a, --artist search by artist name
-t, --track search by track
beet gmusic-songs [-at] [ARGS]

For example::
Use the ``-a`` option to search by artist and ``-t`` to search by track. For
example::

beet gmusic-songs -a John Frusciante
beet gmusic-songs -t Black Hole Sun

If you want a list of all songs simply leave it without arguments and options.
For a list of all songs in your library, run ``beet gmusic-songs`` without any
arguments.

0 comments on commit 1f2b8ce

Please sign in to comment.