[Plugin] LabelPlus v0.3.2.2

Suggest, post, or discuss plugins for Deluge
remiel

Re: [Plugin] LabelPlus v0.3.2.2

Post by remiel »

I've set this up as per the instructions (I think), but I can't get the automove-on-completion to work properly.

I have a directory hierarchy set up for automatic sorting into subfolders based on labels and that works well in µTorrent (old version). While trying to replicate that in Deluge+LabelPlus, it works somewhat, but strips the first directory/part of the label and constantly dumps things in the wrong place.

I'm in the process of moving everything from my NAS to my home server due to lack of disk space and dying disks in the NAS, so for the time being everything is stored in E:\NASBackup on the server. This is also the default save location for torrents. Under this directory I have several subdirectories like Film, TV series, Programs, Music and so on. After setting up Deluge+LabelPlus and thinking I got it right, I find that whenever I assign a label like "TV series\Supernatural\Season 13" to a torrent and then expecting it to end up in E:\NASBackup\TV series\Supernatural\Season 13, I find a new "Supernatural" directory directly under E:\NASBackup. Even adding "NASBackup" to the label doesn't work, it still dumps the files in the wrong place.

Deluge has been restarted fully numerous times during testing, and I even rebooted the server a few times to make sure all configs were re-read.

A little nit-pick I have is that the automove system is too complicated; just specify a default storage location, add a checkbox for "Move completed torrents to..." and a checkbox for "Append torrent label to storage path" and done. I.e. like it's implemented in µTorrent 2.2.1.

In any case, I can learn to live with the complexity as long as I only need to set it up once, so I'd like to know how I can maintain my current directory structure AND use LabelPlus to move completed torrents into the correct directories.

Thanks!
daerlnaxe
Member
Member
Posts: 12
Joined: Wed Nov 01, 2017 9:59 am

Re: [Plugin] LabelPlus v0.3.2.2

Post by daerlnaxe »

the thing is missing in this plugin is to have an auto add by folder.
Like on rtorrent.
You prepare a dir with all the subdirs you want, when the plugin detect a new torrent it put the label, the temp dir with a subdir named as the label, and when finished same thing.
Autoadd do it but sadly it's not compatible with sublabel.
Kuyte
New User
New User
Posts: 2
Joined: Wed Nov 29, 2017 12:16 pm

Re: [Plugin] LabelPlus v0.3.2.2

Post by Kuyte »

Hello.

I would request an easy but really handy feature.

Can you add please a default label? So when any of the regexes doesn't match it should add that torrent to that label, not unlabeled. I imagine that as a dropdown setting in the plugin settings page to select which Label (maybe sublabel) do we want as a default label.

Thanks!
mhertz
Moderator
Moderator
Posts: 2182
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: [Plugin] LabelPlus v0.3.2.2

Post by mhertz »

Just wanted to report that this plugin doesn't work with latest deluge git-develop builds. When enabling it from core.conf it isn't added, and when trying to enable it from the GTK-UI then it will not allow being enabled(the checkbox will not be checked on mouse-click). When trying, it outputs this error to console:

Code: Select all

23:56:18.308 [ERROR   ][deluge.pluginmanagerbase           :186 ] Failed to start plugin: LabelPlus
Traceback: <type 'exceptions.AttributeError'>: 'TorrentManager' object has no attribute 'session_started'
/usr/lib/python2.7/site-packages/twisted/internet/defer.py:150:maybeDeferred
/usr/lib/python2.7/site-packages/deluge/plugins/init.py:27:enable
/home/martin/.config/deluge/plugins/LabelPlus-0.3.2.2-py2.7.egg/labelplus/core/core.py:118:enable
I saw that Cas just recently added pre-load magnet metadata functionality to the core from the git-develop changelog and so was eager to test if labelplus now finally would work for magnets too, so could be used by users of public trackers aswell(well, magnet2torrent.py could be used as an inbetween also), but unfortunetly didn't even allow enabling the plugin.

