Skip to content
Browse files

buffered feeding makes Spotify playlist system happier

  • Loading branch information...
1 parent aa0ccda commit 6518adefa188bb5676027a39013d44006b2f19f0 @rsms committed
Showing with 15 additions and 4 deletions.
  1. +15 −4 run.sh
View
19 run.sh
@@ -10,8 +10,19 @@ SPOTIFY_PASSWD_FILE=spotify-updater/password
# Name of (existing) playlist in your Spotify account to be updated
SPOTIFY_PLAYLIST_NAME='Buzzing'
+# Feed push2playlists through a buffer of {limit} links
+declare -a links
+index=0
+limit=5
for f in $(python buzz-collector/main.py -k "$BUZZ_KEY" -s "$BUZZ_SECRET"); do
- spotify-updater/push2playlist \
- "$SPOTIFY_USER" "$(cat $SPOTIFY_PASSWD_FILE)" "$SPOTIFY_PLAYLIST_NAME" $f \
- || exit $?
-done
+ links[$index]=$f
+ ((index++))
+ if [ "$index" -eq "$limit" ]; then
+ spotify-updater/push2playlist \
+ "$SPOTIFY_USER" "$(cat $SPOTIFY_PASSWD_FILE)" \
+ "$SPOTIFY_PLAYLIST_NAME" ${links[@]} \
+ || exit $?
+ index=0
+ links=( )
+ fi
+done

0 comments on commit 6518ade

Please sign in to comment.
Something went wrong with that request. Please try again.