(redirected from ffpodcast.sh)


A podcast downloader in Bash.

About (or so)

flip@ds508 ~/Musik/Podcasts $ ./ffpodcast.sh -h
ffpodcast.sh -- flipflip's podcast downloader, revision 698 $


  ffpodcast.sh is a podcast downloader. It has very few dependencies and almost
  everything is implemented in Bash. Why you ask? Because it's fun.. :)


  ffpodcast.sh [options] <file|url> | -h | -d

  -p path  Sets the directory to download podcasts to (defaults to $PWD).

  -n int   Number of podcasts to download. 0 means all available (defaults to 0).

  -s expr  Specifies file rename expression of the form regex/repl, where regex is
           an extended regular expression as described in bash(1) and regex(7) and
           repl is the replacement string. Back references are allowed.

  -a       Preserves original modification date (even with -t, -x and -g).

  -t rule  Set tags according to the rule specified. Only available with id3v2.
           See 'Tagging' below.

  -x prg   Run post-processing programme prg after download, tagging and mp3gain
           with these arguments: full path to mp3 file, original mp3 file name,
           download directory.

  -X args  Arguments to pass (append) to the post-processing programme.

  -g       Run mp3gain on downloaded files (only with mp3gain and .mp3 files).

  -h       Prints usage info (this screen).

  -q       Sets quiet operation.

  -d       Increases debug level (overrides -q). Currently -d -d -d is the maximum.
           Debug and error messages and warnings are sent to stderr.  First -d
           enabled standard debug messages. Second -d shows stuff that
           otherwise would be redirected to /dev/null. Third -d shows XML
           parsing results, which might be a lot of bytes.

  file/url Path to a local file or a http:// URL to a podcast feed file (XML, OPML).


  GNU bash >= 3.1 (maybe 3.2, not sure), GNU wget >= 1.10.2, GNU du, cp, rm and
  date (i.e. GNU coreutils), and optionally, id3v2 >= 0.1.11 (id3lib >= 3.8.3),
  mp3gain >= 1.4.6, stat and touch.


  The files /etc/ffpodcastrc and ~/.ffpodcastrc are sourced by the script if
  they exist.

Environment Variables:

  WGET, DU, CP, MV, RM, DATE, MP3GAIN, ID3V2, STAT and TOUCH may point to the
  appropriate binaries. TMPDIR may point to a temporary directory. COLUMNS may
  be set (or rather exported) for formatted screen output. Alternative
  arguments to wget and mp3gain calls may be set through FFPODCAST_WGETARGS and
  FFPODCAST_MP3GAINARGS, respectively. See -d for the defaults. Output (stdout
  and stderr) of external programmes (e.g. wget) are redirected to
  FFPODCAST_DEVNULL (e.g. /dev/stderr), which defaults to /dev/null. See also
  Character Encoding below.

Character Encoding

  The environment variable FFPODCAST_DECODE may contain a list of user-supplied
  routines, which are called to decode (convert) strings from the podcast XML
  file and the tags to other charsets. It defaults to a number of internal decoding
  routines, which converts a most latin1 characters to UTF-8. These routines
  is not very sophisticated. It might mess up the strings. See also example below.

Tagging (only available if you have id3v2):

  rule = title%artist%album%year%genre%comment, where each field is a string
  which will be used as the tag. If the string is empty the respective
  tag field will not be modified. The year field must be an integer value.
  The following keywords will be replaced with the appropriate content. The
  keyword must be single words separated from other content by white space
  (e.g. "[year]" won't work but "[ year ]" will work).:

    chtitle  = channel title
    chauthor = channel author
    chdesc   = channel description
    title    = podcast title
    subtitle = podcast subtitle
    desc     = podcast description
    author   = podcast author
    summary  = podcast summary
    year     = current year (4 digits)
    empty    = empty string (useful to remove a tag)

  The tagging routine writes id3v2 tags only and removes all other tags. Only
  TPE1 (artist), TALB (album), TYER (year), TCON (genre) and COMM (comments)
  frames (tags) are processed. All others are stripped from the file.
  Multiple comment frames are concatenated.


  BBC Today podcasts are named according to the scheme 'today_YYYYMMDD.mp3'. To
  rename the file to something better readable, you could use something like this:

  ffpodcast.sh -s 'today_(....)(..)(..).*.mp3/Today_\1-\2-\3.mp3' ...

  Many podcasts have weird tags. To clean up the title, the album and the genre
  as well as to set the current year and to insert the description from the feed
  meta data (XML) as a comment, use:

  ffpodcast.sh -t "%DRS%Echo der Zeit%year%Radio%desc" ...

  Quotes must be escaped:

  ffpodcast.sh -t "%DRS%Echo \"der\" Zeit%year%Radio%desc" ...

  To keep all original tags but remove all comments:

  ffpodcast.sh -t "%%%%empty" ...

  To add lots of comments:

  ffpodcast.sh -t "%DRS%Echo der Zeit%year%Radio%subtitle -- year -- desc -- chtitle -- chdesc"

  To check if the parameters are within limits, call ffpodcast.sh without an URL or file:

  ffpodcast.sh -d [options]

  To convert all latin1 characters to UTF-8 you could use (in the rcfile):

  function myconvert() { echo "" | iconv -cs -f latin1 -t utf8; }

  To do no conversion at all, use FFPODCAST_DECODE="".


  Copyright (c) 2007-2009 Philippe Kehl <flipflip at gmx dot net>.


  This is Free Software. See the source code and the file 'COPYING'.


  The Internet et al.


See the included files drs.sh and bbc.sh.



From revision 1.19 to 698:

From revision 1.17 to 1.19:

Visitors to this page so far.