Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Library path verification doesn't work with symlinks (regression) #251

Open
2 of 3 tasks
Viren070 opened this issue Mar 3, 2025 · 7 comments
Open
2 of 3 tasks
Labels
Milestone

Comments

@Viren070
Copy link

Viren070 commented Mar 3, 2025

Checklist

  • I checked that this feature has not been requested before
  • I checked that this feature is not in the "Not planned" list
  • This feature will benefit the majority of users

Problem Description / Use Case

I have files from a remote location (real debrid) mounted through webdav (zurg + rclone), and my sonarr/radarr setup (w/ blackhole as a download client) creates symlinks after renaming/organising in another folder pointing to the actual file where it was mounted.

When doing a library scan, these files are not picked up.

Proposed Solution

Seanime should support symlinks and those files should be picked up by the scan.

@Viren070 Viren070 added the request New feature or request label Mar 3, 2025
@5rahim
Copy link
Owner

5rahim commented Mar 3, 2025

Symbolic links have been supported for a while 5a4ee71 and I know that some users use them without issues.

Seanime simply uses standard methods for evaluating symlinks and since I'm not familiar enough with it I can't really guess where the issue comes from, especially without replicating your setup.

@5rahim 5rahim removed the request New feature or request label Mar 3, 2025
@5rahim 5rahim changed the title feature request: symlink support for anime library symlink support for anime library Mar 3, 2025
@5rahim 5rahim added the status: assessment Issue or request is being considered label Mar 3, 2025
@Viren070
Copy link
Author

Viren070 commented Mar 3, 2025

It could potentially be because the files are not actually stored locally but mounted through webdav?

I'll see if it works when I just create a symlink to a file stored locally.

Though, I'm also not familiar with symlinks either. I am also using a docker image for this.

@5rahim
Copy link
Owner

5rahim commented Mar 4, 2025

It could potentially be because the files are not actually stored locally but mounted through webdav?

This might be it. I don't know enough about this protocol and it looks like Go's symlink resolution relies completely on the OS's native symlink support.
So regarding scanning, only local symlinks and some types network mounts will be picked up.

@Viren070
Copy link
Author

Viren070 commented Mar 6, 2025

To test this, I have a local file now mounted into the docker container at /mnt/test/[Erai-raws] Ore dake Level Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv

sudo docker exec -i seanime stat  "/mnt/test/[Erai-raws] Ore dake Level Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv"
  File: /mnt/test/[Erai-raws] Ore dake Level Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv
  Size: 1443500660      Blocks: 2819352    IO Block: 4096   regular file

I created a symlink using this command:

sudo ln -s "/mnt/test/[Erai-raws] Ore dake Level Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv" "/mnt/symlinks/test/[Erai-raws] Ore dake Level Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv"

I did also try this command

sudo docker exec -i seanime ln -s "/mnt/test/[Erai-raws] Ore dake Level Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv" "/mnt/symlinks/test/[Erai-raws] Ore dake L
evel Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv"

Now, there is a symlink at /mnt/symlinks/test/[Erai-raws] Ore dake Level Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv

If i use the stat command on the symlink within the seanime docker container:

sudo docker exec -i seanime stat "/mnt/symlinks/test/[Erai-raws] Ore dake Level Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv"

I get the following output:

File: '/mnt/symlinks/test/[Erai-raws] Ore dake Level Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv' -> '/mnt/test/[Erai-raws] Ore dake Level Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv'
  Size: 110             Blocks: 8          IO Block: 4096   symbolic lin

Now, if I go to seanime and use /mnt/symlinks/test as the anime library path, nothing is picked up. If I use /mnt/test instead, that file is picked up. The logs don't have anything useful, as far as I can tell:

Using /mnt/symlinks/test:

2025-03-06 17:56:19 INF - watcher > Watching directories: [/mnt/symlinks/test]
2025-03-06 17:56:19 INF - watcher > Library size: 110 B
....
2025-03-06 17:56:24 DBG - scanner > Starting scan
2025-03-06 17:56:24 DBG - scanner > Scan completed

Using /mnt/test:

2025-03-06 17:57:54 INF - watcher > Watching directories: [/mnt/test]
2025-03-06 17:57:54 INF - watcher > Library size: 1.4 GB
...
2025-03-06 17:57:57 DBG - scanner > Starting scan
2025-03-06 17:57:57 DBG - media fetcher > Creating media fetcher enhanced=false
2025-03-06 17:57:57 TRC - anilist platform > Fetching anime collection with relations
2025-03-06 17:57:57 DBG - anilist > Fetching anime collection with relations
2025-03-06 17:57:58 WRN - anilist > Successful Request (slow) rlr=89 rtt=1.169s
2025-03-06 17:57:58 DBG - media container > Media container created count=140
2025-03-06 17:57:58 DBG - Starting matching process
2025-03-06 17:57:58 DBG - hydrator > Starting metadata hydration
2025-03-06 17:57:58 TRC - anilist platform > Adding media to collection
2025-03-06 17:57:58 DBG - anilist > No media added to planning list
2025-03-06 17:57:58 INF - scanner > Scan completed

This is running on a Ubuntu 24.04 VPS using umagistr/seanime as the docker image.

@5rahim
Copy link
Owner

5rahim commented Mar 6, 2025

Look at the scan logs

@Viren070
Copy link
Author

Viren070 commented Mar 6, 2025

Sorry, didn't know I could view them separately.

A scan with /mnt/symlinks/test as the path for my anime library:

{"level":"info","count":1,"message":"Retrieved file paths from main directory"}

