Updating names with keeplink

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Updating names with keeplink

Post by devster »

I'm using keeplink for files. I'd like the option to update the names of certain files without reverting and reprocessing them.
The current workflow is:

Code: Select all

docker exec <container> /usr/bin/filebot -revert /media/tv/show
docker exec <container> /usr/bin/filebot -script fn:amc --action keeplink --output /media --conflict skip -non-strict --log-file amc.log --def ut_label=tv_shows --def @/scripts/notify.txt minLengthMS=300000 --def movieFormat=@/scripts/movieFormat.groovy --def seriesFormat=@/scripts/seriesFormat.groovy --def animeFormat=@/scripts/animeFormat.groovy /original/tv/path1 /original/tv/path2 /original/tv/path3
It's not long but it implies moving files back and forth.
The manual alternative is the following:

Code: Select all

ll original.file.mkv
mv /media/tv/show/processed.mkv /media/tv/show/updated.processed.mkv
ln -sf /media/tv/show/updated.processed.mkv original.file.mkv     /// or using the relative link as FileBot does
Is there any way to accomplish this in an automated way? Either using FileBot or using a script?
Would one of the following:
- processing with FileBot the link and the file in a read-only manner and having a machine-readable output so that a script can perform the move/link operations
- have FileBot do the above and also handle the move/link operations
be feasible?
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Updating names with keeplink

Post by rednoah »

:?: What is the purpose of "updating names", perhaps episode titles? Those don't typically change much over time...


:?: Sounds like you're making life difficult for yourself by creating symbolic link files to file paths that can change. Why not use hardlinks instead? Just have the same file at multiple file paths. No symbolic link files. Problem solved.


:idea: You'll definitely want to re-process files based on previously stored xattr metadata instead of running the amc script on the files again:
viewtopic.php?t=13056


:arrow: You'll want to have a primary file structure of some kind that never changes as illustrated in the link above. You can then generate and re-generate arbitrary secondary structures based on that on demand.
:idea: Please read the FAQ and How to Request Help.
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Re: Updating names with keeplink

Post by devster »

rednoah wrote: 05 Jul 2022, 20:10 :?: What is the purpose of "updating names", perhaps episode titles? Those don't typically change much over time...
Usually they don't but in some shows they do, or rather, the databases initially have all episodes as "Episode 1", "Episode 2", ... and someone later updates the titles. One example is "Last Week Tonight with John Oliver".
rednoah wrote: 05 Jul 2022, 20:10 :?: Sounds like you're making life difficult for yourself by creating symbolic link files to file paths that can change. Why not use hardlinks instead? Just have the same file at multiple file paths. No symbolic link files. Problem solved.
I have a fast small SSD on which files are downloaded and then moved to a single logical pool backed by HDDs. Hard links don't work across storage types (RAID vs zRAID or btrfs or anything else), while symlinks do and they allow torrent seeding with original names for indefinite time. Changing this structure now isn't feasible and FileBot does take it into consideration with the "keeplink" action. Also as mentioned above it doesn't really happen often that files get renamed.
rednoah wrote: 05 Jul 2022, 20:10 :idea: You'll definitely want to re-process files based on previously stored xattr metadata instead of running the amc script on the files again:
viewtopic.php?t=13056
This would break symlinks and seeding, also I think that on Linux these file handles would probably remain open anyway as long as the original file was seeding.
rednoah wrote: 05 Jul 2022, 20:10 :arrow: You'll want to have a primary file structure of some kind that never changes as illustrated in the link above. You can then generate and re-generate arbitrary secondary structures based on that on demand.
I haven't figured out a better system than the one I'm using that satisfies the requirements of having a single storage pool and indefinite seeding.
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Updating names with keeplink

Post by rednoah »

1.
devster wrote: 05 Jul 2022, 21:33 Usually they don't but in some shows they do, or rather, the databases initially have all episodes as "Episode 1", "Episode 2", ... and someone later updates the titles. One example is "Last Week Tonight with John Oliver".
If you process a file within minutes of release, this might happen. The solution is to just process files 1-2 days after release. If you can wait for a day, then this problem will resolve itself.

:idea: If you are running the amc script on a schedule (e.g. once a day at night time) then you can use --def minFileAge=3 to ignore files that are too new.




2.
devster wrote: 05 Jul 2022, 21:33
rednoah wrote: 05 Jul 2022, 20:10 :idea: You'll definitely want to re-process files based on previously stored xattr metadata instead of running the amc script on the files again:
viewtopic.php?t=13056
rednoah wrote: 05 Jul 2022, 20:10 :arrow: You'll want to have a primary file structure of some kind that never changes as illustrated in the link above. You can then generate and re-generate arbitrary secondary structures based on that on demand.
I haven't figured out a better system than the one I'm using that satisfies the requirements of having a single storage pool and indefinite seeding.
The better system proposed above starts with what you're already doing, so it'll work within your limitations. You just happen to generate a extra disposable file and folder structure for viewing purposes from your primary structure, instead of re-organizing your primary structure to fit your viewing purposes.


  1. You do what you do now. Call amc script (ideally a day or at least a few hours after release so somebody had time to enter episode titles already) with --action keeplink and --format {plex.id} to your storage drive as you do now. This is your primary structure. Your seed structure is mostly symlinks to your primary structure.
  2. Follow Re-organize previously organized files using local xattr metadata if you need to a different view for your files (i.e. different folder structure, file naming, file filtering, etc). You can use either hardlinks or symlinks for your generated views. Doesn't matter. You can delete and re-generate views as needed if needed.
:idea: Please read the FAQ and How to Request Help.
Post Reply