GithubHelp home page GithubHelp logo

likun7981 / hlink Goto Github PK

View Code? Open in Web Editor NEW
572.0 7.0 53.0 4.01 MB

批量、快速硬链工具(The batch, fast hard link toolkit)

Home Page: https://hlink.likun.me

License: MIT License

JavaScript 2.90% Smarty 1.22% TypeScript 94.70% Shell 0.25% Less 0.53% HTML 0.22% Dockerfile 0.18%
hardlink hardlinking link pt toolkit hard hlink

hlink's Introduction

hlink logo

npm package node compatibility downloads license license

hlink

批量、快速硬链工具(The batch, fast hard link toolkit)

  • 💡 重复检测:支持文件名变更的重复检测
  • ⚡️ 快速:20000+文件只需要1分钟
  • 📦 多平台:支持Windows、Mac、Linux
  • 🛠️ 丰富的配置:支持黑白名单,缓存等多个配置
  • 🔩 修剪机制:让你更方便的同步源文件和硬链
  • 🌐 WebUI:图形化界面让你更方便的管理
  • 🐳 Docker:无需关心环境问题

更多介绍:https://hlink.likun.me

使用docker run

docker run -d --name hlink \
-e PUID=$YOUR_USER_ID \
-e PGID=$YOUR_GROUP_ID \
-e UMASK=$YOUR_UMASK \
-e HLINK_HOME=$YOUR_HLINK_HOME_DIR \
-p 9090:9090 \
-v $YOUR_NAS_VOLUME_PATH:$DOCKER_VOLUME_PATH \
likun7981/hlink:latest

使用docker compose

version: '2'

services:
  docker:
    image: likun7981/hlink:latest # docker镜像名称
    restart: on-failure
    ports: # 这个端口映射
      - 9090:9090
    volumes: # 这个表示存储空间映射
      - $YOUR_NAS_VOLUME_PATH:$DOCKER_VOLUME_PATH
    environment:
      - PUID=$YOUR_USER_ID
      - PGID=$YOUR_GROUP_ID
      - UMASK=$YOUR_UMASK
      - HLINK_HOME=$YOUR_HLINK_HOME_DIR # 这个是环境变量

$YOUR_USER_ID$YOUR_GROUP_ID$YOUR_UMASK$YOUR_HLINK_HOME_DIR$YOUR_NAS_VOLUME_PATH$DOCKER_VOLUME_PATH为变量,根据自己的情况自行设置

使用npm安装

npm i -g hlink

# 帮助
hlink --help

WebUI截图

效果截图

打赏作者

请作者喝一杯咖啡😄

  • 脱光游侠/诈尸求邀没结果 16.60 RMB
  • 月与徘徊 10.00 RMB
  • 庭下雀 88.00 RMB
  • *宋 30.00 RMB
  • *黑 18.00 RMB
  • *宋 20.00 RMB
  • *沐 30.00 RMB
  • *春 1.00 RMB
  • *卷 20.00 RMB
  • H*r 20.00 RMB
  • *. 3.00 RMB
  • *府 80.00 RMB
  • every*Ok 20.00 RMB

感谢各位的支持,如果有遗漏,实在抱歉,可联系作者补充~

License

MIT

hlink's People

Contributors

ddsderek avatar ddsrem avatar likun7981 avatar mikusaa avatar spirei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

hlink's Issues

运行报错

win11,用cmd和putty还有git bash都一样,群晖装的node v14,v12也试了,同样。

用的命令是hlink -i=mkv,mp4 "/volume1/download/movie" "/volume1/media/movie"

生成了设置文件,删除了白名单内的内容,hlink设置的是6层目录,关闭了缓存。当然,默认的设置开始就试了,更改后没有变化。

另外,无论如何,已捐赠,谢谢作者。

