Skip to content

Commit d3dcd68

Browse files
committed
增加修复一个潜藏已久的bug
1 parent 61a178c commit d3dcd68

File tree

7 files changed

+28
-6
lines changed

7 files changed

+28
-6
lines changed

.github/workflows/manual.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ jobs:
8282
- name: Create release
8383
uses: softprops/action-gh-release@v1
8484
with:
85+
tag_name: ${{ github.event.inputs.tags }}
8586
body: |
8687
${{ steps.get_desc.outputs.release_body }}
8788

Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 3.14.7 (2024/12/21)
2+
- 修复当使用接口下载时最终视频文件不在对应目录的bug
3+
- 修复接口中路劲使用"/"导致最终程序打开文件错误的问题
4+
15
# 3.14.6 (2024/12/18)
26
- .net6官方停止维护故升级.net9
37
- 设置中增加关闭声音按钮

M3u8Downloader_H.Combiners/M3uCombinerClient.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ protected async ValueTask ConverterToMp4(string m3u8FilePath, bool allowed_exten
9090
.Add("-bsf:a").Add("aac_adtstoasc");
9191

9292
var tmpOutputFile = Path.ChangeExtension(DownloadParams.VideoFullName, Settings.SelectedFormat);
93+
Log?.Info("开始转码:%s", tmpOutputFile);
9394
DownloadParams.ChangeVideoNameDelegate(tmpOutputFile);
9495
arguments
9596
.Add("-nostdin")

M3u8Downloader_H.Core/DownloadClient.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class DownloadClient(HttpClient httpClient, Uri url, IEnumerable<KeyValue
3030
private M3uDownloaderClient? m3UDownloaderClient;
3131
private M3uCombinerClient? m3UCombinerClient;
3232
private IM3u8UriManager? m3U8UriManager;
33+
private bool _theFirstTime = true;
3334

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

101102
public async Task GetM3U8FileInfo(CancellationToken cancellationToken)
102103
{
103-
if (M3u8FileInfo is not null)
104+
if (!_theFirstTime)
104105
return;
105106

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

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

120129
DownloadParams.VideoFullName = DownloadParams.VideoFullPath + (M3u8FileInfo.Map is not null ? Path.GetExtension(M3u8FileInfo.Map?.Title) : ".ts");
130+
_theFirstTime = false;
121131
}
122132
}
123133
}

M3u8Downloader_H/M3u8Downloader_H.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<TargetFramework>net9.0-windows7.0</TargetFramework>
66
<RootNamespace>M3u8Downloader_H</RootNamespace>
77
<Platforms>AnyCPU;x64</Platforms>
8-
<AssemblyVersion>3.14.6.0</AssemblyVersion>
9-
<Version>3.14.6.0</Version>
8+
<AssemblyVersion>3.14.7.0</AssemblyVersion>
9+
<Version>3.14.7.0</Version>
1010
<PackageId>m3u8视频下载器</PackageId>
1111
<Product>m3u8视频下载器</Product>
1212
<ApplicationIcon>icon.ico</ApplicationIcon>

M3u8Downloader_H/Views/MainWindowView.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@
257257
<Run FontWeight="Bold" Text="以管理员身份运行" />
258258
<Run Text="本程序" />
259259
<LineBreak />
260-
<Run Text="RestApi仅限安装过.net6运行库的版本使用,SingleFile版本可能不支持" />
260+
<Run Text="RestApi仅限安装过.net9运行库的版本使用,SingleFile版本可能不支持" />
261261
<LineBreak />
262262
<Run Text="详细的RestApi使用方法,请看帮助文档" />
263263
<Run FontWeight="SemiBold" Text="Rest Api" />
@@ -289,7 +289,7 @@
289289
</MenuItem.Icon>
290290
</MenuItem>
291291
<MenuItem Header="复制错误信息" cal:Message.Attach="CopyFailReason($DataContext)"/>
292-
<MenuItem Header="复制所有日志" cal:Message.Attach="CopyLogs($DataContext)"/>
292+
<MenuItem Header="复制日志" cal:Message.Attach="CopyLogs($DataContext)"/>
293293
<Separator />
294294
<MenuItem Header="停止下载所有选择项" cal:Message.Attach="StopDownloads" >
295295
<MenuItem.Icon>

M3u8Downloader_h.RestServer/HttpListenService.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ private void DownloadByUrl(HttpListenerRequest request, HttpListenerResponse res
5353
}
5454

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

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

9092

9193
requestWithContent.Validate();
94+
if(!string.IsNullOrWhiteSpace(requestWithContent.SavePath))
95+
requestWithContent.SavePath = requestWithContent.SavePath.Replace('/', Path.DirectorySeparatorChar);
9296
DownloadByM3uFileInfoAction(m3UFileInfo, requestWithContent.VideoName, requestWithContent.SavePath, requestWithContent.PluginKey, requestWithContent.Headers);
9397

9498
response.Json(Response.Success());
@@ -111,9 +115,11 @@ private void DownloadByJsonContent(HttpListenerRequest request, HttpListenerResp
111115
response.Json(Response.Error("序列化失败"));
112116
return;
113117
}
114-
118+
115119
requestWithM3U8FileInfo.Validate();
116120
requestWithM3U8FileInfo.M3u8FileInfo.PlaylistType = "VOD";
121+
if (!string.IsNullOrWhiteSpace(requestWithM3U8FileInfo.SavePath))
122+
requestWithM3U8FileInfo.SavePath = requestWithM3U8FileInfo.SavePath.Replace('/', Path.DirectorySeparatorChar);
117123
DownloadByM3uFileInfoAction(requestWithM3U8FileInfo.M3u8FileInfo, requestWithM3U8FileInfo.VideoName, requestWithM3U8FileInfo.SavePath, requestWithM3U8FileInfo.PluginKey, requestWithM3U8FileInfo.Headers);
118124

119125
response.Json(Response.Success());

0 commit comments

Comments
 (0)