Merge pull request #46 from Kwoth/dev

Music current time fixed if goto is used
This commit is contained in:
samvaio 2016-12-21 17:58:05 +05:30 committed by GitHub
commit 737f0edb0f

View File

@ -24,22 +24,22 @@ namespace NadekoBot.Modules.Music.Classes
public string Query { get; set; } public string Query { get; set; }
public string Title { get; set; } public string Title { get; set; }
public string Uri { get; set; } public string Uri { get; set; }
public string AlbumArt { get; set; } public string AlbumArt { get; set; }
} }
public class Song public class Song
{ {
public StreamState State { get; set; } public StreamState State { get; set; }
public string PrettyName => public string PrettyName =>
$"**{SongInfo.Title.TrimTo(55)} `{(SongInfo.Provider ?? "-")} by {QueuerName}`**"; $"**{SongInfo.Title.TrimTo(55)} `{(SongInfo.Provider ?? "-")} by {QueuerName}`**";
//$"{SongInfo.Title.TrimTo(70)}"; //$"{SongInfo.Title.TrimTo(70)}";
public SongInfo SongInfo { get; } public SongInfo SongInfo { get; }
public MusicPlayer MusicPlayer { get; set; } public MusicPlayer MusicPlayer { get; set; }
public string PrettyUser => public string PrettyUser =>
$"{QueuerName}"; $"{QueuerName}";
public string QueuerName { get; set; } public string QueuerName { get; set; }
public string PrettyProvider => public string PrettyProvider =>
$"{(SongInfo.Provider ?? "No Provider")}"; $"{(SongInfo.Provider ?? "No Provider")}";
public string PrettyCurrentTime() public string PrettyCurrentTime()
@ -103,8 +103,6 @@ namespace NadekoBot.Modules.Music.Classes
SongBuffer inStream = new SongBuffer(MusicPlayer, filename, SongInfo, skipTo, frameBytes * 100); SongBuffer inStream = new SongBuffer(MusicPlayer, filename, SongInfo, skipTo, frameBytes * 100);
var bufferTask = inStream.BufferSong(cancelToken).ConfigureAwait(false); var bufferTask = inStream.BufferSong(cancelToken).ConfigureAwait(false);
bytesSent = 0;
try try
{ {
var attempt = 0; var attempt = 0;
@ -320,7 +318,7 @@ namespace NadekoBot.Modules.Music.Classes
Uri = svideo.StreamLink, Uri = svideo.StreamLink,
ProviderType = musicType, ProviderType = musicType,
Query = svideo.TrackLink, Query = svideo.TrackLink,
AlbumArt = svideo.artwork_url, AlbumArt = svideo.artwork_url,
}) })
{ TotalLength = TimeSpan.FromMilliseconds(svideo.Duration) }; { TotalLength = TimeSpan.FromMilliseconds(svideo.Duration) };
} }
@ -335,7 +333,7 @@ namespace NadekoBot.Modules.Music.Classes
Uri = svideo.StreamLink, Uri = svideo.StreamLink,
ProviderType = MusicType.Normal, ProviderType = MusicType.Normal,
Query = svideo.TrackLink, Query = svideo.TrackLink,
AlbumArt = svideo.artwork_url, AlbumArt = svideo.artwork_url,
}) })
{ TotalLength = TimeSpan.FromMilliseconds(svideo.Duration) }; { TotalLength = TimeSpan.FromMilliseconds(svideo.Duration) };
} }