Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/N_m3u8DL-RE.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "N_m3u8DL-RE.Common", "N_m3u
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "N_m3u8DL-RE.Parser", "N_m3u8DL-RE.Parser\N_m3u8DL-RE.Parser.csproj", "{0DA02925-AF3A-4598-AF01-91AE5539FCA1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{820D2D99-1227-46BB-BEC3-FAF241CE426B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -32,7 +34,7 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
RESX_NeutralResourcesLanguage = en-US
SolutionGuid = {87F963D4-EA06-413D-9372-C726711C32B5}
RESX_NeutralResourcesLanguage = en-US
EndGlobalSection
EndGlobal
3 changes: 3 additions & 0 deletions src/N_m3u8DL-RE/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<Costura />
</Weavers>
7 changes: 6 additions & 1 deletion src/N_m3u8DL-RE/N_m3u8DL-RE.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,25 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<RootNamespace>N_m3u8DL_RE</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
<Version>0.2.0</Version>
<Platforms>AnyCPU;x64</Platforms>
<Trimming>full</Trimming>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\N_m3u8DL-RE.Parser\N_m3u8DL-RE.Parser.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Costura.Fody" Version="5.7.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NiL.JS" Version="2.5.1600" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
</ItemGroup>
Expand Down
10 changes: 9 additions & 1 deletion src/N_m3u8DL-RE/Util/FilterUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,15 @@ public static List<StreamSpec> DoFilterKeep(IEnumerable<StreamSpec> lists, Strea
else if (filter.For == "worst" && inputs.Count() > 0)
inputs = inputs.TakeLast(1).ToList();
else if (int.TryParse(bestNumberStr, out int bestNumber) && inputs.Count() > 0)
inputs = inputs.Take(bestNumber).ToList();
{
var langs = inputs.DistinctBy(x => x.Language).Select(x => x.Language);
var tmp = new List<StreamSpec>();
foreach (var l in langs)
{
tmp.Add(inputs.Where(x => x.Language == l).OrderByDescending(a => a.Bandwidth).First());
}
inputs = tmp.Take(bestNumber).ToList();
}
else if (int.TryParse(worstNumberStr, out int worstNumber) && inputs.Count() > 0)
inputs = inputs.TakeLast(worstNumber).ToList();

Expand Down