AMC - torrent categories as subfolders in output folder

Support for Windows users
Post Reply
Ithiloneth
Posts: 2
Joined: 01 May 2022, 13:32

AMC - torrent categories as subfolders in output folder

Post by Ithiloneth »

Hello!

I've been looking at the AMC script and it seems to do just what I want; well almost.
Truth be told I am not sure how it works by default, and I've been scared to try it out. This question may well have been asked before, but I could not find it using search.

I desire to use the AMC script from a torrent client on download completion.
The script needs to respect the source folder structure and output the renamed folder & file into a clone of that structure with the output directory as root, while leaving a hardlink behind in the source folder to the new, renamed, file.

I am fully clear that the AMC script will leave a hardlink, that much I've managed to find on my own and verify against the script.
My main concern now is which file becomes a hardlink and where the renamed file ends up.

If it does not already behave this way, can someone please share a script that will?
My thanks in advance to anyone who takes time out of their day to help me with this! :D

I have tried to make an example below showcasing:
  • Current
  • Desired
  • Feared
My files are currently organized into a folder structure:
New files will be added to this structure after download completion.
Torrent client root folder
-Video
--Movies
---On.Aviation.1923.hdRemuxBD.DaCool
----On.Aviation.1923.hdRemuxBD.DaCool.avi
--TV
---Cooking.With.Susan&Martin.S01E11.aTV.AntennaeAltruist
----Cooking.With.Susan&Martin.S01E11.aTV.AntennaeAltruist.avi
--Anime
-Audio
--Music
And so on.

Here is where I would like to end up with regards to folder structure:
The file name formats are placeholder - the actual structure as set by AMC will probably be way better and should suit my purposes just fine.
Torrent client root folder
-Video
--Movies
---On.Aviation.1923.hdRemuxBD.DaCool
----On.Aviation.1923.hdRemuxBD.DaCool.avi (Hardlink to: On Aviation 1923.avi)
--TV
---Cooking.With.Susan&Martin.S01E11.aTV.AntennaeAltruist
----Cooking.With.Susan&Martin.S01E11.aTV.AntennaeAltruist.avi (Hardlink to: Cooking With Susan & Martin S01E11.avi)
--Anime
-Audio
--Music

AMC script output folder
-Video
--Movies
---On Aviation 1923
----On Aviation 1923.avi
--TV
---Cooking With Susan & Martin
----Season 01
-----Cooking With Susan & Martin S01E11.avi
--Anime
-Audio
--Music
What I am afraid will happen:
AMC output directory
-On Aviation 1923
--On Aviation 1923.avi (Hardlink to: On.Aviation.1923.hdRemuxBD.DaCool)
-Cooking With Susan & Martin
--Season 01
---Cooking With Susan & Martin S01E11.avi (Hardlink to: Cooking With Susan & Martin S01E11.avi)
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC - torrent categories as subfolders in output folder

Post by rednoah »

The amc script will do what you intended to do by default.


Ithiloneth wrote: 01 May 2022, 14:10 Truth be told I am not sure how it works by default, and I've been scared to try it out. This question may well have been asked before, but I could not find it using search.
That said. Log in via SSH and run filebot with --action test manually on the command-line first, and read the console output. Playing with the command-line tool first is good exercise and will help you understand what is happening as the console output tells you what it's doing line by line.


Ithiloneth wrote: 01 May 2022, 14:10 The script needs to respect the source folder structure and output the renamed folder & file into a clone of that structure with the output directory as root, while leaving a hardlink behind in the source folder to the new, renamed, file.
You seem to confuse hardlinks with symlinks. You'll want to use hardlinks, because you'll want both original structure and target structure to contain "files" that are equally "the original file". Remember, the "original file" is already just a hardlink, it just so happens that you typically have only one file (i.e. hard link; the thing you refer to as "file" is referred to as "hard link" by the file system) per physical bits on disk, but the file system does allow you to have two or more. Both are the original file. Both share (i.e. link to) the physical bits on your hard drive.
:idea: Please read the FAQ and How to Request Help.
Ithiloneth
Posts: 2
Joined: 01 May 2022, 13:32

Re: AMC - torrent categories as subfolders in output folder

Post by Ithiloneth »

Thank you kindly for the answer rednoah!

I now understand what a hardlink is a little better; it's the instance we call file which points to data on the drive. You might create two such instances, and, like with shortcuts, you can rename those instances.

How do I know which hardlink governs over the actual name value of the file?
Or does such a value not exist for the data, and is held only by each individual instance of the hardlink and thus are completely separate from one another?

And, importantly, can I accidentally delete the data if I remove/edit only one of two existing hardlinks? I.E deleting one hardlink won't accidentally remove the data?

Based on what you've just taught me, my guess would be that even when deleting the final instance of a hardlink the data is not destroyed; I simply have no way of knowing where to look for it.
Thus deleting just one of two hardlinks means I should still have access to the data from the other hardlink. Right?

Perhaps "deleting" is a bit of a misnomer when understood from a layman's perspective. What we really do is deleting links to data, thus "losing" or "forgetting" that data's location?

I have other questions, but out of respect for future visitors to this thread I won't ask them here as to maintain clear topics and titles. I also feel ready to start testing the utility now, since I know it can't do harm to my data so perhaps I won't need to ask that many more questions before I'm ready to finalize an AMC script.

Thank you again for the help!
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC - torrent categories as subfolders in output folder

Post by rednoah »

You got it. You can't accidentally delete data, because the file system will only release the disk space if there are no longer any files that refer to it. If you delete 1 out of 2 hard links that refer to the same data, then nothing happens. If you delete the last hard link, then free disk space will become available.

That's why the file system doesn't technically "delete" data. It'll just mark it as free space, and that's it. It won't get overwritten until new data is written.
:idea: Please read the FAQ and How to Request Help.
Post Reply