Scripts to update my playlists
git clone git@github.com:smndhm/dzr-cron.git && cd dzr-cron && npm ci
This file exports an array of crons, each cron has the following structure:
{
refreshInterval,
action,
arguments,
}
refreshInterval
is the cron schedule expression, see: https://crontab.guru/.action
is the script to launch, can be "last-tracks", "sync-playlists" or "remove-duplicates".arguments
is the list of arguments to pass to the script, depends on the cron.
Because it's better to have an offline playlist for the car. Because my favorite tracks playlist has too many tracks to go offline. Because I only wanted my latest favorite tracks, I made this cron.
Because my kids wants to have their tracks during "apéro", I updated this cron.
{
refreshInterval: "0 * * * *",
action: "last-tracks",
arguments: {
playlists : [
{
access_token: "frblublublublublublublublublublublublublublublublu",
playlistId: 1234567890
},
{
access_token: "frblablablablablablablablablablablablablablablabla",
playlistId: 9876543210
}
],
nbTracks: 10,
noExplicitLyrics: true,
}
}
-
playlists
is an array of objects with the following properties:-
playlistId
is the playlist ID you want to synchonize. Must belong to the access_token account. -
access_token
is your Deezer user token allowing the script to perform actions on your library. Needsoffline_access
,manage_library
anddelete_library
permissions.See how to get an access_token on the Deezer API OAuth doc.
-
-
nbTracks
is the number of tracks you want to import from each playlists. -
noExplicitLyrics
if you don't want tracks with explicit lyrics. Optional, default is false.
What happened, Lucas had its playlist on my account, I was adding tracks for him and then, one day, he went to see mom... "What! You don't have my playlist?"
So I set the playlist public, mom added the playlist to its favorites, Lucas listens to its tracks... "What! Can't you add tracks?"
I didn't set the playlist collaborative, mom created a new playlist, added tracks, Lucas went back to dad... "What! You don't have my last tracks?"
Ok, new cron.
{
refreshInterval: "0 * * * *",
action: "sync-playlists",
arguments: [
{
access_token: "frblublublublublublublublublublublublublublublublu",
playlistId: 1234567890
},
{
access_token: "frblablablablablablablablablablablablablablablabla",
playlistId: 9876543210
}
],
}
Must be an array of objects with the following properties:
access_token
is your Deezer user token allowing the script to perform actions on your library. Needsoffline_access
,manage_library
anddelete_library
permissions.
See how to get an access_token on the Deezer API OAuth doc.playlistId
is the playlist ID you want to synchonize. Must belong to the access_token account.
I have a lot of titles in my favorite playlist and I realized that there could be the same track several times, this is often due to a track present in an album and in an EP, an album that has been reissued, etc. New cron.
This will delete last duplicate added track.
{
refreshInterval: "0 0 * * *",
action: "remove-duplicates",
arguments: {
access_token: "frblublublublublublublublublublublublublublublublu",
playlistId: 1234567890
},
],
}
Must be an objects with the following properties:
access_token
is your Deezer user token allowing the script to perform actions on your library. Needsoffline_access
,manage_library
anddelete_library
permissions.
See how to get an access_token on the Deezer API OAuth doc.playlistId
is the playlist ID you want to synchonize. Must belong to the access_token account.
You can launch the script using: npm run start
.
- Check API quota limit with multiples crons
- Better logs
- Add cron script to check and remove track if already exist
- Edit last-tracks cron to be able to set a specific playlist
- Tests
- Second script: sync different accounts playlists
- Cron script instead of using PM2 or others
- Create page to generate an access_token