[HLINK ERROR]: Error: Command failed with exit code 1 (EPERM): ln /volume1/download/movie/黑衣人合集/黑衣人·全球追缉.Men.In.Black·International.2019.BluRay.1080p.x265.10bit.2Audio.MNHD-FRDS/Men.In.Black·International.2019.BluRay.1080p.x265.10bit.2Audio.MNHD-FRDS.mkv /volume1/media/movie/黑 衣人合集/黑衣人·全球追缉.Men.In.Black·International.2019.BluRay.1080p.x265.10bit.2Audio.MNHD-FRDS
at makeError (/usr/local/lib/node_modules/hlink/node_modules/execa/lib/error.js:59:11)
at Function.module.exports.sync (/usr/local/lib/node_modules/hlink/node_modules/execa/index.js:187:17)
at /usr/local/lib/node_modules/hlink/lib/index.js:141:61
at step (/usr/local/lib/node_modules/hlink/lib/index.js:52:23)
at Object.next (/usr/local/lib/node_modules/hlink/lib/index.js:33:53)
at /usr/local/lib/node_modules/hlink/lib/index.js:27:71
at new Promise ()
at __awaiter (/usr/local/lib/node_modules/hlink/lib/index.js:23:12)
at /usr/local/lib/node_modules/hlink/lib/index.js:80:65
at Array.forEach () {
command: 'ln /volume1/download/movie/黑衣人合集/黑衣人·全球追缉.Men.In.Black·International.2019.BluRay.1080p.x265.10bit.2Audio.MNHD-FRDS/Men.In.Black·International.2019.BluRay.1080p.x265.10bit.2Audio.MNHD-FRDS.mkv /volume1/media/movie/黑衣人合集/黑衣人·全球追缉.Men.In.Black·International.2019.BluRay.1080p.x265.10bit.2Audio.MNHD-FRDS',
exitCode: 1,
exitCodeName: 'EPERM',
stdout: '',
stderr: "ln: failed to create hard link '/volume1/media/movie/黑衣人合集/黑衣人·全球追缉.Men.In.Black·International.2019.BluRay.1080p.x265.10bit.2Audio.MNHD-FRDS/Men.In.Black·International.2019.BluRay.1080p.x265.10bit.2Audio.MNHD-FRDS.mkv' => '/volume1/download/movie/黑衣人合集/黑衣人·全球追缉.Men.In.Black·International.2019.BluRay.1080p.x265.10bit.2Audio.MNHD-FRDS/Men.In.Black·International.2019.BluRay.1080p.x265.10bit.2Audio.MNHD-FRDS.mkv': Invalid cross-device link",
failed: true,
timedOut: false,
isCanceled: false,
killed: false,
signal: undefined
}
[HLINK INFO]: 硬链创建完毕... 总数 179 条
[HLINK INFO]: 成功 0 条
[HLINK INFO]: 失败 148 条
[HLINK INFO]: 跳过 31 条
[HLINK INFO]: 跳过之前的创建记录 0 条, 如果需要重新创建,请在删除或编辑文件 /root/.hlink/cache.json

硬链接改名后无法识别,会重复添加

image

Readme里说创建硬链时,会自动检测硬链接是否存在,硬链改名后同样能检测到,但实际上,我对A创建了一个硬链B,然后把B改名为C,再运行一次创建硬链的脚本时,B又会被创建出来,于是我就有了A的硬链B、C

THERE ARE SOME ERRORS ON synology 6.23

