lay295 / TwitchDownloader

Twitch VOD/Clip Downloader - Chat Download/Render/Replay
MIT License
2.52k stars 260 forks source link

Worst = 720p #1001

Closed superbonaci closed 3 months ago

superbonaci commented 3 months ago

Checklist

Edition

Unsure

Describe your issue here

Why Worst is 720? https://github.com/lay295/TwitchDownloader/blob/master/TwitchDownloaderCore.Tests/ExtensionTests/M3U8ExtensionTests.cs

Add any related files or extra information here

No response

ScrubN commented 3 months ago

The test data only contains 1080p60, 720p60, and 720p30.

[Theory]
[InlineData("Worst", "720p30")]
public static void CorrectlyFindsStreamOfQualityFromLiveM3U8Response(string qualityString, string expectedPath)
{
    var m3u8 = new M3U8(new M3U8.Metadata(), new[]
    {
        new M3U8.Stream(
            new M3U8.Stream.ExtMediaInfo(M3U8.Stream.ExtMediaInfo.MediaType.Video, "chunked", "1080p60 (source)", true, true),
            new M3U8.Stream.ExtStreamInfo(0, 1, "avc1.4D401F,mp4a.40.2", (1920, 1080), "chunked", 60),
            "1080p60"),
        new M3U8.Stream(
            new M3U8.Stream.ExtMediaInfo(M3U8.Stream.ExtMediaInfo.MediaType.Video, "720p60", "720p60", true, true),
            new M3U8.Stream.ExtStreamInfo(0, 1, "avc1.4D401F,mp4a.40.2", (1280, 720), "720p60", 60),
            "720p60"),
        new M3U8.Stream(
            new M3U8.Stream.ExtMediaInfo(M3U8.Stream.ExtMediaInfo.MediaType.Video, "720p30", "720p", true, true),
            new M3U8.Stream.ExtStreamInfo(0, 1, "avc1.4D401F,mp4a.40.2", (1280, 720), "720p30", 30),
            "720p30")
    });

    var selectedQuality = m3u8.GetStreamOfQuality(qualityString);
    Assert.Equal(expectedPath, selectedQuality.Path);
}

Next time please use the "other" template for questions. image