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 Jul 6, 2024
2 parents bd7945a + 1f80a22 commit bd9bd20
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 27 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 3.14.5 (2024/07/06)
- 修复上次更新后导致缓存无法删除的bug

# 3.14.4 (2024/05/30)
- 修复上个版本中启动程序报错的问题

Expand Down
15 changes: 15 additions & 0 deletions M3u8Downloader_H.Combiners/M3uCombinerClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public async Task Converter(bool isFile, CancellationToken cancellationToken = d
await VideoMerge(isFile, cancellationToken);
}
Log?.Info("合并完成");
RemoveCacheDirectory(DownloadParams.VideoFullPath);
}

//通过xml,目录,json等方式可能无法判断流的时长,所以采用原先的转码方案
Expand Down Expand Up @@ -99,5 +100,19 @@ protected async ValueTask ConverterToMp4(string m3u8FilePath, bool allowed_exten
await _ffmpeg.ExecuteAsync(arguments.Build(), DownloadParams.VodProgress, cancellationToken);
}


protected void RemoveCacheDirectory(string filePath, bool recursive = true)
{

if (Settings.IsCleanUp)
{
if (!Directory.Exists(filePath)) return;

Directory.Delete(filePath, recursive);
Log?.Info("删除{0}目录成功", filePath);
}

}

}
}
2 changes: 1 addition & 1 deletion M3u8Downloader_H.Core/DownloadClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ public M3uCombinerClient Merger
m3UCombinerClient ??= new M3uCombinerClient(M3u8FileInfo)
{
DownloadParams = DownloadParams,
Settings = Settings,
Log = _log
};
m3UCombinerClient.Settings = Settings;
return m3UCombinerClient;
}
}
Expand Down
4 changes: 2 additions & 2 deletions M3u8Downloader_H.Core/M3u8Downloader_H.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<Version>3.14.4.0</Version>
<Version>3.14.5.0</Version>
<Authors>Harlan</Authors>
<AssemblyVersion>3.14.4.0</AssemblyVersion>
<AssemblyVersion>3.14.5.0</AssemblyVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Release'">
Expand Down
16 changes: 0 additions & 16 deletions M3u8Downloader_H.Downloader/DownloaderSources/DownloaderSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,5 @@ protected void CreateDirectory(string dirPath, bool skipExist = true)
Log?.Info("创建缓存目录:{0}", dirPath);
}


protected void RemoveCacheDirectory(string filePath, bool recursive = true)
{
try
{
if (Settings.IsCleanUp)
{
Directory.Delete(filePath, recursive);
Log?.Info("删除缓存目录:{0}", filePath);
}
}
catch (DirectoryNotFoundException)
{

}
}
}
}
5 changes: 5 additions & 0 deletions M3u8Downloader_H.Downloader/DownloaderSources/NullSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@ internal class NullSource : DownloaderSource
public NullSource(HttpClient httpClient, IDownloadService? downloadService) : base(downloadService)
{
}

public override Task DownloadAsync(Action<bool> IsLiveAction, CancellationToken cancellationToken = default)
{
return Task.CompletedTask;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public interface IM3UFileInfoMananger
Task<M3UFileInfo> GetM3u8FileInfo(Uri uri, IEnumerable<KeyValuePair<string, string>>? headers, CancellationToken cancellationToken = default);

//通过直接传入m3u8文件请求数据
public M3UFileInfo GetM3u8FileInfo(Uri uri, string content);
M3UFileInfo GetM3u8FileInfo(Uri uri, string content);

//通过传入本地文件如xml,json,m3u8,文件夹等方式请求数据
public M3UFileInfo GetM3u8FileInfo(string ext, Uri uri);
M3UFileInfo GetM3u8FileInfo(string ext, Uri uri);
}
}
4 changes: 2 additions & 2 deletions M3u8Downloader_H/M3u8Downloader_H.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<UseWindowsForms>true</UseWindowsForms>
<RootNamespace>M3u8Downloader_H</RootNamespace>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyVersion>3.14.4.0</AssemblyVersion>
<Version>3.14.4.0</Version>
<AssemblyVersion>3.14.5.0</AssemblyVersion>
<Version>3.14.5.0</Version>
<PackageId>m3u8视频下载器</PackageId>
<Product>m3u8视频下载器</Product>
<ApplicationIcon>icon.ico</ApplicationIcon>
Expand Down
4 changes: 0 additions & 4 deletions SettingsManager/Models/ISettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ public interface ISettings
bool ForcedMerger { get; }
bool IsCleanUp { get; }
bool SkipRequestError { get; }
bool IsResetAddress { get; }
bool IsResetName { get; }
string Separator { get; }
string ProxyAddress { get; }
Dictionary<string,string> Headers { get; }
double RecordDuration { get; }
int Timeouts { get; }
Expand Down

0 comments on commit bd9bd20

Please sign in to comment.