dotfiles/.local/bin/ogg_add_cover
2020-12-27 00:53:10 +01:00

16 lines
446 B
Bash

# -*- mode: sh -*-
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p ffmpeg
LINK="${1}"
FILE="${2}"
BASENAME="$(basename "${FILE}" .ogg)"
wget "${LINK}" -O "${BASENAME}.jpg" && \
ffmpeg -i "${FILE}" -f ffmetadata "${BASENAME}.meta" && \
ogg-cover-art "${BASENAME}.jpg" >> "${BASENAME}.meta" && \
ffmpeg -i "${BASENAME}.meta" -i "${FILE}" -map_metadata 0 -c:a copy "${BASENAME}-cover.ogg"
rm "${BASENAME}.meta"
rm "${BASENAME}.jpg"