#lavasrc - Spotify Local Files

1 messages · Page 1 of 1 (latest)

lofty summit
#

Why when loading a playlist local files are never accounted for and never searched? Is this on purpose? In v3 when i was using erela.js Spotify local files would be loaded.

kind sandal
#

It is on purpose

#

Since there is no guarantee on which fields may be set we just skip those

lofty summit
#

no plans to add optional support for it (such as a setting)? i format my local files 🥲

kind sandal
#

Not really, since I really don't want to have to deal with unset fields lol

#

It's not about you formatting local files

#

Others do not

lofty summit
#

yeah i get that

#

makes sense

kind sandal
#

Arguably nobody even uses that feature

#

(Except you apparently)

lofty summit
#

really? i know alooooot of people that use local files

#

like atleast 10-20

kind sandal
#

I've never heard of anyone

#

Since people using local files usually don't even have Spotify

lofty summit
#

it’s only for unreleased/leaked/edited versions of songs to be honest

#

hmm interesting

#

question, would it be possible for me to edit lavasrc and add support for local files? 🤔

kind sandal
#

If you know java sure, I might accept a pr

#

(only if it works reliable obviously)

lofty summit
#

i’ve worked with java only like once or twice, but i’ll attempt to do it

#

and test everything first

#

i’ll post some results here when i work on it 🤝

kind sandal
#

Do you set the isrc for local files?

#

Since that would make resolving way more reliable

#

Just as a general tip

lofty summit
#

i sadly do not

kind sandal
#

Then you should!

#

Makes resolving basically a 100% hit if the song exists

lofty summit
#

problem is some of these songs don’t even exist

#

for example, a leaked song

kind sandal
#

Well, I'm not saying all need it,

lofty summit
#

yeah i’ll sift thru and see if there’s any i can add isrc to, thanks for the suggestion

lofty summit
#

what meta data do you think should be optional? obviously local files don’t have the same meta data as actual songs but for example song title and artists is what i’m gonna set as mandatory so far and the rest is gonna be null if not found, what else do you think should be mandatory?

kind sandal
#

well, there is one thing which is 100% needed

#

without title there isn't anything to match

lofty summit
#

alrighty then i’ll just make title and artists mandatory just to make it a tad bit easier finding a match

kind sandal
#

artist is whatever tbh

#

¯_(ツ)_/¯

lofty summit
#

the only reason why i wanna do artists is because that’s one of the ways to know if people actually formatted their local files

kind sandal
#

just set author to unknown if there is none

#

lavaplayer is very strict about which fields are nullable and which not

lofty summit
#

alrighty

lofty summit
#

so uri artworkUrl and isrc are able to be nullable but title cant, author can be unknown if need be and length, identifier and isStream is from yt correct?

kind sandal
#

length, identifier and isStream is from yt correct

#

no

#

tracks are resolved on playback

#

not on search

#

it's all data from spotify

lofty summit
#

ah okay

#

makes sense

#

alrighty sounds good

#

ty

lofty summit
#

hey so i got local files to work but i ran into an issue, when a local file track is loaded most of the time duration is mismatched since local files can rly be edited into anything and there could be multiple versions so i think when tracks are loaded from youtube duration should be updated. also the second issue is the url is null obviously cuz there isnt one so i also think that url should be updated to the youtube one if there isnt a spotify url.

#

are you able to do that? if not how can i go about doing that because ive been searching thru lavaplayer and lavalink but i cant find where spotify metadata gets used to search on youtube 🥲

lofty summit
#

?

kind sandal
#

Since tracks are resolved at playtime not possible

#

There is I reason I skipped them

#

¯_(ツ)_/¯

lofty summit
#

damn so no possible way what so ever? thing is i know that v3 supported local files and there was no issues there..

kind sandal
#

?

#

tracks are resolved at playtime

#

not sure what u expect

lofty summit
# kind sandal ?

alrighty, for local use then i wanted to make the local file just search on youtube inside of the spotify getPlaylist function do you have any idea why youtube is returning no search results?

if (track.get("is_local").asBoolean(false)) {
    String trackName = track.get("name").text();
    String artistName = track.get("artists").index(0).get("name").text();
    String searchTerm = "ytsearch:" + track.get("name").text() + " " + track.get("artists").index(0).get("name").text();

    AudioSearchResult searchResult = youtubeSearchManager.loadSearch(searchTerm, Collections.singleton(AudioSearchResult.Type.TRACK));

    if (searchResult != null && !searchResult.getTracks().isEmpty()) {
        tracks.add(searchResult.getTracks().get(0));
        System.out.println("match found")
    } else {
        System.out.println("no match found");
    }
} else {
    tracks.add(this.parseTrack(track, preview));
}
kind sandal
#

that's not how mirroring works in lavasrc

#

it is intended to mirror at playtime

#

this is a feature and not a bug

#

if there is not enough info, than thats it

#

what if someone doesn't want to resolve tracks from yt?

#

but deezer instead

lofty summit
#

thats why i was just gonna edit the plugin and keep it local

#

cuz tbh i dont see any production-worthy way of allowing local files

kind sandal
#

it's simple

#

fill all the info possible

#

and hope for the best

lofty summit
#

you mean as in with the local file?

kind sandal
#

yes

lofty summit
#

well i filled in almost everything really

#

this is what its searching for yt for one of the songs for example: ytsearch:We Did It Kid (feat. Baby Keem & Migos) Kanye West

#

which shouldve came back with results

#

but im not getting any sadly

kind sandal
#

comes back with results for me

lofty summit
#

thats why im confused

#

cuz if i search like normal

#

results are fine

kind sandal
#

yes, I searched normal

lofty summit
#

no errors or anything either

kind sandal
#

I mean, I have no idea where this yt source manager is coming from

#

¯_(ツ)_/¯

#

but this also seems to use the search manager

#

which uses a different endpoint to get search results

#

yt infact only supports texts on that endpoint

lofty summit
# kind sandal I mean, I have no idea where this yt source manager is coming from

i imported it

import com.github.topi314.lavasrc.youtube.YoutubeSearchManager;
import com.github.topi314.lavasearch.result.AudioSearchResult;
import com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioSourceManager;

private YoutubeSearchManager youtubeSearchManager = new YoutubeSearchManager(() -> new YoutubeAudioSourceManager());
kind sandal
#

yes, you use the yt search manager

#

which uses a different endpoint

lofty summit
#

so then what should i be doing?

kind sandal
#

don't use the yt search manager?

#

use the yt source manager?

lofty summit
lofty summit
#

ended up just allowing local files then when i load the local files back in my bot when i get the search details id research for it and replace it with the youtube info then play the playlist

#

surprisingly doesn’t even take that long for a 600 song playlist

#

you can close this, thanks for your help on trying to work on it thru lavasrc but it was too hard for me tbh 😭

buoyant meadow
#

topi actually did it btw, chad

kind sandal
#

wrong

buoyant meadow
#
Please note `uri` & `iscr` will be `null` & `identifier` will be `"local"`

you mean isrc right?

kind sandal
#

clapann did it

buoyant meadow
#

Oh damn, clapann chad

buoyant meadow
#

chad

kind sandal