From cb4f0d61f28bee5252f8bc6b3abaf40cab7f7ddb Mon Sep 17 00:00:00 2001 From: Vladimir Kiselev Date: Sun, 27 Mar 2022 07:24:40 +0300 Subject: [PATCH] Try to reauth spotify on each call --- README.MD | 4 ++-- main.go | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.MD b/README.MD index 3093ee7..381f7f2 100644 --- a/README.MD +++ b/README.MD @@ -32,8 +32,8 @@ Make sure you have **golang**, **youtube-dl** and **ffmpeg** installed. ### Environment variables to pass: ```bash DEBUG=false -ROLLBAR_TOKEN=4a505f108ef0402b9b2db8f363793946 +ROLLBAR_TOKEN=xxxxxxxxxxxxxxxxxxxx111111 TELEGRAM_APITOKEN=11111111111:XXXXXXXXXXXxxxxxxxxxx -SPOTIFY_ID=05c5bdfd503c4a489961d2e63f917b1d +SPOTIFY_ID=xxxxxxxxxxxxxxxxxxxx111111 SPOTIFY_SECRET=xxxxxxxxxxxxxxxxxxxx111111 ``` diff --git a/main.go b/main.go index c91cd2f..eed6d0a 100644 --- a/main.go +++ b/main.go @@ -35,9 +35,9 @@ var commandsKeyboard = tgbotapi.NewReplyKeyboard( func init() { rollbar.SetToken(os.Getenv("ROLLBAR_TOKEN")) - rollbar.SetEnvironment("production") // defaults to "development" - //rollbar.SetCodeVersion("v2") // optional Git hash/branch/tag (required for GitHub integration) - //rollbar.SetServerHost("web.1") // optional override; defaults to hostname + rollbar.SetEnvironment("production") + rollbar.SetCodeVersion("v1.1.3") // optional Git hash/branch/tag (required for GitHub integration) + //rollbar.SetServerHost("release.1") // optional override; defaults to hostname rollbar.SetServerRoot("github.com/rhiskey/spotytg") // path of project (required for GitHub integration and non-project stacktrace collapsing) - where repo is set up for the project, the server.root has to be "/" if os.Getenv("DEBUG") == "true" { @@ -76,6 +76,8 @@ func init() { } func ProcessUrl(i int, playlistURL string, update tgbotapi.Update, msg tgbotapi.MessageConfig) { + spotifyClient = auths.AuthSpotifyWithCreds() + apiEntity.SpotifyClient = spotifyClient savedFile, err := spotifydl.DonwloadFromURL(ctx, playlistURL, apiEntity) if err != nil { log.Print(err)