NasTool and Hard Links

May 13, 2024

Deprecation: See /posts/movie-pilot/

NasTool

Initialization

The following content only introduces to user who manually oragnize media files like me.

Preparation

Installation

For Docker on DSM users, create a container according to the following Docker command:

docker run -d \
  --name nas-tools \
  --hostname nas-tools \
  -p 3000:3000 \
  -v $(pwd)/config:/config \
  -v /外部媒体目录:/media \
  -e REPO_URL="https://ghproxy.com/https://github.com/hsuyelin/nas-tools.git"
  -e PUID=0 \
  -e PGID=0 \
  -e UMASK=000 \
  -e NASTOOL_AUTO_UPDATE=false \
  -e NASTOOL_CN_UPDATE=true \
  hsuyelin/nas-tools

The downloaded media will be stored at /media/Movie/ and /media/TV/.

My Configuration

  • TMDB API Key: (fill in)
  • 二级分类策略: disabled
  • 默认文件转移方式: hard link
  • 转移最小文件大小(MB): 50
  • 电影重命名格式: {title} ({year}) TM{tmdbid}/{title}-{part} ({year}) - {videoFormat}
  • 电视剧重命名格式: {title} ({year}) TM{tmdbid}/S{season}/{season_episode} - {title}-{part}
  • 刮削元数据及图片: enabled
  • 使用横杠替换冒号: enabled
  • 媒体库
    • 电影: /media/_result/Movie/
    • 电视剧: /media/_result/TV/

Notification (Webhook)

Create an API to accept the following test case:

http POST $(uri)/nastool Content-Type:application/json title='Everybody Loves Raymond (1996) S01 E01 已入库' text='评分:6.8,类型:电视剧,质量: DVD,发布组/字幕组:rmvb,大小:101.45M,来自:手动整理' image='https://assets.fanart.tv/fanart/tv/73663/tvthumb/everybody-loves-raymond-5ae9af7c081c4.jpg' url='' user_id=''

Getting Started

Go to 媒体整理-文件管理, find the download folder that you mounted, and start organizing.

Hard Links

There might be some questions that you will be faced with and need to be figured out if you don’t want to fuck up filesystem as a long-term user when using NasTool to organize TV shows and movies. For example, what if I need to move things to another partition?

  • If the move operation is within the same file system, the hard link will remain valid. It will still point to the same data, and you can access the file using either the original file path or the hard link path.
  • If the move operation is across different partitions, the hard link will become a normal file on the destination partition. It will no longer point to the original file’s data. Instead, it will be an independent file that contains a copy of the original file’s data at the time of the move. The hard link will be separate from the original file, and changes made to one will not affect the other.
  • For filesystems like NTFS, ext4 and btrfs that does not support hard links across partitions, the hard link will become a separate, independent file on the destination partition. It will no longer be a hard link, but rather a regular file that contains a copy of the original file’s data at the time. The original file will also exist as an independent file on the destination partition.

rsync has a -H or –hard-links option for this:

-H, –hard-links

This tells rsync to look for hard-linked files in the source and link together the corresponding files on the destination. Without this option, hard-linked files in the source are treated as though they were separate files.


[back]