freyr-js icon indicating copy to clipboard operation
freyr-js copied to clipboard

Manual Compilation

Open miraclx opened this issue 4 years ago • 6 comments

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

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

miraclx avatar Dec 20 '20 00:12 miraclx

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

miraclx avatar Dec 20 '20 00:12 miraclx

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

Godslovelee avatar Jan 02 '21 21:01 Godslovelee

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 avatar Feb 09 '22 00:02 miraclx

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.

miraclx avatar Feb 09 '22 01:02 miraclx

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

  • 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?)

Leezan-1 avatar Feb 09 '24 14:02 Leezan-1