Skip to content

Instantly share code, notes, and snippets.

@assafmo
Last active January 5, 2019 19:29
Show Gist options
  • Save assafmo/1ba208c9ca9cf93553ec9c4ef134bf1f to your computer and use it in GitHub Desktop.
Save assafmo/1ba208c9ca9cf93553ec9c4ef134bf1f to your computer and use it in GitHub Desktop.
Download subtitles from addic7ed for an episode & delete hearing impaired help
#!/bin/bash
# sudo npm install -g ad7
file="$1"
(
cd $(dirname "${file}")
ad7 --show "$(basename "${file}" | grep -Pio '.+?S\d\dE\d\d' | sed -r 's/\.(s|S)[0-9]{2}(e|E)[0-9]{2}//')" \
--s "$(basename "${file}" | grep -Pio 'S\d\dE\d\d' | awk -F '(S|s)|(E|e)' '{print $2}')" \
--e "$(basename "${file}" | grep -Pio 'S\d\dE\d\d' | awk -F '(S|s)|(E|e)' '{print $3}')"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment