1
0

Update xmllint

This commit is contained in:
Piperrak Collective 2018-12-08 16:45:45 +01:00
commit 4fce65c22c

107
download_podcast.sh Normal file
View File

@ -0,0 +1,107 @@
#!/bin/bash
# The following script parses podcast feeds and downloads all podcast episodes listed in
# the feed if they don't exist within the target path. The target directory will be created
# if it does not exist.
[ -x "$(command -v wget)" ] || (echo "wget is not installed" && exit 1)
[ -x "$(command -v sed)" ] || (echo "sed is not installed" && exit 1)
[ -x "$(command -v xargs)" ] || (echo "xargs is not installed" && exit 1)
function download_files_from_feed {
[ -d $2 ] || mkdir -p $2
cd $2
echo $(date)
echo $3
filefull=$(wget -q -O - $1 | xmllint --format - | sed -n 's/.*enclosure.*url="\([^"]*\)" .*/\1/p' | head -n 1)
echo "Filefull: $filefull"
filename=`basename "$filefull"`
extension="${filename##*.}"
echo $filename
if [ ! -f $filename ]; then
echo "Nuevo programa a descargar"
wget -nc -O $filename $filefull
rm ultimo.mp3
if [ $extension == "mp3" ]; then
cp $filename ultimo.mp3
elif [ $extension == "ogg" ]; then
ffmpeg -i $filename ultimo.mp3
fi
fi
#wget -nc -O "ultimo.mp3" $(wget -q -O - $1 | sed -n 's/.*enclosure.*url="\([^"]*\)" .*/\1/p' | head -n 1)
#wget "${URL}"
#wget -nc $(wget -q -O - $1 | sed -n 's/.*enclosure.*url="\([^"]*\)" .*/\1/p')
mid3v2 -a $3 -A "Ultimo Podcast" ultimo.$extension
mid3v2 -a $3 -A "Ultimo Podcast" ultimo.mp3
}
function echo_update_stats {
PODCAST_UPDATE_LIST=$(find $1 -ctime -1 -type f)
echo "All podcasts updated."
if [ -n "$PODCAST_UPDATE_LIST" ]
then
echo -e "\nNew episodes within the last 24 hours:"
echo $PODCAST_UPDATE_LIST | xargs basename | xargs printf "* %s\n"
else
echo "No new episodes are available."
fi
}
# Download audio files from podcast feeds.
# Feed subscriptions are exemplified below.
PODCAST_DIR=/media/musica/PROGRAMAS/PODCASTS
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/hala-bedi-irratia/bertxoko/feed/ $PODCAST_DIR/BERTXOKO Bertxoko
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/bilbo-hiria-irratia/berbaz/feed/ $PODCAST_DIR/BERBAZ "Berbaz"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/info-7-irratia/revolutionary-grooves/feed/ $PODCAST_DIR/REVOLUTIONARY_GROOVES "Revolutionary_grooves"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/info-7-irratia/reggae-fever/feed/ $PODCAST_DIR/REGGAE_FEVER "Reggae_fever"
download_files_from_feed https://halabedi.eus/category/irratsaioak/musika/xperimental-sound-system/feed/ $PODCAST_DIR/XPERIMENTAL "Xperimental_sound_system"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/hala-bedi-irratia/a-desalambrar/feed/ $PODCAST_DIR/A_DESALAMBRAR "A_desalambrar"
download_files_from_feed https://www.ivoox.com/sangre-fucsia_fg_f162460_filtro_1.xml $PODCAST_DIR/SANGRE_FUCSIA "Sangre_fucsia"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/hala-bedi-irratia/erro-ta-berri/feed/ $PODCAST_DIR/ERRO_TA_BERRI "Erro_ta_berri"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/txapa-irratia/nola-aldatzen-diren-gauzak/feed/ $PODCAST_DIR/NOLA ALDATZEN DIREN GAUZAK "Nola_aldatzen_diren_gauzak"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/kontrako-eztarrixe/hankak-lurrien/feed/ $PODCAST_DIR/HANKAK_LURRIEN "Hankak_lurrien"
download_files_from_feed https://www.ivoox.com/programas-mar-fueguitos_fg_f1141927_filtro_1.xml $PODCAST_DIR/MAR_DE_FUEGUITOS "Mar_de_fueguitos"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/arraio-irratia/atalka/feed/ $PODCAST_DIR/ATALKA "Atalka"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/txapa-irratia/haus-of-beats/feed/ $PODCAST_DIR/HAUS_OF_BEATS "Haus_of_beats"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/hala-bedi-irratia/zuria-beltzez/feed/ $PODCAST_DIR/ZURIA_BELTZEZ "Zuria_beltzez"
download_files_from_feed https://halabedi.eus/category/irratsaioak/jendartegaiak/o-no-sera/feed/ $PODCAST_DIR/O_NO_SERA "O_no_sera"
download_files_from_feed http://www.ivoox.com/tokata-y-fuga_fg_f180144_filtro_1.xml $PODCAST_DIR/TOKATA_Y_FUGA "Tokata_y_fuga"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/radio-kultura/kultur-kuboa/feed/ $PODCAST_DIR/KULTUR_KUBOA "Kultur_kuboa"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/irulegi-irratia/adi/feed/ $PODCAST_DIR/ADI "Adi_Irulegi_irratia"
download_files_from_feed https://www.radiotopo.org/category/lucha-libre/feed/ $PODCAST_DIR/LUCHA_LIBRE "Lucha_libre"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/txapa-irratia/kolax/feed/ $PODCAST_DIR/KOLAX "Kolax"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/eguzki-irratia-irratien-programak/kolpezgolpe/feed/ $PODCAST_DIR/KOLPEZ_GOLPE "Kolpez_golpe"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/radixu-irratia/terranobakosalau/feed/ $PODCAST_DIR/TERRANOBAKOSALAU "Terranobako_salau"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/bilbo-hiria-irratia/soinugela/feed/ $PODCAST_DIR/SOINUGELA "Soinugela"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/arraio-irratia/zaratazarautz/feed/ $PODCAST_DIR/ZARATA_ZARAUTZ "Zarata_zarautz"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/hala-bedi-irratia/hiru-kortxea/feed/ $PODCAST_DIR/HIRUKORTXEA "Hiru_kortxea"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/hala-bedi-irratia/erraietatik/feed/ $PODCAST_DIR/ERRAIETATIK "Erraietatik"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/bilbo-hiria-irratia/gaur-ez-dago-eskolarik/feed/ $PODCAST_DIR/GAUR_EZ_DAGO_ESKOLARIK "Gaur_ez_dago_eskolarik"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/info-7-irratia/burdinola/feed/ $PODCAST_DIR/BURDINOLA "Burdinola"
download_files_from_feed https://www.ivoox.com/barrio-canino_fg_f147957_filtro_1.xml $PODCAST_DIR/BARRIO_CANINO "Barrio_canino"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/txapa-irratia/jar-itzazu-tapoiak-mesedez/feed/ $PODCAST_DIR/JAR_ITZAZU "Jar_itzazu_tapoiak"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/bilbo-hiria-irratia/piperpolis/feed/ $PODCAST_DIR/PIPERPOLIS "Piperpolis"
download_files_from_feed https://www.democracynow.org/podcast-es.xml $PODCAST_DIR/DEMOCRACY_NOW "Democracy_now"
download_files_from_feed https://halabedi.eus/category/irratsaioak/jendartegaiak/uhintifada/feed/ $PODCAST_DIR/UHINTIFADA "Uhintifada"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/kkinzona-irratia/1215-katea/feed/ $PODCAST_DIR/1215_KATEA "1215_katea"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/bilbo-hiria-irratia/potto/feed/ $PODCAST_DIR/POTTO "Potto"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/xorroxin-irratia/bertsoinka/feed/ $PODCAST_DIR/BERTSOINKA "Bertsoinka"
#download_files_from_feed https://eldesarmador.org/podcast.xml $PODCAST_DIR/EL_DESARMADOR "El_desarmador"
download_files_from_feed https://podcast.radioalmaina.org/category/infoalmaina/feed/ $PODCAST_DIR/INFOALMAINA "Info_Almaina"
download_files_from_feed http://www.arrosasarea.eus/category/irratien-programak/kkinzona-irratia/gauregur/feed/ $PODCAST_DIR/GAUREGUR "Gaur_egur"
# This one's sending notifications to my phone but might not be useful for you
#/root/send_notification.sh "$(echo_update_stats $PODCAST_DIR)"
#echo_update_stats $PODCAST_DIR
#1215_KATEA AUTODEFENSA_INFORMATICA EL_DESARMADOR KOLAX POTTO
#A_DESALAMBRAR BARRIO_CANINO ERROMERIAN KRITIKAL_BLUES REVOLUTIONARY_GROOVES
#ADI_IRULEGI_IRRATIA BERBENIR ERRO_TA_BERRI LA_CASA_INCENDIADA SANGRE_FUCSIA
#ANABASIS BERTSOINKA HAUS_OF_BEATS LUCHA_LIBRE TECNOPARANOIDS
#ANARKOFOLKA BERTXOKO HIRU_KORTXEA MUSIKARI TOKATA_Y_FUGA
#ANTXOEN_BERTSOA BURDINOLA INFO_ALMAINA NOLA_ALDATZEN_DIREN_GAUZAK ZARATA_ZARAUTZ
#ATALKA CABEZAS_DE_TORMENTA KASAKATXAN NON_DIRA ZURIA_BELTZEZ