Script: Support embedding tumbnails in playlists
This commit is contained in:
+9
-4
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user