Selaa lähdekoodia

Adds script to get device ID and updated README

Caleb Fangmeier 6 vuotta sitten
vanhempi
commit
ba7ae51cfe
2 muutettua tiedostoa jossa 78 lisäystä ja 2 poistoa
  1. 53 2
      README.md
  2. 25 0
      gpymusic-get-dev-id

+ 53 - 2
README.md

@@ -1,6 +1,57 @@
-# tuijam
-A fancy TUI client for Google Play Music
+# TUIJam
+A fancy TUI client for Google Play Music. 
+
+TUIJam seeks to make a simple, attractive, terminal-based interface to
+listening to music for Google Play Music All-Access subscribers.
 
 <a href="http://www.youtube.com/watch?feature=player_embedded&v=WIkk7PLCTb4
 " target="_blank"><img src="http://img.youtube.com/vi/WIkk7PLCTb4/0.jpg" 
 alt="Demonstration" width="240" height="180" border="10" /></a>
+
+# Dependencies
+* [Python >= 3.6](https://www.python.org/downloads)
+* [mpv](https://mpv.io)
+
+# Installation
+```bash
+git clone git@github.com:cfangmeier/tuijam.git`
+cd tuijam
+python setup.py install --user
+```
+
+# Configuration
+Login credentials are stored in `$HOME/.config/tuijam/config.yaml`. An example config file might look like:
+```yaml
+email: you@your-email.com
+password: your-password
+device_id: yourdeviceid
+```
+Note that if you have 2-factor setup on your Google account, you need to make
+an app-password for TUIJam. To find your device ID, first put your email and
+password in the config file, then run `gpymusic-get-dev-id`. If your login
+works, you will get a list of acceptable device ids, place any one of them into
+the config file.
+
+# Controls
+  - `ctrl-c` quit
+  - `ctrl-p` toggle play/pause
+  - `ctrl-n` move to next song
+  - `>` seek forward 10 seconds
+  - `<` seek backwards 10 seconds
+  - `tab`/`shift-tab` cycle focus through search/queue/input windows
+  - In search window, 
+    - `q` add selected song/album to queue
+    - `e` view information about selected song/album/artist
+  - In queue window,
+    - `u` move selected song up in queue
+    - `d` move selected song down in queue
+    - `delete` remove selected song from queue
+  - In input window,
+    - Type search query and press enter. Results are shown in search window.
+
+
+# Thanks
+TUIJam was heavily inspired by the
+[gpymusic](https://github.com/christopher-dG/gpymusic) project, and, of course,
+could not exists without the great
+[gmusicapi](https://github.com/simon-weber/gmusicapi).

+ 25 - 0
gpymusic-get-dev-id

@@ -0,0 +1,25 @@
+#!/usr/bin/env python3
+from gmusicapi import Mobileclient
+from os.path import join, expanduser
+import yaml
+
+config_file = join(expanduser('~'), '.config', 'tuijam', 'config.yaml')
+try:
+    with open(config_file) as f:
+        config = yaml.load(f.read())
+        email = config['email']
+        password = config['password']
+except Exception:
+    raise ValueError('Invalid config file! Check README!')
+
+mc = Mobileclient()
+
+if not mc.login(email, password, mc.FROM_MAC_ADDRESS):
+    print('Login failed, verify your email and password.')
+    exit(1)
+
+for i, id in enumerate([
+    d['id'][2:] if d['id'].startswith('0x') else d['id'].replace(':', '')  # noqa
+    for d in mc.get_registered_devices()
+]):
+    print('%d: %s' % (i + 1, id))