Skip to content
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

Merged
merged 11 commits into from
May 7, 2021

Conversation

Araxeus
Copy link
Collaborator

@Araxeus Araxeus commented May 5, 2021

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 before writer.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? #251


downloader-feedback in downloader/menu.js results in constantly refreshing the menu

ipcMain.on("downloader-feedback", (_, feedback) => {
	downloadLabel = feedback;
	refreshMenu();
});

(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:

dialog.showMessageBox({
type: "info",
buttons: ["OK"],
title: "Started Download",
message: `Downloading Playlist "${playlistTitle}"`,
detail: `(${playlist.items.length} songs)`,
});

And to update the download progress, 53bf7c5 adds a taskbar progress bar that gets updated by chokidar that watches the new playlist download directory

Copy link
Owner

@th-ch th-ch left a 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!

@@ -24,7 +24,14 @@ const ffmpeg = createFFmpeg({
});
const ffmpegMutex = new Mutex();

const downloadVideoToMP3 = (
function noTopic(channelName) {
Copy link
Owner

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?

Copy link
Collaborator Author

@Araxeus Araxeus May 7, 2021

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)

songInfo.artist = data.videoDetails?.media?.artist || await getArtist(win) || cleanupArtistName(data?.videoDetails?.author);

Copy link
Contributor

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.

Copy link
Collaborator Author

@Araxeus Araxeus May 7, 2021

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?

Copy link
Contributor

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 :)

Copy link
Owner

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!

Copy link
Owner

@th-ch th-ch left a 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! ✅

@th-ch th-ch merged commit 5faeddb into th-ch:master May 7, 2021
@Araxeus Araxeus deleted the fix-download-idtag-if-not-playing branch May 8, 2021 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Max downloads from a playlist is 99?
3 participants