Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Harlan-H committed Dec 21, 2024
2 parents 1e8f9de + d3dcd68 commit b7dff47
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ jobs:
- name: Create release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.inputs.tags }}
body: |
${{ steps.get_desc.outputs.release_body }}
Expand Down
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 3.14.7 (2024/12/21)
- 修复当使用接口下载时最终视频文件不在对应目录的bug
- 修复接口中路劲使用"/"导致最终程序打开文件错误的问题

# 3.14.6 (2024/12/18)
- .net6官方停止维护故升级.net9
- 设置中增加关闭声音按钮
Expand Down
1 change: 1 addition & 0 deletions M3u8Downloader_H.Combiners/M3uCombinerClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ protected async ValueTask ConverterToMp4(string m3u8FilePath, bool allowed_exten
.Add("-bsf:a").Add("aac_adtstoasc");

var tmpOutputFile = Path.ChangeExtension(DownloadParams.VideoFullName, Settings.SelectedFormat);
Log?.Info("开始转码:%s", tmpOutputFile);
DownloadParams.ChangeVideoNameDelegate(tmpOutputFile);
arguments
.Add("-nostdin")
Expand Down
12 changes: 11 additions & 1 deletion M3u8Downloader_H.Core/DownloadClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class DownloadClient(HttpClient httpClient, Uri url, IEnumerable<KeyValue
private M3uDownloaderClient? m3UDownloaderClient;
private M3uCombinerClient? m3UCombinerClient;
private IM3u8UriManager? m3U8UriManager;
private bool _theFirstTime = true;

public string M3uContent { get; set; } = default!;
public M3UFileInfo M3u8FileInfo { get; set; } = default!;
Expand Down Expand Up @@ -100,9 +101,17 @@ public async Task GetM3u8Uri(CancellationToken cancellationToken)

public async Task GetM3U8FileInfo(CancellationToken cancellationToken)
{
if (M3u8FileInfo is not null)
if (!_theFirstTime)
return;

if (M3u8FileInfo is not null )
{
_log.Info("获取视频流{0}个", M3u8FileInfo.MediaFiles.Count);
DownloadParams.VideoFullName = DownloadParams.VideoFullPath + (M3u8FileInfo.Map is not null ? Path.GetExtension(M3u8FileInfo.Map?.Title) : ".ts");
_theFirstTime = false;
return;
}


if (_url.IsFile)
{
Expand All @@ -118,6 +127,7 @@ public async Task GetM3U8FileInfo(CancellationToken cancellationToken)
M3u8FileInfo.Key = M3UKeyInfo;

DownloadParams.VideoFullName = DownloadParams.VideoFullPath + (M3u8FileInfo.Map is not null ? Path.GetExtension(M3u8FileInfo.Map?.Title) : ".ts");
_theFirstTime = false;
}
}
}
4 changes: 2 additions & 2 deletions M3u8Downloader_H/M3u8Downloader_H.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<TargetFramework>net9.0-windows7.0</TargetFramework>
<RootNamespace>M3u8Downloader_H</RootNamespace>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyVersion>3.14.6.0</AssemblyVersion>
<Version>3.14.6.0</Version>
<AssemblyVersion>3.14.7.0</AssemblyVersion>
<Version>3.14.7.0</Version>
<PackageId>m3u8视频下载器</PackageId>
<Product>m3u8视频下载器</Product>
<ApplicationIcon>icon.ico</ApplicationIcon>
Expand Down
4 changes: 2 additions & 2 deletions M3u8Downloader_H/Views/MainWindowView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@
<Run FontWeight="Bold" Text="以管理员身份运行" />
<Run Text="本程序" />
<LineBreak />
<Run Text="RestApi仅限安装过.net6运行库的版本使用,SingleFile版本可能不支持" />
<Run Text="RestApi仅限安装过.net9运行库的版本使用,SingleFile版本可能不支持" />
<LineBreak />
<Run Text="详细的RestApi使用方法,请看帮助文档" />
<Run FontWeight="SemiBold" Text="Rest Api" />
Expand Down Expand Up @@ -289,7 +289,7 @@
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="复制错误信息" cal:Message.Attach="CopyFailReason($DataContext)"/>
<MenuItem Header="复制所有日志" cal:Message.Attach="CopyLogs($DataContext)"/>
<MenuItem Header="复制日志" cal:Message.Attach="CopyLogs($DataContext)"/>
<Separator />
<MenuItem Header="停止下载所有选择项" cal:Message.Attach="StopDownloads" >
<MenuItem.Icon>
Expand Down
8 changes: 7 additions & 1 deletion M3u8Downloader_h.RestServer/HttpListenService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ private void DownloadByUrl(HttpListenerRequest request, HttpListenerResponse res
}

requestWithURI.Validate();
if (!string.IsNullOrWhiteSpace(requestWithURI.SavePath))
requestWithURI.SavePath = requestWithURI.SavePath.Replace('/', Path.DirectorySeparatorChar);
DownloadByUrlAction(requestWithURI.Url, requestWithURI.VideoName, requestWithURI.Method, requestWithURI.Key, requestWithURI.Iv, requestWithURI.SavePath, requestWithURI.PluginKey, requestWithURI.Headers);

response.Json(Response.Success());
Expand Down Expand Up @@ -89,6 +91,8 @@ private void DownloadByContent(HttpListenerRequest request, HttpListenerResponse


requestWithContent.Validate();
if(!string.IsNullOrWhiteSpace(requestWithContent.SavePath))
requestWithContent.SavePath = requestWithContent.SavePath.Replace('/', Path.DirectorySeparatorChar);
DownloadByM3uFileInfoAction(m3UFileInfo, requestWithContent.VideoName, requestWithContent.SavePath, requestWithContent.PluginKey, requestWithContent.Headers);

response.Json(Response.Success());
Expand All @@ -111,9 +115,11 @@ private void DownloadByJsonContent(HttpListenerRequest request, HttpListenerResp
response.Json(Response.Error("序列化失败"));
return;
}

requestWithM3U8FileInfo.Validate();
requestWithM3U8FileInfo.M3u8FileInfo.PlaylistType = "VOD";
if (!string.IsNullOrWhiteSpace(requestWithM3U8FileInfo.SavePath))
requestWithM3U8FileInfo.SavePath = requestWithM3U8FileInfo.SavePath.Replace('/', Path.DirectorySeparatorChar);
DownloadByM3uFileInfoAction(requestWithM3U8FileInfo.M3u8FileInfo, requestWithM3U8FileInfo.VideoName, requestWithM3U8FileInfo.SavePath, requestWithM3U8FileInfo.PluginKey, requestWithM3U8FileInfo.Headers);

response.Json(Response.Success());
Expand Down

0 comments on commit b7dff47

Please sign in to comment.