-
Notifications
You must be signed in to change notification settings - Fork 568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix downloader metadata if not currently playing #252
Fix downloader metadata if not currently playing #252
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for the improvement! Just a remark about sanitizing metadata which could be done in the provider instead of being done in the different plugins - I'm also fine to merge as is and improve it later!
plugins/downloader/youtube-dl.js
Outdated
@@ -24,7 +24,14 @@ const ffmpeg = createFFmpeg({ | |||
}); | |||
const ffmpegMutex = new Mutex(); | |||
|
|||
const downloadVideoToMP3 = ( | |||
function noTopic(channelName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks similar to what was done in the last.FM plugin (cleanupArtistName
- other suffixes like VEVO
can be removed too) and very useful! What do you think of moving that logic into the "song info" provider (and removing it from downloader/last.fm plugins) so that all plugins can benefit from it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea, I just implemented exactly what you said (one function in song-info, delete suffix ' - Topic' || 'VEVO'
)
even though all this really only matter when downloading music that isn't playing (doesn't use song-info)
since song-info will 99% of the time return either an already formatted artist name from playbar)
youtube-music/providers/song-info.js
Line 61 in 8b471c0
songInfo.artist = data.videoDetails?.media?.artist || await getArtist(win) || cleanupArtistName(data?.videoDetails?.author);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, but I think that having the variable available in advanced settings could be useful (instead of hardcoding it).
btw. I wouldn't mix none semicolon with one semicolon in the same file, but I'm sure this wasn't intended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really see the point in allowing users to change that list, since it will almost never have any effect anyways..
its pretty much just a last resort safeguard at this point
But what did you mean by mixing semicolons? just what was fixed in 1140c3e or something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I agree, and if someone wants to add a suffix to remove they can just change the source. I just meant that small difference fixed by linting :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't see the ongoing discussion before merging 🙈
Things look good but if needed, we can make a follow up PR!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for the contribution! ✅
PR #221 allows downloading song that aren't playing, but the metadata wasn't captured - which also threw an error:
"image.toPNG() is not a function"
.The same error was thrown once per song when downloading a playlist (since the metadata didn't contain a nativeImage)
Error is avoided by checking if
metadata.image
exist beforewriter.setFrame("APIC"...
Use
ytdl.getInfo(videoUrl)
to get metadata for songs that aren't playing (also for playlist-download items)this includes
metadata.image
Allows downloading playlist of unlimited size if
options.playlistMaxItems
isn't specified. fixes Max downloads from a playlist is 99? #251downloader-feedback
indownloader/menu.js
results in constantly refreshing the menu(Because every single song in the playlist sets a different label + refresh + restore original label + refresh)
This results in almost always crashing my application when I try to open the main menu while playlist is still downloading.
Instead uses the messageBox below To notify that playlist download started:
youtube-music/plugins/downloader/menu.js
Lines 62 to 68 in 13fb686
And to update the download progress, 53bf7c5 adds a taskbar progress bar that gets updated by
chokidar
that watches the new playlist download directory