Skip to content

Commit

Permalink
feat: 添加配置bilibili.name.autoNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
nICEnnnnnnnLee committed May 6, 2024
1 parent 6f123e7 commit 843ffef
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/nicelee/bilibili/util/CmdUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public synchronized static void convertOrAppendCmdToRenameBat(final String avid_
File folder = file.getParentFile();
if (!folder.exists())
folder.mkdirs();
if(!originFile.renameTo(file)) {// 如果不成功,大概率是文件名重复,在后面加上序号,类似于(01)
if((!originFile.renameTo(file)) && Global.autoNumberWhenFileExists) {// 如果不成功,大概率是文件名重复,在后面加上序号,类似于(01)
for(int i = 1; i < 100; i++) {
File f = new File(Global.savePath,
String.format("%s(%02d)%s", formattedTitle, i, tail));
Expand Down
2 changes: 2 additions & 0 deletions src/nicelee/ui/Global.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ public class Global {
public static String cTimeFormat;
@Config(key = "bilibili.name.doAfterComplete", note = "下载完成后自动重命名", defaultValue = "true", valids = { "true", "false" })
public static boolean doRenameAfterComplete = true;
@Config(key = "bilibili.name.autoNumber", note = "遇到同名文件自动添加序号", defaultValue = "true", valids = { "true", "false" })
public static boolean autoNumberWhenFileExists = true;
@Config(key = "bilibili.repo.definitionStrictMode", note = "是否将同一视频不同清晰度看作不同任务", defaultValue = "false", eq_true = "on", valids = { "on",
"off" }) /* 存在某一清晰度后, 在下载另一种清晰度时是否判断已完成 */
public static boolean repoInDefinitionStrictMode; //
Expand Down
2 changes: 2 additions & 0 deletions src/resources/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ bilibili.name.format = (:listName listName-)avTitle-pAv2-qn
# 下载完成后是否马上重命名
# 若为false, 那么会追加到重命名文件, 可以人工运行rename.bat 重命名
bilibili.name.doAfterComplete = true
# 遇到同名文件自动添加序号 (01)、(02)...
bilibili.name.autoNumber = true
# 下载完成后是否尝试给相关作品点赞👍(已经点赞的不会取消)
bilibili.download.thumbUp = false
# 全部任务完成后是否播放提示音
Expand Down

0 comments on commit 843ffef

Please sign in to comment.