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

Loading…
Cancel
Save