Shuffle playlist, fetch list of artists, fetch list of genres#36
Shuffle playlist, fetch list of artists, fetch list of genres#36HenryGlendening wants to merge 9 commits intomaddox:masterfrom
Conversation
…& applescript for fetching artists & genres from iTunes and keeping cached text files of both lists. Add endpoint to manually force update of artist & genre caches
|
That makes sense. My ultimate goal is to build a basic app to control HomeKit, which would include the ability to browse a list of artists/genres/playlists and pick one to play/shuffle. This would allow my other family members to change the music on our shared iTunes library. Also, I have some Hue dimmer switches and want them to control the music for their respective area of my home. I'd like each press of the On button to 'change the radio station' (change the music to the next playlist in a pre-defined queue rotation of playlists). The code I added should make this easy with HomeKit automations. Here's a homebridge plugin to set up the API routes (for specific playlists or artists) are HomeKit devices - https://github.com/Supereg/homebridge-http-switch |
…Playing playlist due to higher efficiency than by using JXA
1ae4204 to
ea3f5e2
Compare
…ueries. Add route for Playing/Shuffling an artist
I have added new endpoints.
The first addition is for shuffling a playlist, either by name or playlistId.
The second addition is the beginning of some other new features I'm hoping to add. Now there are endpoints for getting a list of all Album Artists, as well as a list of getting all Genres. Initially when the server starts, if a cache has not been created each for Artists and Genres, the Album Artist names will all be fetched from iTunes and written to /tmp/artists.txt. The same is true for Genres, but to /tmp/genres.txt. These cache files will now be read when the server starts in the future, and loaded into memory otherwise, for when the endpoints are hit. The 'update' endpoints for Artists and Genres will trigger doing a fresh metadata grab from iTunes to update the respective cache file.
Ultimately, the Artists and Genres endpoints were added to assist in new endpoints I'd like to work on next for shuffling a specific artist or genre. This would allow a client application to display all genres/artists and the user could pick from them.
I'm a total beginner with JS and am still learning with AppleScript, so if there are obvious refactors I missed, I won't be surprised. That being said, hopefully the code doesn't look too bad!