AmandaDiscord / Volcano

A light-weight LavaLink compatible replacement
MIT License
71 stars 15 forks source link

HTTP sourced tracks return duration of 0 #15

Closed aeonian007 closed 2 years ago

aeonian007 commented 2 years ago

HTTP sourced tracks means "http" sourced tracks defined in application.yml (Tracks based on custom URL). These tracks always return duration of 0, even though the audio file's duration is not 0. I attached the code below.

// Code is based on discord.js & erela.js
const query = interaction.options.getString("query") as string;
const res = await <Manager>.search(query, interaction.user);

console.log(res.tracks[0].duration); // always print 0 if source of a track is http.
PapiOphidian commented 2 years ago

if the duration is 0, you should just treat them like a live stream. I'll see what's causing the issues.

PapiOphidian commented 2 years ago

This should be fixed in 1.1.0

aeonian007 commented 2 years ago

I see you used music-metadata to get a duration of a track. I wonder what happens if a track does not have any information about duration in metadata. (I have seen some audio files lacking the property of length or duration in their metadata) Is this something I need to worry about? Thank you for fixing the issue.

PapiOphidian commented 2 years ago

Volcano will possibly set the duration as 0 and say that it's a stream. This should be expected and handled appropriately. I'll probably make the system a bit more robust in the future if an issue like this actually pops up. I haven't had an issue like this before though so we'll see

aeonian007 commented 2 years ago

I've tested a few audio files without metadata of duration. It seems like the volcano gives a value based on something (not 0, values between 5 and 60) - I am not sure what it is. However, audio files with metadata of duration work perfectly fine.