Code Monkey home page Code Monkey logo

spotifysyncgoogle's People

Contributors

welles avatar

Watchers

 avatar

Forkers

gardinermichael

spotifysyncgoogle's Issues

Better way of updating playlists

Hey there,

I used your code as the underlying foundation for a project involving Spotify and google scripts.

I wanted to mention that I think I found a better way of updating playlists, especially considering the six minute time limit Google Scripts has for any one function:

https://github.com/gardinermichael/UpcomingShowsSpotifySyncGoogle/blob/main/app/Main.gs#L170
https://github.com/gardinermichael/UpcomingShowsSpotifySyncGoogle/blob/main/app/Main.gs#L248

The basic gist is that instead of adding or removing songs one by one, you take a giant array of track URIs (in the order that you want them in) and cut that up into smaller arrays of about 30 tracks each. This is because there is a URL size limit for URLFetch. Once you do that, you run a for loop going through each array hitting a url containing just those URIs. The trick is that for the first array in the array of arrays, you use this PUT call:

https://developer.spotify.com/documentation/web-api/reference/#/operations/reorder-or-replace-playlists-tracks
https://developer.spotify.com/console/put-playlist-tracks/

What this does is wipe the entire playlist to those first 30 tracks. However, when you're processing the subsequent arrays, you use the regular POST call to the same url that appends tracks to the playlist instead.

https://developer.spotify.com/documentation/web-api/reference/#/operations/add-tracks-to-playlist
https://developer.spotify.com/console/post-playlist-tracks/

It significantly decreases the processing time for editing the playlists, while still working with your CURRENT/LOG dashboard setup in Google Sheets.

Please let me know what you think or if anything doesn't make sense.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.