Skip to content

Commit

Permalink
buffered feeding makes Spotify playlist system happier
Browse files Browse the repository at this point in the history
  • Loading branch information
rsms committed Jul 13, 2010
1 parent aa0ccda commit 6518ade
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.