sxmo_rss.sh: Allow up to 2 http requests instead of only handling 1st
This changes to sxmo_rss.sh allows up to 2 http requests to be handled as some rss feeds provide either a link, or a link and enclosure, an example of this is PostmarketOS Podcast, with a link to the website and a link to the content in the same file. When the script detects more than one it breaks them into: Link {1st http address} Enclosure {2nd http address} Otherwise everything happens as per the script originally. This change line up with how sfeed_curses presents the links. Signed-off-by: hazardchem <hazardchem@disroot.org> Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
This commit is contained in:

committed by
Willow Barraco

parent
6638fc402b
commit
e4ffce9a69
@@ -46,7 +46,7 @@ prep_temp_folder_with_items() {
|
|||||||
list_items() {
|
list_items() {
|
||||||
cd "$FOLDER" || die "Couldn't cd to $FOLDER"
|
cd "$FOLDER" || die "Couldn't cd to $FOLDER"
|
||||||
printf %b "Close Menu\nChange Timespan\n"
|
printf %b "Close Menu\nChange Timespan\n"
|
||||||
gawk -F'\t' '{print $1 " " substr(FILENAME, 3) " | " $2 ": " $3}' ./* |\
|
gawk -F'\t' '{print $1 " " substr(FILENAME, 3) " | " $2 ": " $3 " " $8}' ./* |\
|
||||||
grep -E '^[0-9]{5}' |\
|
grep -E '^[0-9]{5}' |\
|
||||||
sort -nk1 |\
|
sort -nk1 |\
|
||||||
sort -r |\
|
sort -r |\
|
||||||
@@ -113,8 +113,21 @@ rssreadmenu() {
|
|||||||
DMENUIDX=1
|
DMENUIDX=1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
URL="$(echo "$PICKED" | awk -F " " '{print $NF}')"
|
# Check for one http or 2, as there can be a link and enclosure
|
||||||
sxmo_urlhandler.sh "$URL"
|
if [ "$(echo "$PICKED" | awk -F "http" '{print NF-1}')" = "1" ]; then
|
||||||
|
URL="$(echo "$PICKED" | awk -F " " '{print $NF}')"
|
||||||
|
sxmo_urlhandler.sh "$URL"
|
||||||
|
else
|
||||||
|
URL="$(echo "$PICKED" | grep "http" | awk -F ' ' '{print "Link " $(NF-1) "\nEnclosure " $NF}' | awk '($0){print} END{print "Close Menu"}' | sxmo_dmenu.sh)"
|
||||||
|
case "$URL" in
|
||||||
|
"Close Menu") return 0;;
|
||||||
|
*)
|
||||||
|
PLAY="$(echo "$URL" | awk -F " " '{print $NF}')"
|
||||||
|
sxmo_urlhandler.sh "$PLAY"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user