Your two plugins ltconfig and labelplus is imho what really sets deluge apart and makes it special compared to other clients, in addition of-course to thin-client functionality with multiple interfaces, and plugin-support, so I would hate to see labelplus with it's unrivaled auto-label functionality(unless scripting yourself with e.g. rtorrent-ps/pyrocore cli tools) go unavailable whenever deluge 2.0 gets released and mainstream. Ltconfig works great btw also in latest git-develop :)

Edit: Phoenox09 reported this incompatibility on ratanakvlun's labelplus git-repo on 27'th august '17, with same error-output, but no reply unfortunately :( I do remember though that one of the last reply's I read from ratanakvlun was him saying he was really busy currently, probably with work and such, which of-course is understandable.

https://github.com/ratanakvlun/deluge-l ... /issues/29
mhertz
Moderator
Moderator
Posts: 2182
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: [Plugin] LabelPlus v0.3.2.2

Post by mhertz »

Instead of making a batchfile and setting that as default handler for magnets, then I added 4 small lines to danfolkes magnet2torrent.py, so that it now can simply be set as default handler for magnets, because it will then make a torrent from the magnet and directly load it into deluge and delete the temporary torrent meta-file afterwards, so this fixes the issue of LabelPlus not working for magnets when using filters for e.g. file-extensions.

Note, there is already a fork of magnet2torrent.py by LordAro which also supports loading into client, but that still needs a batchfile because it needs extra arguments for adding the magnet.

The torrent is loaded with 'xdg-open', meaning with whatever app you've defined to be standard handler for torrent-files, so deluge in our case obviously.

https://pastebin.com/dl/pujkSz56 (Place it somewhere under PATH, make it executable, and add as handler for magnets, but not torrents which should be kept as before set to deluge)

Edit: Uploaded on gist because stupid pastebin adds cariage-returns making it fail running afterwards! Additionally, I fixed an issue with magnets without fallback trackers sometimes staying in "downloading metadata" forever. I included another version with the fix but without auto-loading into torrent-client for manual use.

https://gist.github.com/mhertz/01842039 ... 16e83dc4e4

Manual:

https://gist.github.com/mhertz/c66dcb71 ... 18003ae554
mhertz
Moderator
Moderator
Posts: 2182
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: [Plugin] LabelPlus v0.3.2.2

Post by mhertz »

I fixed LabelPlus so it now works with magnets too, as auto-labeling didn't work before when e.g. filtering by file-extensions.

I built a fixed python2.7 version of latest LabelPlus v0.3.2.2 and uploaded it here:

http://s000.tinyupload.com/index.php?fi ... 9068862801

The link gets disabled after 100 days without a download, so if it dies later on, then drop me a line, and i'll fix it, or if you need another python version.

Patch of fix:

https://gist.github.com/mhertz/d9c91bef ... 3fb0e2431f
mhertz
Moderator
Moderator
Posts: 2182
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: [Plugin] LabelPlus v0.3.2.2

Post by mhertz »

I was hoping that I could possibly find what parts LabelPlus used that was deprecated and exchange for new function-names, so it could be used with deluge's git-develop branch also(deluge v2.0 beta), but unfortunately I've gotten nowhere, as i'm no python programmer, only an avid intermediate shell-scripter :(

I'm hoping someone could kindly help me out a little here please.

The plugin will not even let it be enabled from either core.conf or GTK-UI, and I found that it was because it tries to use a deprecated function from torrentmanager.py called 'session_started'. That's removed in git-develop unfortunately, and was added previously for checking if TorrentAddedEvent was from state file. Line 169-170 of torrentmanager.py from stable v1.3x:

Code: Select all

# Workaround to determine if TorrentAddedEvent is from state file
        self.session_started = False
And 693-694:

Code: Select all

self.session_started = True
        component.get("EventManager").emit(SessionStartedEvent())
The code in LabelPlus that fails adding the plugin to deluge is in core.py(because of missing session_started as listed above) 118-123:

Code: Select all

   if not deluge.component.get("TorrentManager").session_started:
      deluge.component.get("EventManager").register_event_handler(
        "SessionStartedEvent", self._on_session_started)
      log.debug("Waiting for session to start...")
    else:
      twisted.internet.reactor.callLater(0.1, self._initialize)
Now as I don't know what the new name is to replace it with(session_started), then I simply for testing commented out different parts, e.g. at first then I just left:

