Laharah / deluge-FileBotTool

A plugin to integrate simple FileBot functionality into Deluge
GNU General Public License v3.0
114 stars 10 forks source link

[Question] can this be used with the Extractor #8

Open saitoh183 opened 8 years ago

saitoh183 commented 8 years ago

So i got a torrent that comes in a rar format and filebottool wont do anything with it if it isnt extracted. So i turned on the extrator but you have to choose a location to extract. But this location is not the files folder. Would there be a way to have some sort of setting to take charge of the unrar location ?

Laharah commented 8 years ago

Hmm, I know that the FileBot AMC script can do extraction, but I'm not sure it's built into FileBot directly.

The main issue is that any files extracted wouldn't be tied to the torrent in deluge anymore, so it would have to be some kind of special file mode built into the plugin. I'll look into it and get back to you.

Laharah commented 8 years ago

looking at the filebot cli, it does have an --extract flag. I'll test it out and see if I can fit it into the plugin somewhere.

saitoh183 commented 8 years ago

Cool...cuz the other thing that maybe could have been done, would be to maybe grab the extraction location from the Extractor plugin. But if you can use the extract cmd from Filebot, this would be best so that the extract is done within the torrent folder and not at another location.

Laharah commented 8 years ago

Experimenting a little with the -extract flag in filebot, it looks like it will extract the files first, leaving the .rar file untouched, and then add those files to the list of files to act on, this behavior makes sense, but it makes things a bit complicated for the plugin, depending on the exact circumstances.

The first situation, is you have a torrent that is a single .rar file. The rar is first decompressed, leaving you with a bunch of new files and the original rar file. If the mode is move, the new files will be sorted, and the .rar file is left behind. Here's the issues:

The second situation is you have a torrent that contains a .rar file as well as normal non-rar files (for example subtitles all zipped together). Again, the archive will be decompressed and it's files added to the job. Here are the issues in this situation:

I'm trying to think of the best way to implement all this so that everything behaves both as you expect and as you would want. For the plugin I don't think it makes sense to allow the -extract flag in move mode, since the most common situation (a single .rar file torrent) won't actually move the torrent file. To the user, it will look like nothing happened.

I'm thinking that extract should only be allowed in copy mode. To stop the situation where you have 3 copies of each file (the achive, the files extracted as-is from the archive, and the duplicate that filebot makes to be renamed and sorted), I can get the list of files that were extracted and then delete them, leaving the archive for you to seed from, and the files that have been sorted. I think that will give the best balance of behavior that works and makes sense.

Some issues that will remain:

Well, that's a lot of text for a fairly simple problem. I'm still not quite happy with that behavior, especially since it will really be complicated to automate everything with auto-sort rules. Let me know if you've got ideas for how things should behave, and I'll keep mulling everything over before I implement anything.

saitoh183 commented 8 years ago

Yeah...phew...long read...

couldnt you utilize the hardlink function? Like create a hardlink of the completed to a temp directory and manipulate everything there and then delete it all once the process is done? this way you wouldnt be messing with the original file? Im thinking a bit like Rtorrent/RUtorrent autotool. I have it setup that it watches a folder containing sub folders of each or my blackhole apps. Torrent file is picked up and labeled the same as my watch folder subfolder. once done it hardlinks to my transfer folder which is linked to my btsync so i can manipulate the file as i please while it can continue to seed.

Laharah commented 8 years ago

well, the plugin already supports creating hardlinks and symlink (and soon reflinks for btrfs filesystems), which will leave the original untouched, while sorting the links to the correct places, but it won't solve the problem of needing to extract archive files somewhere, and then deciding where to point deluge when all is said and done. To keep everything seeding, any archives need to be kept as well, and since extracted files won't be shown in deluge I have to come up with a way to make the behavior consistent for when there's an archive and when there isn't.

saitoh183 commented 8 years ago

But if you hardlink the completed folder, wont it take deluge seeding out of the equation because you would work on the hardlink file? As for the extraction, if possible, that should happen after the file has been hardlinked and if possible have it extract to the current folder. the --extract would extract to where by default?

Laharah commented 8 years ago

By default, -extract will extract to wherever the output field is set to, which if blank is wherever the completed torrent folder is. In the case of using the hardlink or symlink flags it's fairly simple, deluge would keep seeding without changing anything, The only thing to decide is where to keep the extracted files that we link to.

The hard part is deciding what to do when move is selected. Right now, the files are moved and renamed and then deluge points to their new locations. We couldn't do that with extracted files, since deluge would still have to point to the .rar files, the extracted files wouldn't be in the torrent info. We could just let it do it's thing, where as far as deluge is concerned, dexter.s01.rar or whatever wouldn't change (where even though you told it to move it looks like nothing happened), but we'd still have to decide what to do when there's a subtitles.rar or something as well as media files that are moved.

saitoh183 commented 8 years ago

For the extraction location i would say make it the users choice (option to set). As you said...make this a copy function only since moving would complicate things...maybe you could tackle that later in another release? This would also give you time to see how the copy would work in real world usage.

saitoh183 commented 7 years ago

any headway? Currently this is my only issue that is break automation.Right now since i use autoRemover plus to remove after certain seed time, i make sure it saves the torrent file so that i can redownload if it was a compress archive.

Laharah commented 7 years ago

I'm still considering the best way to implement things. It's not quite as straight forward as it seems. I'll post here when I can patch it in.

saitoh183 commented 7 years ago

Ok no problem.