-
Notifications
You must be signed in to change notification settings - Fork 58
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
base: master
Are you sure you want to change the base?
Conversation
…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
fixed a typo
I am not a fan of having to run a very specific service just to get |
@@ -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") |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
@@ -10,6 +10,8 @@ | |||
|
|||
public class DefaultMirroringAudioTrackResolver implements MirroringAudioTrackResolver { | |||
|
|||
private StringCompareMirroringAudioTrackResolver advancedResolver; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
main/src/main/java/com/github/topi314/lavasrc/proxy/ProxyConfig.java
Outdated
Show resolved
Hide resolved
import java.util.function.Function; | ||
|
||
|
||
public class ProxyManager { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
main/src/main/java/com/github/topi314/lavasrc/saavn/SaavnAudioSourceManager.java
Outdated
Show resolved
Hide resolved
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"; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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'
}
There was a problem hiding this comment.
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
...rc/main/java/com/github/topi314/lavasrc/mirror/StringCompareMirroringAudioTrackResolver.java
Outdated
Show resolved
Hide resolved
…nnecessary configurations for regular users, and kept the functionality for more advanced users
Added Two New Platforms
Proxied Jiosvaan api is implemented by @WeeeeeeeeeeS
Proxy support
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
isrc
. This method compares thetitle, 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)