Browse Source

Script: Support embedding tumbnails in playlists

wayland
Riyyi 3 days ago
parent
commit
5ecf4b09e7
  1. 13
      .local/bin/dl

13
.local/bin/dl

@ -74,10 +74,14 @@ done
embedAudioThumbnail()
{
# Get file name
fileName="$(youtube-dl --get-filename "$1")"
# Get file names
youtube-dl --get-filename "$1" |
while IFS= read -r fileName; do
fileName="${fileName%.*}"
# Skip if no thumbnail
[ ! -f "${fileName}.webp" ] && [ ! -f "${fileName}.jpg" ] && continue
# Convert thumbnail to actually be a jpg
yes y | ffmpeg -i "${fileName}.webp" "${fileName}_converted.jpg" > /dev/null 2>&1
yes y | ffmpeg -i "${fileName}.jpg" "${fileName}_converted.jpg" > /dev/null 2>&1
@ -90,8 +94,9 @@ embedAudioThumbnail()
"${fileName}_embed.mp3" > /dev/null 2>&1
# Remove left over files
rm -f "./${fileName}_converted.jpg" "./${fileName}.jpg" "./${fileName}.mp3"
mv "${fileName}_embed.mp3" "${fileName}.mp3"
rm -f "./${fileName}_converted.jpg" "./${fileName}.jpg" "./${fileName}.webp"
mv -f "${fileName}_embed.mp3" "${fileName}.mp3"
done
}
downloadAudio()

Loading…
Cancel
Save