{"level":"info","count":1,"message":"Retrieved file paths from all directories"}

{"level":"debug","count":1,"message":"Local files to be scanned"}

{"level":"debug","count":0,"message":"Skipped files"}

{"level":"debug","message":"==========================================================================================================="}

{"level":"trace","path":"/mnt/test/[Erai-raws] Ore dake Level Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv","filename":"[Erai-raws] Ore dake Level Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv","parsedData":{"original":"[Erai-raws] Ore dake Level Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv","title":"Ore dake Level Up na Ken","releaseGroup":"Erai-raws","season":"2","episode":"09"},"parsedFolderData":[{"original":"mnt"},{"original":"test"}],"message":"Parsed local file"}

{"level":"debug","message":"==========================================================================================================="}

When viewing Solo leveling, it shows no downloaded episodes.

And when i use /mnt/test :

{"level":"info","count":1,"message":"Retrieved file paths from main directory"}
{"level":"info","count":1,"message":"Retrieved file paths from all directories"}
{"level":"debug","count":1,"message":"Local files to be scanned"}
{"level":"debug","count":0,"message":"Skipped files"}
{"level":"debug","message":"==========================================================================================================="}
{"level":"trace","path":"/mnt/test/[Erai-raws] Ore dake Level Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv","filename":"[Erai-raws] Ore dake Level Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv","parsedData":{"original":"[Erai-raws] Ore dake Level Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv","title":"Ore dake Level Up na Ken","releaseGroup":"Erai-raws","season":"2","episode":"09"},"parsedFolderData":[],"message":"Parsed local file"}
{"level":"debug","message":"==========================================================================================================="}
{"level":"info","context":"MediaFetcher","message":"Creating media fetcher"}
{"level":"debug","context":"MediaFetcher","count":101,"message":"Fetched media from AniList collection"}
{"level":"debug","context":"MediaFetcher","unknownMediaCount":0,"allMediaCount":101,"message":"Finished creating media fetcher"}
{"level":"info","context":"MediaContainer","inputCount":101,"mediaCount":140,"titles":290,"message":"Created media container"}
{"level":"debug","context":"Matcher","filename":"[Erai-raws] Ore dake Level Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv","titleVariations":["Ore dake Level Up na Ken Season 2","Ore dake Level Up na Ken S2","Ore dake Level Up na Ken 2nd Season"],"message":"Matching local file"}
{"level":"debug","context":"Matcher","filename":"[Erai-raws] Ore dake Level Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv","match":{"OriginalValue":"Ore dake Level Up na Ken 2nd Season","Value":"Ore dake Level Up na Ken 2nd Season","Distance":0},"results":[{"OriginalValue":"Ore dake Level Up na Ken Season 2","Value":"Ore dake Level Up na Ken 2nd Season","Distance":6},{"OriginalValue":"Ore dake Level Up na Ken S2","Value":"Ore dake Level Up na Ken","Distance":3},{"OriginalValue":"Ore dake Level Up na Ken 2nd Season","Value":"Ore dake Level Up na Ken 2nd Season","Distance":0}],"distance":0,"message":"Levenshtein match"}
{"level":"debug","context":"Matcher","filename":"[Erai-raws] Ore dake Level Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv","title":"Solo Leveling Season 2 -Arise from the Shadow-","id":176496,"message":"Best match found"}
{"level":"debug","context":"Matcher","filename":"[Erai-raws] Ore dake Level Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv","rating":1,"threshold":0.5,"message":"Best match rating high enough, matching file"}
{"level":"info","context":"Matcher","message":"Validating matches"}
{"level":"debug","context":"Matcher","mediaId":176496,"fileRatings":[0.8070175438596491],"message":"File ratings"}
{"level":"debug","context":"Matcher","mediaId":176496,"filename":"[Erai-raws] Ore dake Level Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv","rating":0.8070175438596491,"highestRating":0.8070175438596491,"message":"Rating matches parameters, keeping file matched"}
{"level":"info","context":"Matcher","ms":3,"files":1,"unmatched":0,"message":"Finished matching process"}
{"level":"info","context":"FileHydrator","entryCount":1,"message":"Starting metadata hydration process"}
{"level":"debug","context":"FileHydrator","filename":"[Erai-raws] Ore dake Level Up na Ken Season 2 - 09 [1080p CR WEB-DL AVC AAC][MultiSub][3B4549FF].mkv","mediaId":176496,"vars":{"parsedEpisode":"09","episode":9},"metadata":{"episode":9,"aniDBEpisode":"9"},"message":"File has been marked as main"}
{"level":"info","context":"FileHydrator","ms":0,"message":"Finished metadata hydration"}
{"level":"info","count":1,"unknownMediaCount":0,"message":"Scan completed"}

and I can then see the episode within seanime.

@5rahim
Copy link
Owner

5rahim commented Mar 9, 2025

Forgot to answer but it seems like the symlink got resolved correctly but a recent check I added is the reason why it gets ignored. i.e. the resolved path /mnt/test/[Erai-raws] Ore dake Level Up na ... isn't under the library path /mnt/symlinks/test.

@5rahim 5rahim added bug Something isn't working and removed status: assessment Issue or request is being considered labels Mar 16, 2025
@5rahim 5rahim changed the title symlink support for anime library bug: Library path verification doesn't work with symlinks (regression) Mar 16, 2025
@5rahim 5rahim added this to the v2.8.0 milestone Mar 16, 2025
@5rahim 5rahim moved this to Review in Seanime Roadmap Mar 16, 2025
5rahim added a commit that referenced this issue Mar 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Review
Development

No branches or pull requests

2 participants