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

Tidal & Jiosaavn , Advanced mirroring #247

Open
wants to merge 29 commits into
base: master
Choose a base branch
from

Conversation

WeeeeeeeeeeS
Copy link

@WeeeeeeeeeeS WeeeeeeeeeeS commented Jan 4, 2025

Added Two New Platforms

Proxy support

  • Added a ProxyManager to handle multiple proxies. (A method to avoid using specific failing proxies is not yet implemented)
    Proxy Manager is implemented by @topi314 & @WeeeeeeeeeeS
    Added proxy support to Deezer & JioSaavn (ProxyManager is easy to set up for every source, but each source has a unique implementation)

Advanced mirroring

  • Added advanced string mirroring, which is useful for platforms that don't support isrc. This method compares the title, author name, and duration for better search results.
    (By using this there's no need for YouTube in mirroring. You can use Deezer or other platforms, and fallback to YouTube only if no matches are found)_

(Yes, the branch's name is spelled incorrectly)

WeeeeeeeeeeS and others added 16 commits January 2, 2025 15:35
…ioTrackResolver & issue fixed in Deezer/Savaan when not using proxies

removed newer java syntax to make compiler happy

made StringCompareMirroringAudioTrackResolver easier to change/maintain

rewrote StringCompareMirroringAudioTrackResolver

Refactored SaavnAudioSourceManager & used proxymanager

added proxy manager & applied it to deezer

tidal, savaan, proxy support,
Fixed DefaultMirroringAudioTrackResolver and made it more readable
@topi314
Copy link
Owner

topi314 commented Jan 15, 2025

Jiosvaan (playback):
For external api: used appujet apiurl implementation
Proxied Jiosvaan api is implemented by @WeeeeeeeeeeS (inspired by appujet's external api) & web debugging tools;)

I am not a fan of having to run a very specific service just to get Jiosvaan to work
it should just be lavalink and at most a generic http proxy

@@ -22,8 +22,10 @@ dependencies {
compileOnly("com.github.topi314.lavasearch:lavasearch:1.0.0")
implementation("com.github.topi314.lavasearch:lavasearch-plugin-api:1.0.0")
implementation("com.github.topi314.lavalyrics:lavalyrics-plugin-api:1.0.0")
implementation("me.xdrop:fuzzywuzzy:1.4.0")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation, a .editorconfig exists for a reason

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't understand this. How can it be adjusted?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea what editor you use, but ideally it would respect this file
https://github.com/topi314/LavaSrc/blob/master/.editorconfig

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i use intellij ultimate, and it looks like it didn't respect it

README.md Outdated Show resolved Hide resolved
README.md Outdated
Comment on lines 81 to 90
enabled: false # Whether to enable the advanced mirroring feature
titleThreshold: 50 # The threshold for the title match (50 is the most optimal)
authorThreshold: 70 # The threshold for the author match (70 is the most optimal)
totalMatchThreshold: 196 # The threshold for the total match (196 is the most optimal)
skipSoundCloudGo: true # Whether to skip the SoundCloud Go tracks (preview tracks)
levelOnePenalty: 1 # The penalty for the first level
levelTwoPenalty: 2 # The penalty for the second level
levelThreePenalty: 0.8 # The penalty for the third level
sources: # The sources to use for the advanced mirroring
- jssearch
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this config is a mess tbh. this should be restructured

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to be optional; advanced users can still add these if they want

    providers: # Custom providers for track loading. This is the default
#      - "dzisrc:%ISRC%" # Deezer ISRC provider
#      - "dzsearch:%QUERY%" # Deezer search provider
#      - 'jssearch:%QUERY%' # JioSaavn search provider (recommended to use with advanced mirroring & search proxies)
      - "ytsearch:\"%ISRC%\"" # Will be ignored if track does not have an ISRC. See https://en.wikipedia.org/wiki/International_Standard_Recording_Code
      - "ytsearch:%QUERY%" # Will be used if track has no ISRC or no track could be found for the ISRC
    #        you can add multiple other fallback sources here
    #advancedmirroring: # A custom resolver that will be used for regular QUERY searches, and get you the best results from the sources you provide (Recommended for use with bad search platforms)
      #sources: # The sources to use for the advanced mirroring
      #  - jssearch # JioSaavn search source
      # skipSoundCloudGo: true # Whether to skip the SoundCloud Go tracks (preview tracks) (optional)
      # You can also set the threshold for the title, author & total match (titleThreshold, authorThreshold (1 - 100), totalMatchThreshold (1 - 300)) (optional)
      # levelOnePenalty: 1, levelTwoPenalty: 2, levelThreePenalty: 0.8 # Penalties for the first, second, and third levels (optional)

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@@ -10,6 +10,8 @@

public class DefaultMirroringAudioTrackResolver implements MirroringAudioTrackResolver {

private StringCompareMirroringAudioTrackResolver advancedResolver;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't touch the DefaultMirroringAudioTrackResolver.java
just create a new class with the new resolver

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, now StringCompareMirroringAudioTrackResolver got the functionality of DefaultMirroringAudioTrackResolver with the string calculation

import java.util.function.Function;


public class ProxyManager {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't this be an implementation of the HttpInterfaceManager interface?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private final SaavnAudioSourceManager sourceManager;
private static final String ALGORITHM = "DES";
private static final String TRANSFORMATION = "DES/ECB/PKCS5Padding";
private static final String SECRET_KEY = "38346591";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I want this secret in my repo

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use this api endpoint to do the same stuff without keeping the secret.

import httpx
from typing import Final, Dict, Any
from rich import print

url: Final[str] = "https://www.jiosaavn.com/api.php"

params: Dict[str, Any] = {
    "__call": "song.generateAuthToken",
    "url": "iPPGVzyogeiPwpro65A0eUaQggN+8+J4iDtmEk3uit8d0jqF5NCeUjs9dz6L27C23x77SeY9M6473Jd7+DUPjoPzFaL/aK97",  # encrypted_media_url
    "bitrate": 320,
    "api_version": 4,
    "_format": "json",
    "ctx": "web6dot0",
    "_marker": 0,
}

client = httpx.Client()
resp = client.get(url, params=params)
print(resp.json())

Response

{
    'auth_url':
'https://ac.cf.saavncdn.com/241/d8045f2d787adacdb17533acacd8b298_320.mp4?Expires=1738152371&Signature=PVjJu~qnCey3A~WQw~-l~-GFmuIUZVu65iXZaJW1DBtzGWabkUDS6Daj7MyFnW1THOF8oBanQ4~3-8c81kLFLj41Hpj36GcetR6nzk1EyplYaRLg89bO5-ID5vb8yuo76WFdKZ7oSxD18K8XZ4qPXGRd9cYn7v2JRurw7MWOdg6HNSGFFRBppNpkNT8lp11IZNZ35~TaaTUJA4PWd7um4gEIWykH8o0BDGpkdhY6miMKhvNDKRMx7xlmzxVbvX-~tbwVWsYMWVhNxPXT2Jxqa1km7HuA4prhan-2q7mJmtJiT268uR7YvWYzUzdQmeIODNYEtO-MgySeUwiJNicTCg__&Key-Pair-Id=APKAJB334VX63D3WJ5ZQ',
    'type': 'mp4',
    'status': 'success'
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll give this a look, after i finish rewriting the Proxy system & config stuff
https://discord.com/channels/1082302532421943407/1114604784880734359/1332011810802630778

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.

3 participants