Solving a bug with files that were removed.

This commit is contained in:
Anonymus Raccoon
2019-06-25 18:32:58 +02:00
parent 3c09a297ab
commit 13668912f4

View File

@@ -274,6 +274,7 @@ namespace Opus.Api.Services
IExtractorsFactory extractorFactory = new DefaultExtractorsFactory();
Handler handler = new Handler();
Console.WriteLine("&Preparing exoplay, path: " + song.Path);
IMediaSource mediaSource;
if (song.IsLiveStream)
mediaSource = new HlsMediaSource(Uri.Parse(song.Path), dataSourceFactory, handler, null);
@@ -1171,12 +1172,16 @@ namespace Opus.Api.Services
if (song.IsYt && song.IsParsed != true)
await new SongParser().ParseSong(song);
else if (!song.IsYt)
{
try
{
MediaMetadataRetriever meta = new MediaMetadataRetriever();
await meta.SetDataSourceAsync(song.Path);
song.Duration = int.Parse(meta.ExtractMetadata(MetadataKey.Duration));
meta.Release();
}
catch (Java.IO.FileNotFoundException) { }
}
return song.Duration;
}