-
-
Save coenraadhuman/ff10adccf1d7c43d8d0298dbd1c5916f to your computer and use it in GitHub Desktop.
#! /bin/bash | |
echo "Adding required repositories." | |
wget -q -O - https://apt.mopidy.com/mopidy.gpg | sudo apt-key add - | |
sudo wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/buster.list | |
curl 'https://bintray.com/user/downloadSubjectPublicKey?username=tizonia' | sudo apt-key add - | |
echo deb https://dl.bintray.com/tizonia/raspbian buster main | sudo tee -a /etc/apt/sources.list | |
echo "Updating repositories." | |
sudo apt update | |
echo "Installing Tizonia and dependencies." | |
sudo apt install libspotify12 | |
sudo apt install libtizspotifysrc0 | |
sudo apt install tizonia-all | |
sudo apt install python3-pip | |
pip3 install gmusicapi | |
pip3 install fuzzywuzzy | |
pip3 install python-Levenshtein | |
echo "CHANGE LOGIN CREDENTIALS (Use Google App Password) : " | |
echo "nano $HOME/.config/tizonia/tizonia.conf" | |
echo "" | |
echo "# Google Play Music configuration" | |
echo "# -------------------------------------------------------------------------" | |
echo "# To avoid passing this information on the command line, uncomment and" | |
echo "# configure here." | |
echo "#" | |
echo "gmusic.user = YOUR_GMAIL_EMAIL" | |
echo "gmusic.password = YOUR_APP_PASSWORD" | |
echo "gmusic.device_id = 1234567890abcdef" | |
echo "# gmusic.buffer_seconds = size of the audio buffer (in seconds) to use while" | |
echo "# downloading streams. Default: 720. Increase in" | |
echo "# case of cuts." | |
echo "" | |
echo "*Please take note that on first login the gmusic.device_id is given in the error message.*" | |
echo "" | |
echo "CHANGE AUDIO RENDERER FOR RPI : " | |
echo "nano $HOME/.config/tizonia/tizonia.conf" | |
echo "" | |
echo "# Tizonia player section" | |
echo "# The default audio renderer used by the tizonia player" | |
echo "# -------------------------------------------------------------------------" | |
echo "# Valid values are:" | |
echo "# - OMX.Aratelia.audio_renderer.pulseaudio.pcm" | |
echo "# - OMX.Aratelia.audio_renderer.alsa.pcm" | |
echo "#default-audio-renderer = OMX.Aratelia.audio_renderer.pulseaudio.pcm" | |
echo "default-audio-renderer = OMX.Aratelia.audio_renderer.alsa.pcm" |
That is odd.
I just updated the script added some extra notes. It follows the steps I took.
Maybe you can send me the tizonia.conf file and I could have a look.
That's totally odd!
My tizonia.conf minus the password:
cat tizonia.conf
# -*-Mode: conf; -*-
# tizonia-config v0.21.0 configuration file
[ilcore]
# Tizonia OpenMAX IL Core section
# Component plugins discovery
# -------------------------------------------------------------------------
# A comma-separated list of paths to be scanned by the Tizonia IL Core when
# searching for component plugins
component-paths = /usr/lib/arm-linux-gnueabihf/tizonia0-plugins12;
# IL Core extension plugins discovery
# -------------------------------------------------------------------------
# A comma-separated list of paths to be scanned by the Tizonia IL Core when
# searching for IL Core extensions (not implemented yet)
extension-paths =
[resource-management]
# Tizonia OpenMAX IL Resource Management (RM) section
# Resource Manager (RM) daemon interface enable/disable switch
# -------------------------------------------------------------------------
# Whether the IL RM functionality is enabled or not
enabled = false
# RM database
# -------------------------------------------------------------------------
# This is the path to the Resource Manager database
rmdb = /usr/share/tizrmd/tizrm.db
[plugins]
# OpenMAX IL Component plugins section
# Each key-value pair represents a list of any data that a
# specific component might need. The entries here must honor the following
# format: OMX.component.name.key = <semi-colon-separated list of items>
# ALSA Audio Renderer
# -------------------------------------------------------------------------
#
# OMX.Aratelia.audio_renderer.alsa.pcm.preannouncements_disabled.port0 = false
OMX.Aratelia.audio_renderer.alsa.pcm.alsa_device = default
OMX.Aratelia.audio_renderer.alsa.pcm.alsa_mixer = Master
# PulseAudio Audio Renderer
# -------------------------------------------------------------------------
#
# OMX.Aratelia.audio_renderer.pulseaudio.pcm.preannouncements_disabled.port0 = false
# OMX.Aratelia.audio_renderer.pulseaudio.pcm.default_volume = Value from 0
# to 100 (Default: 75)
[tizonia]
# Tizonia player section
# The default audio renderer used by the tizonia player
# -------------------------------------------------------------------------
# Valid values are:
# - OMX.Aratelia.audio_renderer.pulseaudio.pcm
# - OMX.Aratelia.audio_renderer.alsa.pcm
default-audio-renderer = OMX.Aratelia.audio_renderer.alsa.pcm
# MPRIS v2 interface enable/disable switch
# -------------------------------------------------------------------------
# Valid values are: true | false
#
mpris-enabled = false
# HTTP proxy server configuration
# -------------------------------------------------------------------------
# NOTE: Proxy configuration is currently only available with the Spotify
# service. It will be ignored with other music services.
#
# proxy.server = Url to the proxy server that should be used.
# The format is protocol://<host>:port (where protocol
# is http/https/socks4/socks5). E.g.: http:some.proxy.net:1234
# proxy.user_name = Username to authenticate with proxy server
# proxy.user_password = Password to authenticate with proxy server
# Spotify configuration
# -------------------------------------------------------------------------
# To avoid passing this information on the command line, uncomment
# and configure accordingly
#
# spotify.user = user
# spotify.password = pass
# spotify.recover_lost_token = false (set to true to continue playback after
# the token has been [spuriously?] lost)
# spotify.allow_explicit_tracks = false (set to true to allow explicit tracks)
# spotify.preferred_bitrate = Three possible values: 96, 160, or 320 ; default: 320
# Google Play Music configuration
# -------------------------------------------------------------------------
# To avoid passing this information on the command line, uncomment and
# configure here.
#
gmusic.user = [email protected]
gmusic.password = <password>
#pass (account password or app-specific password for
# 2-factor users)
gmusic.device_id = 1234567890abcdef //I tried both copying it from laptop's config and putting something random like this one here//
#deviceid (16 hex digits, e.g. '1234567890abcdef')
# gmusic.buffer_seconds = size of the audio buffer (in seconds) to use while
# downloading streams. Default: 720. Increase in
# case of cuts.
# SoundCloud configuration
# -------------------------------------------------------------------------
# To avoid passing this information on the command line, uncomment and
# configure your SoundCloud OAuth token here.
#
# To obtain your OAuth token, Tizonia needs to be granted access to your
# SoundCloud account. Visit https://tizonia.org/docs/soundcloud/ for the
# details.
#
# soundcloud.oauth_token = X-XXXXXX-XXXXXXXX-XXXXXXXXXXXXXX
# soundcloud.buffer_seconds = size of the audio buffer (in seconds) to use
# while downloading streams. Default: 600.
# Increase in case of cuts.
# Tunein configuration
# -------------------------------------------------------------------------
# To avoid passing this information on the command line, uncomment and
# configure here.
#
#
# tunein.buffer_seconds = size of the audio buffer (in seconds) to use
# while downloading streams. Default: 120.
# Increase in case of cuts.
# YouTube configuration
# -------------------------------------------------------------------------
# To avoid passing this information on the command line, uncomment and
# configure as needed.
#
# youtube.api_key = youtube api key. Optional but RECOMMENDED to avoid
# problems when the daily quota of the interal api key
# is exceeded. To create your YouTube api key, see info at:
# https://www.slickremix.com/docs/get-api-key-for-youtube/
# youtube.buffer_seconds = size of the audio buffer (in seconds) to use
# while downloading streams. Default: 60.
# Increase in case of cuts.
# Plex configuration
# -------------------------------------------------------------------------
# To avoid passing this information on the command line, uncomment and
# configure your Plex server and account auth token here.
#
# To find how to obtain a Plex user authentication token, see:
# https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/
#
# plex.base_url = xxxxxxxxxxxxxx (e.g. http://plexserver:32400)
# plex.auth_token = xxxxxxxxxxxxxx (e.g. SrPEojhap3H5Qj2DmjhX)
# plex.buffer_seconds = size of the audio buffer (in seconds) to use
# while downloading streams. Default: 600.
# Increase in case of cuts.
# plex.music_section_name = name of the music section in your plex library
# (default: Music)
[color-themes]
# Tizonia uses around 16 different colors while displaying information on the
# terminal. These colors are referred to in this configuration file as:
# C01, C02, ..., C15, C16.
#
# There are three options for specifying the color codes (depending on the
# number of colors supported by the terminal; most terminals should support all
# three options).
#
# OPTION 1: 3/4-bit color codes
# https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit
# Normal FG colors: 30-37 - Bright FG colors: 90-97
# Normal BG colors: 40-47 - Bright BG colors: 100-107
#
# OPTION 2: 8-bit color codes:
# https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
# 38,5,⟨n⟩ -> Foreground color
# 48,5,⟨n⟩ -> Background color
#
# OPTION 3: 24-bit color codes:
# https://en.wikipedia.org/wiki/ANSI_escape_code#24-bit
# 38,2,⟨r⟩,⟨g⟩,⟨b⟩ -> RGB foreground color
# 48,2,⟨r⟩,⟨g⟩,⟨b⟩ -> RGB background color
#
# In addition to the foreground and background color codes, the font display
# attributes or 'decorations' may also be specified.
#
# Display attributes (a.k.a. decorations):
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
# 1 -> Bold, 2 -> Faint, 3 -> Italic, 4 -> Underline, 5 -> Slow blink,
# etc...
#
# Then, to specify a C01-C16 color for Tizonia, choose one of the bit depth
# options above and compose your Cxy code like this:
#
# Cxy = <fg>,<bg>,<attr>
#
# Note that there is no need to provide all three of <fg>, <bg> and <attr>, but
# at least one of them should be given for the Cxy color to be of any use.
#
# You can use multiple bit-depth definitions in a color theme (e.g. C01-C08
# defined using 3/4 bit codes, and C09-C16 using 24-bit), but you should stick
# with one bit-depth for <fg>,<bg> within the same Cxy definition.
#
#
#
# There are four color themes available in this config file:
#
# tizonia (the default theme), black, blink, and monokai
#
# To activate a color theme, add its name and uncomment the following line.
#
# active-theme = tizonia
# 'tizonia' color theme (default 3/4-bit theme).
# =============================================
# NOTE: C01-C07 -> Misc. colors.
# NOTE: C08-C12 -> These usually are bright FG colors, for some important messages.
# NOTE: C13-C16 -> The colors used in the progress bar display.
# IMPORTANT: Only commas are allowed between digits in the color definition, no SPACES!.
# ---------------------------------------------
tizonia.C01 = 31 # Red FG, no BG or Decoration - Hint: error messages.
tizonia.C02 = 32 # Green FG, no BG or Decoration - Hint: higher importance info messages.
tizonia.C03 = 33 # Yellow FG, no BG or Decoration - Hint: song/stream title.
tizonia.C04 = 34 # Blue FG, no BG or Decoration - Hint: normal importance info messages.
tizonia.C05 = 35 # Magenta FG, no BG or Decoration - Hint: other info messages (e.g. '2 Ch, 44.1 KHz, 16:s:b').
tizonia.C06 = 36 # Cyan FG, no BG or Decoration - Hint: various song/stream infos (e.g. album, duration, etc).
tizonia.C07 = 37 # White FG, no BG or Decoration - Hint: seldom used. For future use.
tizonia.C08 = 91 # Bright Red FG, no BG or Decoration - Hint: additional error messages.
tizonia.C09 = 92 # Bright Green FG, no BG or Decoration - Hint: additional higher importance info messages.
tizonia.C10 = 93 # Bright Yellow FG, no BG or Decoration - Hint: useful data, highlighted messages.
tizonia.C11 = 94 # Bright Blue FG, no BG or Decoration - Hint: tracks the in playlist.
tizonia.C12 = 95 # Bright Magenta FG, no BG or Decoration - Hint: other useful data messages.
tizonia.C13 = 36 # Cyan FG - Hint: the percentage bar.
tizonia.C14 = 37 # White FG - Hint: the digits in the percentage bar.
tizonia.C15 = 41 # Red BG - Hint: the song's elapsed time.
tizonia.C16 = 46 # Cyan BG - Hint: the moving progress bar itself (IMPORTANT: This must a BG code, no FG or attr.).
# 'Black' color theme (8-bit).
# ===========================
# NOTE: C01-C07 -> Misc. colors.
# NOTE: C08-C12 -> These usually are bright FG colors, for some important messages.
# NOTE: C13-C16 -> The colors used in the progress bar display.
# IMPORTANT: Only commas are allowed between digits in the color definition, no SPACES!.
# ---------------------------
black.C01 = 38,5,9 # Hint: error messages.
black.C02 = 38,5,249 # Hint: higher importance info messages.
black.C03 = 38,5,253,1 # Hint: song/stream title.
black.C04 = 38,5,243 # Hint: normal importance info messages.
black.C05 = 38,5,241 # Hint: other info messages (e.g. '2 Ch, 44.1 KHz, 16:s:b').
black.C06 = 38,5,238 # Hint: various song/stream infos (e.g. album, duration, etc).
black.C07 = 38,5,255 # Hint: seldom used. For future use.
black.C08 = 38,5,9 # Hint: additional error messages.
black.C09 = 38,5,230,48,5,233 # Hint: additional higher importance info messages.
black.C10 = 38,5,245,48,5,233 # Hint: useful data, highlighted messages.
black.C11 = 38,5,251,48,5,233,3 # Hint: tracks the in playlist.
black.C12 = 38,5,245,48,5,233 # Hint: other useful data messages.
black.C13 = 38,5,231 # Hint: the percentage bar.
black.C14 = 38,5,244 # Hint: the digits in the percentage bar.
black.C15 = 48,5,243 # Hint: the song's elapsed time (a BG code).
black.C16 = 48,5,237 # Hint: the moving progress bar itself (a BG code).
# 'Blink' color theme (24-bit).
# =============================
# NOTE: C01-C07 -> Misc. colors.
# NOTE: C08-C12 -> These usually are bright FG colors, for some important messages.
# NOTE: C13-C16 -> The colors used in the progress bar display.
# IMPORTANT: Only commas are allowed between digits in the color definition, no SPACES!.
# -----------------------------
blink.C01 = 38,2,255,255,255,48,2,235,21,25 # Hint: error messages (default theme: red)
blink.C02 = 38,2,74,143,115 # Hint: higher importance info messages (default theme: green)
blink.C03 = 38,2,93,213,222,48,2,12,23,171,1 # Hint: song/stream title (default theme: yellow)
blink.C04 = 38,2,42,10,252 # Hint: normal importance info messages (default theme: blue)
blink.C05 = 38,2,66,135,245,48,2,35,40,48,1 # Hint: other info messages (e.g. '2 Ch, 44.1 KHz, 16:s:b') (default theme: magenta)
blink.C06 = 38,2,235,171,21,48,2,57,58,59,3 # Hint: various song/stream infos (e.g. album, duration, etc) (default theme: cyan)
blink.C07 = 38,2,255,255,255 # Hint: seldom used. For future use (default theme: white)
blink.C08 = 38,2,255,255,255,48,2,235,21,25 # Hint: additional error messages.
blink.C09 = 38,2,27,227,147 # Hint: additional higher importance info messages.
blink.C10 = 38,2,222,174,18 # Hint: useful data, highlighted messages.
blink.C11 = 38,2,214,55,219 # Hint: tracks the in playlist.
blink.C12 = 38,2,255,255,255 # Hint: other useful data messages.
blink.C13 = 38,2,74,143,115,5 # Hint: the percentage bar.
blink.C14 = 38,2,92,90,85 # Hint: the digits in the percentage bar. (NOTE: decoration: 5 -> blink)
blink.C15 = 38,2,93,213,222,48,2,46,38,140,1 # Hint: the song's elapsed time.
blink.C16 = 48,2,93,213,222 # Hint: the moving progress bar itself (IMPORTANT: This must a BG code, no FG or attr.).
# 'Monokai' color theme (24-bit).
# ==============================
# NOTE: C01-C07 -> Misc. colors.
# NOTE: C08-C12 -> These usually are bright FG colors, for some important messages.
# NOTE: C13-C16 -> The colors used in the progress bar display.
# IMPORTANT: Only commas are allowed between digits in the color definition, no spaces PLEASE!.
# ------------------------------
monokai.C01 = 38,2,121,121,121 # Hint: error messages (default theme: red)
monokai.C02 = 38,2,214,214,214 # Hint: higher importance info messages (default theme: green)
monokai.C03 = 38,2,229,181,103,4 # Hint: song/stream title (default theme: yellow)
monokai.C04 = 38,2,180,210,115 # Hint: normal importance info messages (default theme: blue)
monokai.C05 = 38,2,232,125,62 # Hint: other info messages (e.g. '2 Ch, 44.1 KHz, 16:s:b') (default theme: magenta)
monokai.C06 = 38,2,158,134,200 # Hint: various song/stream infos (e.g. album, duration, etc) (default theme: cyan)
monokai.C07 = 38,2,255,255,255 # Hint: seldom used. For future use (default theme: white)
monokai.C08 = 38,2,249,38,114 # Hint: additional error messages.
monokai.C09 = 38,2,102,217,239 # Hint: additional higher importance info messages.
monokai.C10 = 38,2,166,226,46 # Hint: useful data, highlighted messages.
monokai.C11 = 38,2,253,151,31 # Hint: tracks the in playlist.
monokai.C12 = 38,2,255,255,255 # Hint: other useful data messages.
monokai.C13 = 38,2,174,129,255 # Hint: the percentage bar.
monokai.C14 = 38,2,92,90,85 # Hint: the digits in the percentage bar. (NOTE: decoration: 5 -> blink)
monokai.C15 = 48,2,115,109,56,1 # Hint: the song's elapsed time.
monokai.C16 = 48,2,39,40,34 # Hint: the moving progress bar itself (IMPORTANT: This must a BG code, no FG or attr.).
Yes, it's paid. Have a subscription for some 5 years.
BTW, had a strange idea just now - what if I should log into my account from this RPi at least once?.. So, I installed all that GUI, VNC, Chromium, but sadly - it was all in vain :( Even generated a new password from this RPi - nothing changed :(
UPD: Just ran it on a PC and on a RPi after "export TIZONIA_GMUSICPROXY_DEBUG=1"
and looking through this logs I noticed that on PC it says
https://android.clients.google.com:443 "POST /auth HTTP/1.1" 200 None
and on a RPi it's
https://android.clients.google.com:443 "POST /auth HTTP/1.1" 403 None
..so on a PC it gets "OK" while on RPi it gets "Forbidden"... any idea why could it be?
I have a feeling this is because of gmusic.device_id it is the only thing that makes sense to me that would cause it to be forbidden.
I am finding this issue extremely odd. Maybe we should start your setup from scratch?
I guess another option is that I dd my RPi image for you (I have a RPi 2B with an I2S DAC).
Well, on a PC when a device_id was wrong it said so and told me to correct ones with wich everything works. So, on RPi I tried to put the device_id the same, I tried to put completely random one there - nothing changes, I still get this "NotLoggedIn" thing :(
I thought about making a completely fresh install of Raspbian on another microsd card.. maybe I'll do that when the stars are aligned :)
Allright, I did a fresh install.. now it doesn't say "NotLoggedIN" it says:
tizonia --gmusic-library
tizonia 0.21.0. Copyright (C) 2020 Juan A. Rubio and contributors
This software is part of the Tizonia project <https://tizonia.org>
[Google Play Music] [Connecting] : '[email protected]'.
[Google Play Music] [Authenticating] : 'with cached auth token'
[Google Play Music] [Tracks in queue] '18466'.
...and that's it. It does not start to play.. Man am I frustrated :(
UPD: YES YES YES!!!!
I uninstalled tizonia-* and ran your script again! IT F$%^ING WORKS NOW!! :)
Oh, btw, your new script has some errors:
./rpi-tizonia-buster.sh: line 12: Echo: command not found
and then in the end:
./rpi-tizonia-buster.sh: line 32: syntax error near unexpected token `('
./rpi-tizonia-buster.sh: line 32: `echo "# gmusic.buffer_seconds = size of the audio buffer (in seconds) to use while'
Cool thanks about the errors, I just did the install manually and quickly compiled the script as a reference for the future. Can confirm all the echo
commands are fixed.
Okay that is good, at least your authenticated and it is only just an audio problem.
Are you using internal audio (HDMI / AUX) or an I2S DAC?
I had to uncomment this line default-audio-renderer = OMX.Aratelia.audio_renderer.alsa.pcm
in my config and comment the default-audio-renderer = OMX.Aratelia.audio_renderer.pulseaudio.pcm
one.
It might be the inverse for you. If you are using a I2S DAC it could be that isn't configured properly.
Internal. 3.5 audio-jack.
I always changed pulseaudio to alsa in the first place as it's stated.. somewhere, I don't remember allready what's where anymore :)
I suggest you force it to output just to the 3.5 audio jack:
https://www.raspberrypi.org/documentation/configuration/audio-config.md
Then this is the section for the alsa or pulseaudio (from what I just read this needs to be alsa):
echo "CHANGE AUDIO RENDERER FOR RPI : "
echo "nano $HOME/.config/tizonia/tizonia.conf"
echo ""
echo "# Tizonia player section"
echo "# The default audio renderer used by the tizonia player"
echo "# -------------------------------------------------------------------------"
echo "# Valid values are:"
echo "# - OMX.Aratelia.audio_renderer.pulseaudio.pcm"
echo "# - OMX.Aratelia.audio_renderer.alsa.pcm"
echo "#default-audio-renderer = OMX.Aratelia.audio_renderer.pulseaudio.pcm"
echo "default-audio-renderer = OMX.Aratelia.audio_renderer.alsa.pcm"
Some extra resources:
I suggest you force it to output just to the 3.5 audio jack:
I did. Years ago in fact :)
I tried generating app-passwords, then I tried to turn 2-step verification off and put my actual password inside the config, whatever I did - nothing changed whatsoever :(
And the funniest thing is - on a laptop everything works in both cases!