Skip to content

Commit 3708735

Browse files
authored
Merge pull request #116 from dmofot/playlist_fix
Fix play list functionality
2 parents 8802098 + cde49f9 commit 3708735

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

spotify

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,18 +234,18 @@ while [ $# -gt 0 ]; do
234234

235235
results=$( \
236236
curl -s -G $SPOTIFY_SEARCH_API --data-urlencode "q=$Q" -d "type=playlist&limit=10&offset=0" -H "Accept: application/json" -H "Authorization: Bearer ${SPOTIFY_ACCESS_TOKEN}" \
237-
| grep -E -o "spotify:user:[a-zA-Z0-9_]+:playlist:[a-zA-Z0-9]+" -m 10 \
237+
| grep -E -o "spotify:playlist:[a-zA-Z0-9]+" -m 10 \
238238
)
239239

240240
count=$( \
241-
echo "$results" | grep -c "spotify:user" \
241+
echo "$results" | grep -c "spotify:playlist" \
242242
)
243243

244244
if [ "$count" -gt 0 ]; then
245245
random=$(( $RANDOM % $count));
246246

247247
SPOTIFY_PLAY_URI=$( \
248-
echo "$results" | awk -v random="$random" '/spotify:user:[a-zA-Z0-9]+:playlist:[a-zA-Z0-9]+/{i++}i==random{print; exit}' \
248+
echo "$results" | awk -v random="$random" '/spotify:playlist:[a-zA-Z0-9]+/{i++}i==random{print; exit}' \
249249
)
250250
fi;;
251251

0 commit comments

Comments
 (0)