Simple podcast player
This commit is contained in:
		
							
								
								
									
										21
									
								
								podcast
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										21
									
								
								podcast
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
DIR="/home/stek/Dateien/podcasts"
 | 
			
		||||
cd "$DIR"
 | 
			
		||||
 | 
			
		||||
if [ "$1" == "sync" ]; then
 | 
			
		||||
    cat "urls"| while read url; do
 | 
			
		||||
	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\""
 | 
			
		||||
    done
 | 
			
		||||
elif [ "$1" == "play" ]; then
 | 
			
		||||
    rss_file="$(ls -1 *.rss | fzf)"
 | 
			
		||||
    nr=$(cat "$rss_file" | xq -r '.rss.channel.item[].title' | nl -v0 -w1 -s ' ' | fzf --with-nth=2.. --no-sort | cut -d " " -f 1)
 | 
			
		||||
 | 
			
		||||
    if [ "$nr" != "" ]; then
 | 
			
		||||
	echo "Play #$nr";
 | 
			
		||||
	mpv "$(cat "$rss_file" | xq -r ".rss.channel.item[$nr].enclosure.\"@url\"")" --no-audio-display
 | 
			
		||||
    fi
 | 
			
		||||
fi
 | 
			
		||||
		Reference in New Issue
	
	Block a user