Add subtitle-paste script for youtube subtitles. - annna - Annna the nice frien… | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit bf78035f40e705cf610220abd19772985ad58f46 | |
parent d7a98c3e5f12fe4fffa83c713aec41155d3c5eb3 | |
Author: Annna Robert-Houdin <[email protected]> | |
Date: Sun, 19 Apr 2020 12:13:57 +0200 | |
Add subtitle-paste script for youtube subtitles. | |
Diffstat: | |
A subtitle-paste | 27 +++++++++++++++++++++++++++ | |
1 file changed, 27 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/subtitle-paste b/subtitle-paste | |
@@ -0,0 +1,27 @@ | |
+#!/bin/sh | |
+ | |
+set -x | |
+ | |
+export PATH="/home/annna/bin:$PATH" | |
+ | |
+if [ $# -lt 1 ]; | |
+then | |
+ printf "usage: %s url\n" "$(basename "$0")" >&2 | |
+ exit 1 | |
+fi | |
+ | |
+pastebase="/br/gopher/paste" | |
+url="$1" | |
+ | |
+cd "${pastebase}" | |
+tmpfile="$(mktemp -u p-XXXXXXXXXXXXX)" | |
+ | |
+youtube-dl -q --write-sub --skip-download -o "${tmpfile}" "${url}" | |
+ofile="$(basename $(find . -name "${tmpfile}.*"))" | |
+if [ $(stat -c%s "${ofile}") -eq 0 ]; | |
+then | |
+ rm "${ofile}" | |
+else | |
+ printf "gopher://bitreich.org/0/p/%s\n" "${ofile}" | |
+fi | |
+ |