mirror of
https://github.com/beetbox/beets.git
synced 2025-12-30 04:22:40 +01:00
Tiny code and docs fixes for gmusic (#2586)
This commit is contained in:
parent
4563e3b6dd
commit
1f2b8cef97
2 changed files with 30 additions and 26 deletions
|
|
@ -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
|
||||
|
|
@ -41,6 +41,7 @@ class Gmusic(BeetsPlugin):
|
|||
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'
|
||||
|
|
@ -51,7 +52,6 @@ class Gmusic(BeetsPlugin):
|
|||
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]
|
||||
|
||||
|
|
@ -75,7 +75,10 @@ class Gmusic(BeetsPlugin):
|
|||
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']),
|
||||
|
|
|
|||
|
|
@ -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/
|
||||
|
||||
Then, you can enable the ``gmusic`` plugin in your configuration (see
|
||||
:ref:`using-plugins`).
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
To use the ``gmusic`` plugin, enable it in your configuration file.
|
||||
To upload tracks to Google Play Music, use the ``gmusic-upload`` command::
|
||||
|
||||
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. ::
|
||||
beet gmusic-upload [QUERY]
|
||||
|
||||
If you don't include a query, the plugin will upload your entire 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::
|
||||
|
||||
gmusic:
|
||||
email: email
|
||||
password: password
|
||||
email: user@example.com
|
||||
password: seekrit
|
||||
|
||||
Then, use the ``gmusic-songs`` command to list music::
|
||||
|
||||
If you want to upload your tracks use ``gmusic-upload`` command::
|
||||
beet gmusic-songs [-at] [ARGS]
|
||||
|
||||
beet gmusic-upload [ARGS...]
|
||||
|
||||
If no arguments are provided, it will upload your entire beet collection.
|
||||
|
||||
In case you want to search for songs in your Google Music library just use::
|
||||
|
||||
beet gmusic-songs [OPTS...] [ARGS...]
|
||||
|
||||
Options:
|
||||
-a, --artist search by artist name
|
||||
-t, --track search by track
|
||||
|
||||
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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue