Giter VIP home page Giter VIP logo

Comments (18)

Laharah avatar Laharah commented on August 21, 2024

Next time I add features, I'll look into adding this one in.

from deluge-filebottool.

rjsachse avatar rjsachse commented on August 21, 2024

Been thinking of a similar idea, happy to help just need some guidance.

from deluge-filebottool.

Laharah avatar Laharah commented on August 21, 2024

I see that an --exec command has been added to FileBot. I'll see if there's a good way to implement this into the plugin.

from deluge-filebottool.

rjsachse avatar rjsachse commented on August 21, 2024

I was thinking more like the execute plugin not using filebot -exec. Once filebot has finished then execute a script. But i guess it might be hard to know when filebot has finished.

from deluge-filebottool.

rjsachse avatar rjsachse commented on August 21, 2024

Also would be great to pass renamed file name arg to script like execute plugin.

from deluge-filebottool.

Laharah avatar Laharah commented on August 21, 2024

well, it looks like the --exec flag uses the same argument template as the other format expressions. If that's so, you should be able to have an argument like scp {f} server:{f}.

The last time I looked into this, before the exec flag was implemented, I tried to make the plugin play nice with the execute plugin that comes with deluge. Unfortunately, the execute plugin listens for the same torrent_finished event that filebottool does, so it will run at the same time/before filebot can sort anything. To stop that from happening, the plugin would have to insert a shim into the execute plugin and monkey patch it on the fly. However there's no way to guarantee that filebottool is loaded after the execute plugin, so you'd have to do something like temporary patching and un-patching. It all gets super messy, and it's generally considered bad behavior to monkey patch someone else's plugin anyways.

As I see it. There are really just 2 options:

  1. Add support for the --exec option built into filebot. Easy to implement, a little difficult to integrate from a clean UI perspective

  2. Write a second plugin called something like FileBotTool-Execute that basically just replicates the Execute plugin, but triggers based on a FileBotTool custom event. It would be fairly straight forward to pass the handler info in the event to support multiple actions for different handlers.

Both solutions would requre a good amount of thought about special cases:

  • Should the execute commands run every time or only on auto-executed renames?
  • What should happen if you run a rename multiple times? What if you revert a rename?
  • How can you make it easy to turn off the commands if you're doing a one-off rename?
  • Should the commands be saved with the handler, or should they have their own auto-execute rules?

I'll try to think about it over the next few days. I'm open to suggestions, opinions, or pull requests :)

from deluge-filebottool.

rjsachse avatar rjsachse commented on August 21, 2024

You make some very good points.
I think commands should be saved with the handler. I think really haveing the commands execute with auto-rename, if you are doing it manually how hard is it to just run a command after.

My setup is I add a torrent and lable plus check rules to apply the right lable, then when finished filebottool rebames and puts in right location. Now i have to manually update library in kodi. I have written a simple bash script that sends a notification to user and then commands kodi to update library.

Think commands really are for auto-move/rename

I see there is a updated execute plugin that might be good to use instead of creating a new plugin

https://github.com/ultnrg/deluge-execute/blob/master/README.md

I haven't done any deluge plugin yet only just moved from windows to linux and only just started learning python but do have some experience in other languages so sort of understand the code.

So maybe the easiest way would be to add filebotevent in the updated execute plugin.

Edit. Scrap that it won't help.

from deluge-filebottool.

rjsachse avatar rjsachse commented on August 21, 2024

Well after some research and trial and error trying to compile latest filebot, looks like this would only work on mac and windows as filebot 4.8 would be needed to use the -exec. I am on linux debian stretch on a arm device (rpi3). So you need to check filebot version and make sure it is above 4.7.9 for it to work that way.

from deluge-filebottool.

Laharah avatar Laharah commented on August 21, 2024

So, I gather that most of the users of my plugin use the linux version of 4.7.9 (myself included) and despite donating to the patreon it doesn't look like linux support will be coming very soon unless more people sign up. I think an additional plugin may be the way to go with this. It will require a bit more effort on the side of users to find and add an additional plugin, but I figure that most people looking to automate will be savvy enough to figure it out.

Unfortunately I've been a bit swamped with real life work. So aside from fixing issues I personally encounter with my plugin, support has been a bit lacking lately. I'll try to pencil in some time to hammer out at least what's needed in this plugin to support it. Namely a filebot_rename_finished event that get's triggered after a rename.

Once that's done the work of making the new execute plugin can start. I think most of the work can be mitigated by simply starting with the deluge execute plugin and modifying it. Changing one line should be enough to get it to trigger on the new event, then it's simply a matter of adding UI and maybe some parsing and passing of data that comes with the event.

