cmusextractpl (627B)
1 #!/bin/sh 2 # 3 # This script prints only the cached information for files in a playlist. 4 # 5 # cmus' cache stores information on all files ever added, even if they are then 6 # deleted from the library. Since the library can be exported as a playlist 7 # (:save -l library.pl), this sscript makes it possible to get cache 8 # information restricted to what is present in the library. (And also if you 9 # want information from playlists, as well, I guess). 10 11 [ -z $1 ] && { 12 echo "usage: extractpl <playlist> [cmus2tsv args]" 13 exit 2 14 } 15 16 pl="$1" 17 shift 18 19 cmus2tsv "$@" | cat "$pl" - | awk -F"\t" 'NF == 1 {saw[$1] = 1}; NF > 1 && saw[$1] == 1'