blob: 344126106d5df9b349508266b60d225e8d9c4f41 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#!/bin/sh
# Search Deezer
a=
test "$1" = -a && { a=1; shift 1; }
test -z "$1" && { echo usage: $0 [-a] query 1>&2; exit 1; }
q=`printf '%s' "$1" | jq -sRr @uri`
if test -z "$a"
then jq='.TRACK.data[] | .SNG_TITLE + "\t" + .ART_NAME + "\t" + .ALB_TITLE + "\t" + .SNG_ID'
else jq='.ALBUM.data[] | .ALB_TITLE + "\t" + .ART_NAME + "\t" + .ALB_ID'
fi
rm /tmp/dzq 2> /dev/null
curl -s "https://www.deezer.com/search/$q" |
grep __DZR_APP_STATE__ |
cut -d= -f2- |
jq -r "$jq" 2>&- |
sed 's/ */ /g' |
nl -w 2 |
tee -a /tmp/dzq
|