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