miraclx / freyr-js

A tool for downloading songs from music streaming services like Spotify and Apple Music.
https://git.io/freyr-js
Apache License 2.0
1.6k stars 103 forks source link

Manual Compilation #11

Open miraclx opened 3 years ago

miraclx commented 3 years ago

Sometimes, freyr's internal logic for identifying sources across services fails, and track(s) affected can't be downloaded.

We should provide a means for manual intervention.

Where a user could manually identify the source and provider URIs that freyr can thereafter compile a track from.

We can do this by introducing a new subcommand - make

freyr make \<URI> --source youtube:URI

For example:

freyr make spotify:track:54bFM56PmE4YLRnqpW6Tha --source youtube:oDn4eKyhSH4

miraclx commented 3 years ago

An alternative to this would be to add a new flag to the get subcommand:

-M, --source-map \<SPEC>

Where SPEC is a comma-separated list of rules that define default sources for URIs.

For example, if the rules were partitioned by |

freyr spotify:album:7v0KN0VlHJZrhAbSbxEZvZ -M "spotify:track:2ouNoo43UNurALLYLCapJv|youtube:1lgSYfxmwoQ"

Tells freyr to download the album and to use a custom source for a track in the album

Godslovelee commented 3 years ago

yeah, a good deal of advantage would be for anyone to easily manually compile any track in case one doesnt like the sound of a particular song or just being able to add an alternative version of a song to the album would be cool

miraclx commented 2 years ago

So, It's been a minute, and one more issue – https://github.com/miraclx/freyr-js/issues/103.

Looking at this now, I don't particularly like the -M, --source-maps idea. However, we can consider using a JSON-formatted file that define track ⇿ source overrides.

Now, there are two approaches to this;

  1. We introduce a --track-map <file> / --source-map <file> that links to a JSON-formatted file in the following format;

    {
     // <service>: { <track id>: <source uri/url> }
     "spotify": {
       // Track: `spotify:track:2ouNoo43UNurALLYLCapJv`
       // Override URL: `https://www.youtube.com/watch?v=1lgSYfxmwoQ`
       "2ouNoo43UNurALLYLCapJv": "https://www.youtube.com/watch?v=1lgSYfxmwoQ"
     },
    
     // <track uri/url>: <source uri/url>
     "spotify:track:2ouNoo43UNurALLYLCapJv": "https://www.youtube.com/watch?v=1lgSYfxmwoQ",
     "https://open.spotify.com/track/2ouNoo43UNurALLYLCapJv": "youtube:1lgSYfxmwoQ"
    }
  2. We introduce a new sub-command – override that allows the user to override sources with either of the following options;
    • Single track overrides.
      $ freyr override spotify:track:2ouNoo43UNurALLYLCapJv https://www.youtube.com/watch?v=1lgSYfxmwoQ
    • Loading a JSON-formatted track map of overrides in the format defined above.
      $ freyr override -i <file>

      All overrides would then be stored globally to be reused whenever.

I think my personal preference is leaning towards #2.

miraclx commented 2 years ago

Tagging this "help wanted" so hopefully someone steps up to take this up. Unfortunately, I don't have as much free time to work on this. But I've prioritized it so maybe sometime soon.

Leezan-1 commented 9 months ago

Sometimes, freyr's internal logic for identifying sources across services fails, and track(s) affected can't be downloaded.

We should provide a means for manual intervention.

Where a user could manually identify the source and provider URIs that freyr can thereafter compile a track from.

We can do this by introducing a new subcommand - make

freyr make --source youtube:URI

For example:

freyr make spotify:track:54bFM56PmE4YLRnqpW6Tha --source youtube:oDn4eKyhSH4

  • Get track metadata from URI
  • Get audio from the source
  • Process audio with the metadata

Does this work? it ask for '--sources'. doesnt work with '---source'. freyr make -d /run/media/leezannn/.../... spotify:track:08DPqTowtGwpuUVuxRsO53 --source youtube:wvm3wKXAgtE

output: error: unknown option '--source' (Did you mean --sources?)

miraclx commented 9 months ago

@Leezan-1, this hasn't been implemented just yet, unfortunately