mirror of
https://github.com/jwilsson/spotify-web-api-php.git
synced 2026-04-26 23:45:49 +03:00
[GH-ISSUE #267] How to run in command line? #194
Labels
No labels
bug
docs
enhancement
enhancement
enhancement
feedback wanted
good first issue
help wanted
help wanted
help wanted
invalid
pull-request
question
question
upstream
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotify-web-api-php#194
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Egregius on GitHub (Aug 10, 2023).
Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/267
Is there a way to use this in command line?
I'd like to create a script where my playlists get shuffled during the night.
I have the script working in a browser but would like to execute it by cron.
Thanks for your ideas.
@jwilsson commented on GitHub (Aug 12, 2023):
Hey!
I'd use the refresh token returned when requesting an access token (retrievable with
$session->getRefreshToken()) to request a new access token each time the script is run. The refresh token will change each time so be sure to store it between runs.Hope this helps you out!
@Egregius commented on GitHub (Aug 14, 2023):
Great, thanks!
Think I got it working.
Now need to figure out how to handle 'too many requests' errors. Already have a 1.5 second sleep between each request.
@jwilsson commented on GitHub (Aug 14, 2023):
Awesome!
Sounds like the
auto_retryoption could be of help here, it'll automatically sleep the amount of time needed.@Egregius commented on GitHub (Aug 16, 2023):
Looks good and stable now. Thank you for your responses!
Finally a true shuffle for my huge playlists 👯♂️