| 1234567891011121314151617181920212223242526272829303132333435363738 |
- #!/bin/bash
- if [ $# -eq 0 ]; then
- echo "Usage: $0 <export-file.json>" >&2
- exit 1
- fi
- export_file="$1"
- if [ ! -f "$export_file" ]; then
- echo "Error: File '$export_file' not found" >&2
- exit 1
- fi
- jq -r '
- .playlists | to_entries | .[] |
- "# \(.key)",
- (
- [.value[] |
- select(.status != "done") |
- "\(.url)\t\(.title)"
- ] |
- if length > 0 then .[] else empty end
- ),
- (
- if ([.value[] | select(.status == "done")] | length) > 0 then
- "## Done",
- ([.value[] |
- select(.status == "done") |
- "\(.url)\t\(.title)"
- ] | .[])
- else
- empty
- end
- ),
- ""
- ' "$export_file"
|