diff --git a/README.md b/README.md index 6e649eb..944bb69 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,13 @@ $ somafm listen groovesalad 22:27:30 | Mindex - Jagga-jah ``` +You don't have to write the whole channel name, the first letters are enough. + +```console +$ somafm listen groov +22:27:30 | Mindex - Jagga-jah +``` + ### Listen to Groove Salad at highest quality: ```console $ somafm listen groovesalad --quality=highest diff --git a/src/somafm b/src/somafm index 959e62f..997366b 100755 --- a/src/somafm +++ b/src/somafm @@ -65,7 +65,7 @@ function help() { function listen() { local playlist=$(curl -s -H 'Accept: application/json' https://somafm.com/channels.json | \ - jq -r ".channels | map(select(.id == \"${channel}\")) | .[]" | \ + jq -r ".channels | map(select( (.id == \"${channel}\") or (.id | test(\"^${channel}\")) )) | limit(1;.[])" | \ jq -r ".playlists | map(select(.quality == \"${quality}\")) | limit(1;.[]) | .url") case "${playlist}" in