minipodplayer/podcast

20 lines
847 B
Plaintext
Raw Normal View History

2024-11-17 22:08:57 +00:00
#!/bin/bash
2024-11-20 16:44:35 +00:00
cd "$(dirname "$(realpath "$0")")"
2024-11-17 22:08:57 +00:00
if [ "$1" == "sync" ]; then
cat "urls"| while read url; do
2024-11-20 16:44:35 +00:00
curl -s -o .tmp.rss-file "$url"
name="$(cat .tmp.rss-file | xq -r '.rss.channel.title')"
mv .tmp.rss-file "${name}.rss"
echo "Updated \"$name\""
2024-11-17 22:08:57 +00:00
done
elif [ "$1" == "play" ]; then
2024-11-20 16:44:35 +00:00
rss_file="$(ls -1 *.rss | sed 's/\(.*\)\.rss/\1/g' | fzf).rss"
nr=$(cat "$rss_file" | xq -r '.rss.channel.item[].title' | nl -v0 -w1 -s ' ' | fzf --with-nth=2.. --no-sort --preview "cat \"$rss_file\" | xq -r '.rss.channel.item[{1}].description' | html2text --body-width=\$FZF_PREVIEW_COLUMNS" --bind 'ctrl-p:toggle-preview' --preview-window hidden | cut -d " " -f 1)
2024-11-17 22:08:57 +00:00
if [ "$nr" != "" ]; then
2024-11-20 16:44:35 +00:00
mpv "$(cat "$rss_file" | xq -r ".rss.channel.item[$nr].enclosure.\"@url\"")" --no-audio-display
2024-11-17 22:08:57 +00:00
fi
fi