RUN THE COMMAND BY ROOT: hlink "/volume1/movie/TV/" "volume1/movie/TVNEW"
Error: Command failed with exit code 1 (EPERM): ln /volume1/movie/TV/斛珠夫人.Novoland.Pearl.Eclipse.2021.1080p.WEB-DL.H264.AAC-OurTV/斛珠夫人.Novoland.Pearl.Eclipse.2021.E16.1080p.WEB-DL.H264.AAC-OurTV.mp4 /root/volume1/movie/TVNEW/斛珠夫人.Novoland.Pearl.Eclipse.2021.1080p.WEB-DL.H264.AAC-OurTV
at makeError (/usr/local/lib/node_modules/hlink/node_modules/execa/lib/error.js:59:11)
at Function.module.exports.sync (/usr/local/lib/node_modules/hlink/node_modules/execa/index.js:187:17)
at /usr/local/lib/node_modules/hlink/lib/index.js:141:61
at step (/usr/local/lib/node_modules/hlink/lib/index.js:52:23)
at Object.next (/usr/local/lib/node_modules/hlink/lib/index.js:33:53)
at /usr/local/lib/node_modules/hlink/lib/index.js:27:71
at new Promise ()
at __awaiter (/usr/local/lib/node_modules/hlink/lib/index.js:23:12)
at /usr/local/lib/node_modules/hlink/lib/index.js:80:65
at Array.forEach () {
command: 'ln /volume1/movie/TV/斛珠夫人.Novoland.Pearl.Eclipse.2021.1080p.WEB-DL.H264.AAC-OurTV/斛珠夫人.Novoland.Pearl.Eclipse.2021.E16.1080p.WEB-DL.H264.AAC-OurTV.mp4 /root/volume1/movie/TVNEW/斛珠夫人.Novoland.Pearl.Eclipse.2021.1080p.WEB-DL.H264.AAC-OurTV',
exitCode: 1,
exitCodeName: 'EPERM',
stdout: '',
stderr: 'ln: failed to create hard link ‘/root/volume1/movie/TVNEW/斛珠夫人.Novoland.Pearl.Eclipse.2021.1080p.WEB-DL.H264.AAC-OurTV/斛珠夫人.Novoland.Pearl.Eclipse.2021.E16.1080p.WEB-DL.H264.AAC-OurTV.mp4’ => ‘/volume1/movie/TV/斛珠夫人.Novoland.Pearl.Eclipse.2021.1080p.WEB-DL.H264.AAC-OurTV/斛珠夫人.Novoland.Pearl.Eclipse.2021.E16.1080p.WEB-DL.H264.AAC-OurTV.mp4’: Invalid cross-device link',
failed: true,
timedOut: false,
isCanceled: false,
killed: false,
signal: undefined
}
[HLINK WARN]: 当前文件 斛珠夫人.Novoland.Pearl.Eclipse.2021.E16.1080p.WEB-DL.H264.AAC-OurTV.nfo 不满足配置条件, 跳过创建
[HLINK WARN]: 当前文件 斛珠夫人.Novoland.Pearl.Eclipse.2021.E17.1080p.WEB-DL.H264.AAC-OurTV.mp4.part 不满足配置条件, 跳过创建
[HLINK WARN]: 当前文件 斛珠夫人.Novoland.Pearl.Eclipse.2021.E18.1080p.WEB-DL.H264.AAC-OurTV.mp4.part 不满足配置条件, 跳过创建
[HLINK WARN]: 当前文件 斛珠夫人.Novoland.Pearl.Eclipse.2021.E19.1080p.WEB-DL.H264.AAC-OurTV.mp4.part 不满足配置条件, 跳过创建
[HLINK WARN]: 当前文件 斛珠夫人.Novoland.Pearl.Eclipse.2021.E20.1080p.WEB-DL.H264.AAC-OurTV.mp4.part 不满足配置条件, 跳过创建
[HLINK WARN]: 当前文件 斛珠夫人.Novoland.Pearl.Eclipse.2021.E21.1080p.WEB-DL.H264.AAC-OurTV.mp4.part 不满足配置条件, 跳过创建
[HLINK WARN]: 当前文件 斛珠夫人.Novoland.Pearl.Eclipse.2021.E22.1080p.WEB-DL.H264.AAC-OurTV.mp4.part 不满足配置条件, 跳过创建
[HLINK WARN]: 当前文件 斛珠夫人.Novoland.Pearl.Eclipse.2021.E23.1080p.WEB-DL.H264.AAC-OurTV.mp4.part 不满足配置条件, 跳过创建
[HLINK WARN]: 当前文件 斛珠夫人.Novoland.Pearl.Eclipse.2021.E24.1080p.WEB-DL.H264.AAC-OurTV.mp4.part 不满足配置条件, 跳过创建
[HLINK INFO]: 硬链创建完毕... 总数 427 条
[HLINK INFO]: 成功 0 条
[HLINK INFO]: 失败 113 条
[HLINK INFO]: 跳过 314 条
[HLINK INFO]: 跳过之前的创建记录 0 条, 如果需要重新创建,请在删除或编辑文件 /root/.hlink/cache.json