from deluge-filebottool.

Laharah avatar Laharah commented on August 21, 2024

Okay, so a bit of an update about this.

I'm almost done with a bunch of that outstanding enhancements I've been planning to do. As of 1.1.15 I've added the needed support from within FileBotTool to get a new extension running. There are 2 events that FileBotTool now emits that any plugin can hook into:

  • FileBotToolTorrentFinishedEvent: a replacement for TorrentFinishedEvent that gets fired on any new torrent after the plugin has had a chance to modify. It will be emitted for all new finished torrents unless an error occurs during processing
  • FileBotToolProcessingErrorEvent: Gets emitted whenever an error gets encountered while FileBotTool is processing a torrent and it can't finish properly. This will get emitted during manual renames as well.

Anyone interested in checking out the events can see them here. They both include the torrent_id and the handler name that FileBotTool used if any. This should allow the new plugin to have different actions depending on what handler ran (one for movies, another for shows etc.). The error event also contains a string about the error encountered including a stack trace if any.

It should be pretty straight forward to integrate these into a copy of the execute plugin and add some finer control. If anyone wants to get on that I'm more than happy to let them take control of the new execute plugin. If no one jumps on it I can add it to my docket, but I can't make any guarantees about when I'll get around to it.

I'll land the new changes in the 1.2 release when I finish it in the next couple of days.

from deluge-filebottool.

rjsachse avatar rjsachse commented on August 21, 2024

Thanks. Yes life has been busy. I will try and have a look at this soon and trying to find time aswell.

from deluge-filebottool.

rjsachse avatar rjsachse commented on August 21, 2024

Hello again. I have made some adjustments to the deluge execute plugin. I am just testing now. Nothing special just should pick up the events. If works i will upload to github.

from deluge-filebottool.

Laharah avatar Laharah commented on August 21, 2024

@rjsachse cool, let me know if you need any help. Keep in mind you'll have to clone and compile FileBotTool 1.1.15 (git checkout 1.1.15) manually since the events are only emitted in the develop branch right now. They won't be in an actual release until I land them in master when I finish with 1.2.

from deluge-filebottool.

rjsachse avatar rjsachse commented on August 21, 2024

Yes i already compile 1.1.15. I just cloned deluge execute plugin and have attempted to implement the events. I have not tried it yet.

https://github.com/rjsachse/deluge-FBTExecute

from deluge-filebottool.

rjsachse avatar rjsachse commented on August 21, 2024

ok i have a bit of time this morning and gave it ago bu i get this error

[ERROR ] 08:03:14 eventmanager:59 Event handler FileBotToolTorrentFinishedEvent failed in <function event_handler at 0x6c139a30> with exception event_handler() takes exactly 1 argument (2 given)

from deluge-filebottool.

Laharah avatar Laharah commented on August 21, 2024

It looks like you're trying to catch the event with a function that doesn't have the right number of arguments.

FileBotToolTorrentFinishedEvent has 2 arguments, so the function that catches them should have arguments for both of those pieces of data for example

class Core(CorePluginBase):

    def enable(self)
        event_manager = component.get("EventManager")
        event_manager.register_event_handler("FileBotToolTorrentFinishedEvent",
                                               self.catch_fb_torrent_finished)
    
    def catch_fb_torrent_finished(self, torrent_id, handler_name):
        log.debug("Caught FileBotToolTorrentFinishedEvent! for torrent: {0}".format(torrent_id))

Novice how catch_fb_torrent_finished has the same arguments as FileBotToolTorrentFinishedEvent`:

def __init__(self, torrent_id, handler_name):

from deluge-filebottool.

rjsachse avatar rjsachse commented on August 21, 2024

@Laharah Thank you so much. i have only started learning python at the start of the year.

GOOD NEWS! FBTExecute now works...

i havent passed the *arg's yet, and is just a modified version of deluge execute plugin.

give it a go
https://github.com/rjsachse/deluge-FBTExecute

from deluge-filebottool.

Laharah avatar Laharah commented on August 21, 2024

Looks good! Now you just need special handling and UI. maybe something similar to the auto-execute UI in filebottool. You could get the saved handlers from FileBotTool and have commands that execute based on the handler name with special ones that handle Any or All or None.

If you've got a feature you want help with let me know and I can either give you tips or write up a pull request.

It's up to you how much work you want to put into it, but once you think it's good enough for average user to get a handle on I'll take a look at it and link to it from the readme here.

from deluge-filebottool.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.