Code: Select all

twisted.internet.reactor.callLater(0.1, self._initialize)
Then the plugin finally could be added to deluge and didn't show errors in log and just showed that the plugin was enabled and other initialization info, but it however didn't do any of the auto-label sorting I had defined, so didn't work.

Then I instead tried just keeping:

Code: Select all

 deluge.component.get("EventManager").register_event_handler(
        "SessionStartedEvent", self._on_session_started)
Then it again could be added to deluge and showed enabled in log + initialization info, but still no luck in it's requested functionality i.e. auto-labeling and sorting/moving. This time though it stated in the log an additional line with an error:

Code: Select all

23:45:40.369 [ERROR   ][deluge.core.eventmanager      :39  ] Event handler TorrentAddedEvent failed in <bound method Core.wrap of <labelplus.core.core.Core object at 0x7f12c6732190>> with exception on_torrent_added() takes exactly 2 arguments (3 given)
But this doesn't make any sense to me when core.py of LabelPlus at 735 uses:

Code: Select all

def on_torrent_added(self, torrent_id):
So 2 arguments, not 3 as the error states??? I then thought it was maybe because of my commenting out stuff, so didn't do that for a test and instead added the missing session_started lines to relevant places of torrentmanager.py of deluge-git, but this did the exact same as above, with the to many args given error in log. I also if possibly wanted to avoid this, as i'd like to patch the plugin and not deluge preferably.

I'm at a complete loss now, and so again if anybody could help out with this, then it would be very much appreciated, as I would hate to see this fine plugin go to waste when deluge v2.0 get released/final.

Btw, I don't personally even use this plugin, as use my own shell-script which does the auto-sorting/moving based on filering by file-extensions(+ retrieves subs for video, deletes samples and other crap and lowercase everything/space-to-underscore), but I just think it's a great plugin and if I didn't knew how to do it myself, then I surely would use it. Also, there is some use-cases which I cannot replicate with my script that this plugin can do, but personally I don't use them myself, so don't need it, atleast yet.

thanks alot in advance!

Btw, this session_started i'm guessing will be an issue with other plugins once deluge v2.0 gets released officially, as i've already seen one other plugin fail getting enabled because of this and where the author didn't understood why.
shlackbaum
New User
New User
Posts: 1
Joined: Sat Oct 06, 2018 3:22 pm

Re: [Plugin] LabelPlus v0.3.2.2

Post by shlackbaum »

Hi there, is there a way to use label for torrent file name and not name of files IN the torrent?
Spadge
Seeder
Seeder
Posts: 111
Joined: Sat Dec 13, 2008 4:17 pm

Re: [Plugin] LabelPlus v0.3.2.2

Post by Spadge »

mhertz wrote:I fixed LabelPlus so it now works with magnets too, as auto-labeling didn't work before when e.g. filtering by file-extensions.

I built a fixed python2.7 version of latest LabelPlus v0.3.2.2 and uploaded it here:

http://s000.tinyupload.com/index.php?fi ... 9068862801

The link gets disabled after 100 days without a download, so if it dies later on, then drop me a line, and i'll fix it, or if you need another python version.

Patch of fix:

https://gist.github.com/mhertz/d9c91bef ... 3fb0e2431f
Are we all on Python3.x now?

Is there a Label plugin for 3.6 available?

Code: Select all

spadge@Moya:~$ deluge --version
deluge 2.0.0.dev7385
libtorrent: 1.1.10.0
Python: 3.6.6
OS: Linux Ubuntu 18.04 bionic
Thanks!
Cas
Top Bloke
Top Bloke
Posts: 3679
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: [Plugin] LabelPlus v0.3.2.2

Post by Cas »

Spadge wrote: Are we all on Python3.x now?

Is there a Label plugin for 3.6 available?

Code: Select all

spadge@Moya:~$ deluge --version
deluge 2.0.0.dev7385
libtorrent: 1.1.10.0
Python: 3.6.6
OS: Linux Ubuntu 18.04 bionic
Thanks!
I have created a post with update details for plugin authors: viewtopic.php?f=9&t=55156
Post Reply