marcdjulien / spotify-terminal

Terminal application to play/control Spotify.
GNU General Public License v3.0
75 stars 9 forks source link

failed to execute default browser #84

Open hakxcore opened 3 years ago

hakxcore commented 3 years ago

Erase is control-H (^H).


/ / / /(_/ __ __ \/ \/ \/ / / // / / / / / // / // / /_/ / / /_/ / // ./__/__/// _, / /_/ //


  /_  _____  _________ ___  (_)___  ____ _/ /
   / / / _ \/ ___/ __ `__ \/ / __ \/ __ `/ /
  / / /  __/ /  / / / / / / / / / / /_/ / /
 /_/  \___/_/  /_/ /_/ /_/_/_/ /_/\__,_/_/

[marcdjulien]

Loading...

v0.15.2

Running Firefox as root in a regular user's session is not supported. ($XAUTHORITY is /home/user1/.Xauthority which is owned by user1.)

I think it is trying to open default borwser but it is not opening also i have tried to install it in termux there also its not working cann't we use 'xdg-open' there.

marcdjulien commented 3 years ago

Thanks. I will look into this. You can use this patch in the meantime to have the application display the link it's trying to visit:

diff --git a/spotify_terminal/authentication.py b/spotify_terminal/authentication.py
index fa05ded..e8ccf80 100644
--- a/spotify_terminal/authentication.py
+++ b/spotify_terminal/authentication.py
@@ -10,6 +10,7 @@ import urllib.request, urllib.parse, urllib.error
 import webbrowser
 from http.server import BaseHTTPRequestHandler, HTTPServer
 from threading import Thread
+import time

 from . import common

@@ -62,6 +63,13 @@ class Authenticator(object):
             web_thread = Thread(target=start_server)
             web_thread.start()

+            def show_link():
+                time.sleep(5)
+                if web_thread.isAlive():
+                    print("If stuck, visit: {}".format(self._authorize_url()))
+            message_thread = Thread(target=show_link)
+            message_thread.start()
+
             logger.debug("Opening %s in browser", self._authorize_url())
             webbrowser.open_new_tab(self._authorize_url())

You can copy the link and paste it into any browser.

marcdjulien commented 2 years ago

@hakxcore the patch I mentioned above it now released, so you can upgrade to get the url from the screen and paste it manually.

marcdjulien commented 2 years ago

@hakxcore how are you executing the program? Are you using sudo?