From: Skullheadx <94652084+Skullheadx@users.noreply.github.com> Date: Mon, 14 Oct 2024 18:52:25 +0000 (-0400) Subject: add album and more accurate title/artist metadata X-Git-Url: http://git.skullheadx.com/nixos/static/gitweb.css?a=commitdiff_plain;h=4a5e72fe29fc376f6fa6827ca5a215435353d570;p=youtube-downloader.git add album and more accurate title/artist metadata --- diff --git a/README.md b/README.md index 4117e44..8f6da0b 100644 --- a/README.md +++ b/README.md @@ -12,5 +12,4 @@ downloads the audio and video and stitches it together in the current directory. - `-f` - force replace if file exists # TODO: -- [ ] add album name - [ ] figure out why -av takes so long compared to -a and -v \ No newline at end of file diff --git a/ytdl/__pycache__/funcmodule.cpython-312.pyc b/ytdl/__pycache__/funcmodule.cpython-312.pyc index 1852a60..af7fa62 100644 Binary files a/ytdl/__pycache__/funcmodule.cpython-312.pyc and b/ytdl/__pycache__/funcmodule.cpython-312.pyc differ diff --git a/ytdl/funcmodule.py b/ytdl/funcmodule.py index acd2018..83bfefb 100644 --- a/ytdl/funcmodule.py +++ b/ytdl/funcmodule.py @@ -62,6 +62,7 @@ def download(link, mode, force=False): def convert_add_metadata(input1, input2, output, yt, m1=1, m2=0): + artist, album, title = yt.vid_info['videoDetails']['keywords'] command = [ 'ffmpeg', '-i', input1, @@ -70,10 +71,11 @@ def convert_add_metadata(input1, input2, output, yt, m1=1, m2=0): '-map', f'{m2}', '-c', 'copy', f'-disposition:v:{m2}', 'attached_pic', - '-metadata', f'title={yt.title}', - '-metadata', f'artist={yt.author}', + '-metadata', f'title={title}', + '-metadata', f'artist={artist}', '-metadata', f'comment={big_num_format(yt.views) + " views"}', '-metadata', f'date={yt.publish_date}', + '-metadata', f'album={album}', output + ".mp4", '-y' ]