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
1 change: 1 addition & 0 deletions src/N_m3u8DL-RE.Common/Resource/ResString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public class ResString
public static string noStreamsToDownload => GetText("noStreamsToDownload");
public static string newVersionFound => GetText("newVersionFound");
public static string processImageSub => GetText("processImageSub");
public static string onlyInit => GetText("onlyInit");

private static string GetText(string key)
{
Expand Down
6 changes: 6 additions & 0 deletions src/N_m3u8DL-RE.Common/Resource/StaticText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,12 @@ internal class StaticText
zhTW: "沒有找到需要下載的流",
enUS: "No stream found to download"
),
["onlyInit"] = new TextContainer
(
zhCN: "仅下载初始化文件",
zhTW: "仅下载初始化文件",
enUS: "Download only init file"
)

};
}
6 changes: 4 additions & 2 deletions src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ internal partial class CommandInvoker
private static readonly Option<StreamFilter?> DropVideoFilter = new(["-dv", "--drop-video"], description: ResString.cmd_dropVideo, parseArgument: ParseStreamFilter) { ArgumentHelpName = "OPTIONS" };
private static readonly Option<StreamFilter?> DropAudioFilter = new(["-da", "--drop-audio"], description: ResString.cmd_dropAudio, parseArgument: ParseStreamFilter) { ArgumentHelpName = "OPTIONS" };
private static readonly Option<StreamFilter?> DropSubtitleFilter = new(["-ds", "--drop-subtitle"], description: ResString.cmd_dropSubtitle, parseArgument: ParseStreamFilter) { ArgumentHelpName = "OPTIONS" };


private static readonly Option<bool> OnlyInit = new(["-oi", "--only-init"], description: ResString.onlyInit, getDefaultValue: () => false) ;
/// <summary>
/// 解析录制直播时长限制
/// </summary>
Expand Down Expand Up @@ -556,6 +557,7 @@ protected override MyOption GetBoundValue(BindingContext bindingContext)
AllowHlsMultiExtMap = bindingContext.ParseResult.GetValueForOption(AllowHlsMultiExtMap),
AdKeywords = bindingContext.ParseResult.GetValueForOption(AdKeywords),
MaxSpeed = bindingContext.ParseResult.GetValueForOption(MaxSpeed),
OnlyInit = bindingContext.ParseResult.GetValueForOption(OnlyInit)
};

if (bindingContext.ParseResult.HasOption(CustomHLSMethod)) option.CustomHLSMethod = bindingContext.ParseResult.GetValueForOption(CustomHLSMethod);
Expand Down Expand Up @@ -618,7 +620,7 @@ public static async Task<int> InvokeArgs(string[] args, Func<MyOption, Task> act
BinaryMerge, UseFFmpegConcatDemuxer, DelAfterDone, NoDateInfo, NoLog, WriteMetaJson, AppendUrlParams, ConcurrentDownload, Headers, /**SavePattern,**/ SubOnly, SubtitleFormat, AutoSubtitleFix,
FFmpegBinaryPath,
LogLevel, UILanguage, UrlProcessorArgs, Keys, KeyTextFile, DecryptionBinaryPath, UseShakaPackager, UseMp4Decrypt, MP4RealTimeDecryption,
MaxSpeed,
MaxSpeed, OnlyInit,
MuxAfterDone,
CustomHLSMethod, CustomHLSKey, CustomHLSIv, UseSystemProxy, CustomProxy, CustomRange, TaskStartAt,
LivePerformAsVod, LiveRealTimeMerge, LiveKeepSegments, LivePipeMux, LiveFixVttByAudio, LiveRecordLimit, LiveWaitTime, LiveTakeCount,
Expand Down
3 changes: 3 additions & 0 deletions src/N_m3u8DL-RE/CommandLine/MyOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ internal class MyOption
/// </summary>
public bool LiveFixVttByAudio { get; set; }

public bool OnlyInit { get; set; }


public DecryptEngine GetDecryptEngine()
{
if (UseShakaPackager)
Expand Down
6 changes: 6 additions & 0 deletions src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ private async Task<bool> DownloadStreamAsync(StreamSpec streamSpec, ProgressTask
mp4InitFile = result.ActualFilePath;
task.Increment(1);

if (DownloaderConfig.MyOptions.OnlyInit)
{
Logger.InfoMarkUp($"OnlyInit flag, downloaded init file, exiting....");
Environment.Exit(0);
}

// 读取mp4信息
if (result != null && result.Success)
{
Expand Down