Skip to content

Commit 6de2ca3

Browse files
committed
Work harder to discern the enclosure file extension.
1 parent 47706d9 commit 6de2ca3

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed

ChangeLog

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@
2929
* Use the feed file extension instead of assuming .mp3
3030
* Whitespace cleanup
3131
* Clearer prompts and comments
32-
32+
2021-10-26 David Klann <dklann@broadcasttool.com>
33+
* Work harder to discern the download file extension

NEWS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
The NEWS file for RDFetch.
2+
-------------------------------------------------------------------------------
3+
v0.4.14 -- 29 October 2021
4+
5+
Changes:
6+
Work harder to determine the enclosure file extension (and thus the
7+
type)
8+
29
-------------------------------------------------------------------------------
310
v0.4.13 -- 29 October 2021
411

PACKAGE_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.13
1+
0.4.14

rdfetch.in

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ colors
3737
# This script complies with Semantic Versioning: http://semver.org/
3838
vMajor=0
3939
vMinor=4
40-
vPatch=13
40+
vPatch=14
4141
vHash='$Hash$'
4242

4343
# Get zsh functions necessary for this script.
@@ -363,8 +363,11 @@ function enableFeed() {
363363
if [[ -z "${rssXML}" ]] ; then
364364
warning "I could not retrieve this feed. Please make sure the URL, username (if needed) and password (if needed) are correct and try again."
365365
else
366-
typeset feedTitle=$(echo "${rssXML}" | ${XMLSTARLET} sel -t -m /rss/channel -v title --nl)
367-
typeset -r feedEnclosureFileExt=${$(echo "${rssXML}" | ${XMLSTARLET} sel -t -m /rss/channel -v item/enclosure/@url --nl)##*.}
366+
typeset feedTitle=$(echo "${rssXML}" | ${XMLSTARLET} sel -t -m /rss/channel -v title)
367+
## BUG ALERT: this "algorithm" for determining the download
368+
## file extension is not foolproof. More work to be done.
369+
typeset -r firstFeedEnclosure=$(echo "${rssXML}" | ${XMLSTARLET} sel -t -m /rss/channel -v item/enclosure/@url --nl | ${HEAD} -n 1)
370+
typeset -r feedEnclosureFileExt=${${firstFeedEnclosure%%\?*}##*.}
368371
fi
369372

370373
# Offer to create a Rivendell dropbox if we are making changes
@@ -1325,10 +1328,10 @@ EOF
13251328
##########################################################################################
13261329

13271330
############# BEGIN external shell commands used in this script. #############
1328-
# This script uses these 24 external commands.
1331+
# This script uses these 25 external commands.
13291332
# Look for them in their upper case, parameter expanded form.
13301333
typeset -a our_commands
1331-
our_commands=( awk cat chmod column cp crontab diff find fmt getopt grep hostname less mkdir mktemp mv nl podget rm sed sort wc wget xmlstarlet )
1334+
our_commands=( awk cat chmod column cp crontab diff find fmt getopt grep head hostname less mkdir mktemp mv nl podget rm sed sort wc wget xmlstarlet )
13321335
# Find the executables we need; this uses some basic shell and a ZSH trick:
13331336
# the (U) in the eval says to evaluate the parameter as all upper case
13341337
# letters. This snippet generates shell parameters representing the upper case

rdfetch.spec.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Name: rdfetch
88
# This package complies with Semantic Versioning: http://semver.org/
99
%define vMajor 0
1010
%define vMinor 4
11-
%define vPatch 13
11+
%define vPatch 14
1212
Version: %{vMajor}.%{vMinor}.%{vPatch}
1313
Release: @RPM_RELEASE@%{?dist}
1414
Summary: A Rivendell podcast fetcher

0 commit comments

Comments
 (0)