minipodplayer/podcast
Florian Stecker 143fa6383e Parallel sync
2025-01-02 22:41:21 +01:00

20 lines
895 B
Bash
Executable File

#!/bin/bash
cd "$(dirname "$(realpath "$0")")"
if [ "$1" == "sync" ]; then
cat urls | xargs -d '\n' curl -Z $(seq 1 $(wc -l <urls) | xargs -I{} echo -o .tmp.{}.rss-file)
for file in .tmp.*.rss-file; do
name="$(cat "$file" | xq -r '.rss.channel.title')"
mv "$file" "${name}.rss"
echo "Updated \"$name\""
done
elif [ "$1" == "play" ]; then
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)
if [ "$nr" != "" ]; then
mpv "$(cat "$rss_file" | xq -r ".rss.channel.item[$nr].enclosure.\"@url\"")" --no-audio-display
fi
fi