music-dl icon indicating copy to clipboard operation
music-dl copied to clipboard

Ability to include music metadata in downloaded file

Open jyyyeung opened this issue 6 months ago • 2 comments

First of all, Thanks a lot for the great program!

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I always have to tag all the downloaded music after downloading, but it is a little uneasy when there are no initial metadata within the downloaded file.

Describe the solution you'd like A clear and concise description of what you want to happen.

It would be great if the downloaded file can include embedded metadata such as title, artist, albumArtist, album, trackNumber, lyrics, album image, etc.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

I have tried to fork this project and include this feature but sadly I am not familiar with PHP, so I don't really understand how to contribute and run this project locally.

Additional context Add any other context or screenshots about the feature request here.

Possibly useful information: https://soundcharts.com/blog/music-metadata

jyyyeung avatar Feb 20 '24 07:02 jyyyeung

@SheepYY039

I have no time at present to realize this good idea.

These are the local run steps.

  1. Install PHP(>=8.1).
  2. git clone https://github.com/guanguans/music-dl.git && cd music-dl
  3. Just execute the command(...path/php-binary music-dl) in the terminal.

This is the relevant code for the download section.

public function download(string $url, string $savePath): void
{
    $this->createHttpClient()->get($url, [
        'sink' => $savePath,
        'progress' => static function (int $totalDownload, int $downloaded) use (&$progress, $savePath): void {
            if (0 === $totalDownload || 0 === $downloaded || 'submit' === $progress?->state) {
                return;
            }

            if (! $progress instanceof Progress) {
                /** @noinspection PhpVoidFunctionResultUsedInspection */
                $progress = tap(progress($savePath, $totalDownload))->start();
            }

            value(static function (Progress $progress, int $downloaded): void {
                $progress->progress = $downloaded;
                $progress->advance(0);
            }, $progress, $downloaded);

            if ($totalDownload === $downloaded) {
                $progress->finish();
            }
        },
    ]);
}

😃 Looking forward to your code implementation and PR.

GitHub
Music Searcher and Downloader. - 音乐搜索下载器。. Contribute to guanguans/music-dl development by creating an account on GitHub.

guanguans avatar Feb 20 '24 08:02 guanguans

Stale issue message

github-actions[bot] avatar Apr 20 '24 08:04 github-actions[bot]