建议用base和target取代reverse

hlink prune 基准路径 目标路径

如果把路径定义成基准和目标,感觉就不需要reverse了,而且便于理解

所有硬链接的文件都是指向同一块数据,不用去想谁是源文件,谁是硬链接

有没有兴趣增加过滤文件夹名的功能

二刺螈用户表示收的番剧文件夹里会有CDs,SPs这类二级文件夹,并不想把它们也进行硬链接,试过改目录层级,但又会影响这种

XXX剧集(一级目录)
s1(二级目录)
>xxx.mkv(三级目录)
s2(二级目录)
xxx.mkv(三级目录)

结构的文件夹进行链接。

[Feature]希望增加自定义【配置文件】路径

由于威联通重启后,会重置某些系统配置,包括 /root 目录。hlink 目前创建的配置文件,是放在了 /root 目录下,威联通重启后,会被重置删掉。

所以希望增加自定义【配置文件】路径的配置项。

以Docker方式使用hlink

UNRAID环境中使用,写了个简单的Dockerfile

FROM node:16-alpine
RUN npm i -g hlink
ENTRYPOINT [ "hlink" ]

构建镜像后,运行下面的命令就可以创建硬链接了,仅供参考

docker run --rm -v /mnt:/mnt sjtuross/hlink /mnt/user/media/source /mnt/user/media/dest

报错:Command failed with exit code 1 (EPERM)

运行建立硬链接的时候报错,提示:Command failed with exit code 1 (EPERM)

