Skip to content

Commit

Permalink
Use string.IsNullOrWhiteSpace, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ScrubN committed Jan 12, 2024
1 parent 60f3e84 commit 1b2d250
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion TwitchDownloaderCore/Extensions/M3U8Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static M3U8.Stream GetStreamOfQuality(this M3U8 m3u8, string qualityStrin
throw new ArgumentException(nameof(m3u8), "M3U8 does not contain any streams.");
}

if (qualityString is null)
if (string.IsNullOrWhiteSpace(qualityString))
{
return m3u8.BestQualityStream();
}
Expand Down
1 change: 0 additions & 1 deletion TwitchDownloaderCore/Tools/M3U8.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Text;
Expand Down
4 changes: 2 additions & 2 deletions TwitchDownloaderCore/VideoDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public async Task DownloadAsync(CancellationToken cancellationToken)

GqlVideoChapterResponse videoChapterResponse = await TwitchHelper.GetOrGenerateVideoChapters(downloadOptions.Id, videoInfoResponse.data.video);

var qualityPlaylist = await GetQualityPlaylist(videoInfoResponse);
var qualityPlaylist = await GetQualityPlaylist();

var playlistUrl = qualityPlaylist.Path;
var baseUrl = new Uri(playlistUrl[..(playlistUrl.LastIndexOf('/') + 1)], UriKind.Absolute);
Expand Down Expand Up @@ -556,7 +556,7 @@ private static Range GetStreamListCrop(IList<M3U8.Stream> streamList, VideoDownl
return new Range(startIndex, endIndex);
}

private async Task<M3U8.Stream> GetQualityPlaylist(GqlVideoResponse videoInfo)
private async Task<M3U8.Stream> GetQualityPlaylist()
{
GqlVideoTokenResponse accessToken = await TwitchHelper.GetVideoToken(downloadOptions.Id, downloadOptions.Oauth);

Expand Down

0 comments on commit 1b2d250

Please sign in to comment.