These forums are archived

See this post for further info

get_iplayer forums

Forum archived. Posting disabled.

Replace invalid characters in filenames, rather than remove them

user-2139

Currently, when creating filenames, get_iplayer removes invalid characters for Windows ('"*:<>?|') and macOS (':'). It would be useful if there were the option to replace these invalid characters with a valid character. I am a macOS user so I would be most interested in replacing : (a colon) with - (a hyphen) but would expect that Windows users might like to replace the characters that are invalid on that OS. My preference would be a command to allow the user to select the substitution; however, a pre-programmed alternative character would be an improvement.

Note that the list of excluded characters given above are taken from the description of --no-sanitise on the wiki page https://github.com/get-iplayer/get_iplay...ut-options; this appears to state that on macOS the apostrophe will be removed, my experience is that the apostrophe character is not removed. (This may be my incorrect interpretation of the manual due to the font used not distinguishing between apostrophe-like characters.)

(Original thread deleted by originator and replaced by this one with corrected Thread Subject and minor clarifications in message.)

user-2

Sorry, but it's a no from me. I prefer the current scheme. However, it would be a trivial change to implement an option for specifying a replacement string. If you or somebody else wants to submit a pull request, have a go. It's worth noting that since you use macOS you could easily accomplish the same thing by renaming your output files via --command.

The apostrophes (note there are two. at begin/end) in the online man page were merely quoting the forbidden characters. Still, they aren't needed, and are now gone.

user-2

On second thought, I would only accept a pull request that implements a replacement for colon characters, and only with --no-sanitise. It wouldn't make much sense to use the same replacement for double-quotes or question marks, which are the only other invalid characters you will encounter, and those are only relevant for Windows.

user-2139

user-2,

Thank you for your responses. I doubt if I will be the one to create a pull request, since my last real programming was about forty years ago using FORTRAN! I mainly use the web interface, except for setting some defaults including using --no-sanitize. I expect I will continue to use MassReplaceIt or manual editing to correct the filenames.

I would like to take the opportunity to thank you for your work on get_iplayer, including the recent introduction of the macOS package installer removing the need to use Homebrew with the consequent delays and opportunities for errors.

These forums are archived

See this post for further info