Error: Command failed with exit code 1 (EPERM): ln /opt/movie/avdc/failed/mywife-1702.mp4 /opt/vdieo/failed
at makeError (/usr/local/lib/node_modules/hlink/node_modules/execa/lib/error.js:59:11)
at Function.module.exports.sync (/usr/local/lib/node_modules/hlink/node_modules/execa/index.js:187:17)
at /usr/local/lib/node_modules/hlink/lib/index.js:200:19
at Array.forEach ()
at start (/usr/local/lib/node_modules/hlink/lib/index.js:159:22)
at /usr/local/lib/node_modules/hlink/lib/index.js:164:17
at Array.forEach ()
at start (/usr/local/lib/node_modules/hlink/lib/index.js:159:22)
at hardLink (/usr/local/lib/node_modules/hlink/lib/index.js:221:3)
at Object. (/usr/local/lib/node_modules/hlink/cli.js:63:1) {
command: 'ln /opt/movie/avdc/failed/mywife-1702.mp4 /opt/vdieo/failed',
exitCode: 1,
exitCodeName: 'EPERM',
stdout: '',
stderr: "ln: failed to create hard link '/opt/vdieo/failed/mywife-1702.mp4' => '/opt/movie/avdc/failed/mywife-1702.mp4': Invalid cross-device link",
failed: true,
timedOut: false,
isCanceled: false,
killed: false,
signal: undefined

[Improvement]希望硬链结果能够更加详细

当前硬链结果只显示统计数据,没有具体成功与失败的文件列表,不方便找到原因。

因此希望结果能够更加详细,列出具体成功的文件,与失败的文件。

unraid userscipt 自动运行出错

Script location: /tmp/user.scripts/tmpScripts/auto hlink/script
Note that closing this window will abort the execution of this script
internal/process/esm_loader.js:74
internalBinding('errors').triggerUncaughtException(
^

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. Received protocol 'node:'
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:782:11)
at Loader.resolve (internal/modules/esm/loader.js:85:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:229:28)
at ModuleWrap. (internal/modules/esm/module_job.js:51:40)
at link (internal/modules/esm/module_job.js:50:36) {
code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}

/mnt/user/domains/node-v16.14.2-linux-x64/bin/hlink -e=jpg,png,bmp /mnt/user/download_media/download/Disc/ /mnt/user/download_media/media/Movies/Disc/

在shell窗口运行没有问题,在userscript中自动运行提示最上面的错误。

Bug 反馈

当视频文件名中含有 空格或 '
例如:
Guess.Who's.Coming.to.Dinner.1967.720p.BluRay.DD5.1.x264-DON.mkv
Grandma 2015 1080p BluRay DTS x264-VietHD.mkv
程序使用 ls -i 查看硬链接 会提示 no such file or directory导致报错并跳过创建硬链接

hlink 未能正确判断源目录中的文件改动,对源目录新增的文件提示“硬链已存在, 跳过创建”

source 目录 A 目录原本的文件结构如下:

A
|-B
  |-B1.mp4

首先对 A 执行了 hlink,正确在 target 目录下生成了目录 B 和其下文件 B1.mkv 的硬链接。
然后向 A 中添加了新目录 C 和文件 C1.mkv,A目录结构变为:

A
|-B
  |-B1.mp4
  |-C
    |-C1.mkv

重新运行 hlink,log 中提示

[HLINK WARN]: 源地址 A/B/C/C1.mkv 硬链已存在, 跳过创建

此时 target 目录下文件无变化,仍只有目录 B 和文件 B1.mkv。

请问这个问题可能出在哪呢?

另外,如果方便的话可以麻烦谈谈是如何做到“重复硬链检测”功能的么?我对 js 不大了解,没找到或者没看明白相应的代码段... 谢谢

hlink 版本为8月22日使用 npm 安装的版本,最大查找层级能够覆盖到相应文件。
hlink 配置如下:

[HLINK INFO]: 配置检查完毕...
[HLINK INFO]: 当前为 白名单 模式
[HLINK INFO]: 当前配置为:
[HLINK INFO]:   源地址: /volume2/TVshow/source
[HLINK INFO]:   目标地址: /volume2/TVshow
[HLINK INFO]:   包含的后缀有: mp4,flv,f4v,webm,m4v,mov,cpk,dirac,3gp,3g2,rm,rmvb,wmv,avi,asf,mpg,mpeg,mpe,vob,mkv,ram,qt,fli,flc,mod,iso
[HLINK INFO]:   最大查找层级为: 6
[HLINK INFO]:   硬链保存模式: 保持原有目录结构

希望增加复制.nfo这些文件的功能

硬链接.mkv这类文件彻底解决了刮削使得.nfo这类文件改变导致的红种问题。不过有些种子自带了刮削文件,建议增加一个复制(非硬链接).nfo类文件到dst的功能。这样对于自带刮削文件的种子来说,操作之后在dst文件夹内既有.mkv文件,也有.nfo文件,可以使用自带的刮削信息,同时可以避免如果之后播放器重新刮削导致.nfo文件变化红种(因为是复制过来的,所以在dst内修改.nfo文件并不会影响源文件)

运行报错

环境为unraid nodejs 版本为14.17.3

TypeError: Cannot read property 'join' of undefined
    at Object.parseConfig [as default] (/mnt/user/appdata/nodejs/node-v14.17.3-linux-x64/lib/node_modules/hlink/lib/config/parseConfig.js:26:40)
    at Object.<anonymous> (/mnt/user/appdata/nodejs/node-v14.17.3-linux-x64/lib/node_modules/hlink/lib/utils/parse.js:144:47)
    at step (/mnt/user/appdata/nodejs/node-v14.17.3-linux-x64/lib/node_modules/hlink/lib/utils/parse.js:52:23)
    at Object.next (/mnt/user/appdata/nodejs/node-v14.17.3-linux-x64/lib/node_modules/hlink/lib/utils/parse.js:33:53)
    at fulfilled (/mnt/user/appdata/nodejs/node-v14.17.3-linux-x64/lib/node_modules/hlink/lib/utils/parse.js:24:58)
module.exports = {
  source: '',
  dst: '',
  icludeExtname: ['mp4', 'flv', 'f4v', 'webm',
    'm4v', 'mov', 'cpk', 'dirac',
    '3gp', '3g2', 'rm', 'rmvb',
    'wmv', 'avi', 'asf', 'mpg',
    'mpeg', 'mpe', 'vob', 'mkv',
    'ram', 'qt', 'fli', 'flc', 'mod', 'iso'],
  excludeExtname: [],
  maxFindLevel: 4,
  saveMode: 0
}

出错

win10
映射的网络驱动器
git bash
报错信息如下:
Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
node.js版本:12.20
#43

请问目前来说,怎么删除硬链比较好?

比如我PT下载做种在一个文件夹,然后QB删除了这个种子和相关的文件。那么硬链接那边我直接在文件夹里右键删除就行,还是敲命令指定那个文件再删除?请问这两种有什么区别么?

主要是想知道会不会有什么未知问题,或者留下一堆垃圾文件一类的。

Hlink的缓存关闭了。

目前遇到的小问题

1.后缀名判定规则没能忽略大小写,发现有一批后缀大写.MKV没链到。(部分后缀名命名不规范媒体会识别不到。)

2.硬链以后改动路径的话,自动过滤会失效。比如tmm刮削以后,文件夹被改名或者文件夹结构被更改,这种情况自动过滤会失效。(tmm以及其他刮削器的重命名整理功能,会导致路径改变。)

3.希望加入一个功能,已经链接过,但是已删除了链接文件的,下次不再链接,自动过滤掉。(部分媒体只想做种,不想加入媒体库,比如一些纯保种的720p资源。)

群晖6.2.3无法运行

ssh进去直接打的命令“hlink /volume2/movie/Malignant.2021.1080p /volume2/docker/emby/share”

[HLINK` ERROR]: Error: Command failed with exit code 1 (EPERM): ln /volume2/movie/Malignant.2021.1080p/Malignant.2021.1080p.HMAX.WEB-DL.DD5.1.x264-CMRG-clearlogo.png /volume2/docker/emby/share/Malignant.2021.1080p.HMAX.WEB-DL.DD5.1.x264-CMRG-clearlogo

at makeError (/usr/local/lib/node_modules/hlink/node_modules/execa/lib/error.js:59:11)
at Function.module.exports.sync (/usr/local/lib/node_modules/hlink/node_modules/execa/index.js:187:17)
at /usr/local/lib/node_modules/hlink/lib/index.js:141:61
at step (/usr/local/lib/node_modules/hlink/lib/index.js:52:23)
at Object.next (/usr/local/lib/node_modules/hlink/lib/index.js:33:53)
at /usr/local/lib/node_modules/hlink/lib/index.js:27:71
at new Promise (<anonymous>)
at __awaiter (/usr/local/lib/node_modules/hlink/lib/index.js:23:12)
at /usr/local/lib/node_modules/hlink/lib/index.js:80:65
at Array.forEach (<anonymous>) {

command: 'ln /volume2/movie/Malignant.2021.1080p/Malignant.2021.1080p.HMAX.WEB-DL.DD5.1.x264-CMRG-clearlogo.png /volume2/docker/emby/share/Malignant.2021.1080p.HMAX.WEB-DL.DD5.1.x264-CMRG-clearlogo',
exitCode: 1,
exitCodeName: 'EPERM',
stdout: '',
stderr: 'ln: failed to create hard link ‘/volume2/docker/emby/share/Malignant.2021.1080p.HMAX.WEB-DL.DD5.1.x264-CMRG-clearlogo/Malignant.2021.1080p.HMAX.WEB-DL.DD5.1.x264-CMRG-clearlogo.png’ => ‘/volume2/movie/Malignant.2021.1080p/Malignant.2021.1080p.HMAX.WEB-DL.DD5.1.x264-CMRG-clearlogo.png’: Invalid cross-device link',
failed: true,
timedOut: false,
isCanceled: false,
killed: false,
signal: undefined

运行出错

环境:win10 20h2
终端:git bash
hlink版本:npm i -g hlink@next
如图所示:https://i.niupic.com/images/2022/01/07/9SVZ.png
配置:

// 重要说明路径地址都请填写 绝对路径!!!!
export default {
  /**
   * 源地址
   */
  source: 'E:/下载/PT/AV',
  /**
   * 目标地址
   */
  dest: 'E:/porn/AV',
  /**
   * 需要包含的后缀名,如果不配置该项,会采用以下策略
   *  1. 配置了excludeExtname,则链接文件为排除后的其他文件
   *  2. 未配置excludeExtname,则链接文件为目录下的所有文件
   */
  includeExtname: ['mp4', 'flv', 'f4v', 'webm',
    'm4v', 'mov', 'cpk', 'dirac',
    '3gp', '3g2', 'rm', 'rmvb',
    'wmv', 'avi', 'asf', 'mpg',
    'mpeg', 'mpe', 'vob', 'mkv',
    'ram', 'qt', 'fli', 'flc', 'mod', 'iso'],
  /**
   * 需要排除的后缀名, 如果配置了includeExtname则该配置无效
   */
  excludeExtname: [],
  /**
   * 0:保持原有的目录结构
   * 1:只保存一级目录结构
   * 默认为 0
   * 例子:
   *  - 源地址目录为:/a
   *  - 目标地址目录为: /d
   *  - 链接的文件地址为 /a/b/c/z/y/mv.mkv;
   *  如果保存模式为0 生成的硬链地址为: /d/b/c/z/y/mv.mkv
   *  如果保存模式为1 生成的硬链地址为:/d/y/mv.mkv
   */
  saveMode: 0,
  /**
   * 是否打开缓存,默认关闭
   *
   * 打开后,每次硬链后会把对应文件存入缓存,就算下次删除硬链,也不会进行硬链
   */
  openCache: false,
  /**
   * 是否为独立文件创建同名文件夹,默认创建
   */
  mkdirIfSingle: true,
}

希望加入后缀名过滤黑名单功能

目前程序支持的后缀名过滤白名单功能满足99%需求。

但是某些特殊资源后缀名不常见,如果没有写在规则里,很可能链接不到。
比如很多原盘、图书,含有很多奇奇怪怪的类型文件。

如果能加入黑名单功能,我们就可以只排除.nfo、.jpg、.png等影响刮削的文件类型,而对其他所有文件都进行链接。
满足不同需求,更加完美。

建议加上校验目标目录的文件功能

我用avdc刮削之后目录格式发生变化了,但是文件名字没有变化,简单来说就是一个文件夹变到了另一个文件夹里面,建议加上对目标目录校验,慢点也没啥关系。不然每次都要自己鉴别有点麻烦

新版本出错

背景

在之前版本没啥问题,但是升级了新版本,相同的命令就会出错

命令为:hlink -i=mkv,mp4,mov,rmvb,avi,wmv,flv ./tv/ ./tv_fake/

以下为截图:
image

希望加入文件大小过滤

只用后缀名过滤还不完美。
某些制作组的压制资源,带有预告片或者花絮,后缀名也是媒体。
实际上我们链接的影库不需要这些。
如果有文件大小过滤就能过滤掉大多数。
同时提议文件大小过滤可以按不同文件后缀单独设置,方便视频、音乐、图书等资源的不同过滤需求。

.!qB后缀文件黑名单无法过滤

因为个人习惯在qb下载的时候添加!qB后缀标识未完成的文件,并且不额外设置未完成的文件保存路径(避免文件下载完成后移动文件)。
为了避免自动硬链接的时候将未完成的文件也进行硬链接,想对!qB后缀进行黑名单过滤,但是发现实际未生效,测试其他常用后缀nfo,jpg等未出现该问题。

使用报错,请作者查看

Error: Command failed with exit code 1 (EPERM): find /media/4t/qb/hlink -inum 3813379
at makeError (/usr/local/node/node_global/lib/node_modules/hlink/node_modules/execa/lib/error.js:59:11)
at Function.module.exports.sync (/usr/local/node/node_global/lib/node_modules/hlink/node_modules/execa/index.js:187:17)
at getLinkPath (/usr/local/node/node_global/lib/node_modules/hlink/lib/utils/index.js:72:31)
at Object.checkLinkExist (/usr/local/node/node_global/lib/node_modules/hlink/lib/utils/index.js:79:17)
at /usr/local/node/node_global/lib/node_modules/hlink/lib/index.js:115:53
at step (/usr/local/node/node_global/lib/node_modules/hlink/lib/index.js:33:23)
at Object.next (/usr/local/node/node_global/lib/node_modules/hlink/lib/index.js:14:53)
at /usr/local/node/node_global/lib/node_modules/hlink/lib/index.js:8:71
at new Promise ()
at __awaiter (/usr/local/node/node_global/lib/node_modules/hlink/lib/index.js:4:12) {
command: 'find /media/4t/qb/hlink -inum 3813379',
exitCode: 1,
exitCodeName: 'EPERM',
stdout: '',
stderr: 'find: unrecognized: -inum\n' +
'BusyBox v1.29.2 (2019-03-10 14:44:18 CST) multi-call binary.\n' +
'\n' +
'Usage: find [-HL] [PATH]... [OPTIONS] [ACTIONS]\n' +
'\n' +
'Search for files and perform actions on them.\n' +
'First failed action stops processing of current file.\n' +
"Defaults: PATH is current directory, action is '-print'\n" +
'\n' +
'\t-L,-follow\tFollow symlinks\n' +
'\t-H\t\t...on command line only\n' +
"\t-xdev\t\tDon't descend directories on other filesystems\n" +
'\t-maxdepth N\tDescend at most N levels. -maxdepth 0 applies\n' +
'\t\t\tactions to command line arguments only\n' +
"\t-mindepth N\tDon't act on first N levels\n" +
'\t-depth\t\tAct on directory after traversing it\n' +
'\n' +
'Actions:\n' +
'\t( ACTIONS )\tGroup actions for -o / -a\n' +
"\t! ACT\t\tInvert ACT's success/failure\n" +
'\tACT1 [-a] ACT2\tIf ACT1 fails, stop, else do ACT2\n' +
'\tACT1 -o ACT2\tIf ACT1 succeeds, stop, else do ACT2\n' +
'\t\t\tNote: -a has higher priority than -o\n' +
'\t-name PATTERN\tMatch file name (w/o directory name) to PATTERN\n' +
'\t-iname PATTERN\tCase insensitive -name\n' +
'\t-path PATTERN\tMatch path to PATTERN\n' +
'\t-ipath PATTERN\tCase insensitive -path\n' +
'\t-regex PATTERN\tMatch path to regex PATTERN\n' +
'\t-type X\t\tFile type is X (one of: f,d,l,b,c,s,p)\n' +
'\t-perm MASK\tAt least one mask bit (+MASK), all bits (-MASK),\n' +
"\t\t\tor exactly MASK bits are set in file's mode\n" +
'\t-mtime DAYS\tmtime is greater than (+N), less than (-N),\n' +
'\t\t\tor exactly N days in the past\n' +
'\t-mmin MINS\tmtime is greater than (+N), less than (-N),\n' +
'\t\t\tor exactly N minutes in the past\n' +
"\t-newer FILE\tmtime is more recent than FILE's\n" +
'\t-user NAME/ID\tFile is owned by given user\n' +
'\t-group NAME/ID\tFile is owned by given group\n' +
'\t-size N[bck]\tFile size is N (c:bytes,k:kbytes,b:512 bytes(def.))\n' +
'\t\t\t+/-N: file size is bigger/smaller than N\n' +
"\t-prune\t\tIf current file is directory, don't descend into it\n" +
'If none of the following actions is specified, -print is assumed\n' +
'\t-print\t\tPrint file name\n' +
'\t-print0\t\tPrint file name, NUL terminated\n' +
'\t-exec CMD ARG ;\tRun CMD with all instances of {} replaced by\n' +
'\t\t\tfile name. Fails if CMD exits with nonzero\n' +
'\t-exec CMD ARG + Run CMD with {} replaced by list of file names',
failed: true,
timedOut: false,
isCanceled: false,
killed: false,
signal: undefined

Arm v8 node v14.18.1 npm 6.14.15

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.