[Scan-script] MetaCategory - set category from nzb-file meta-tag

Share your scripts or request scripts with specific features.
Forum rules
Please keep the forum clean - one topic per script. Questions not related to a specific script should be posted in Support forum.
hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

[Scan-script] MetaCategory - set category from nzb-file meta-tag

Post by hugbug » 16 Aug 2017, 19:49

This scan-script reads category information from nzb-file (if it's present in meta-tag) and sets the category for nzb-file when adding to queue.

How to use: save the script into ScriptDir and select it in option "Extensions".
Attachments
MetaCategory.py
(2.33 KiB) Downloaded 761 times

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [Scan-script] MetaCategory - set category from nzb-file meta-tag

Post by hugbug » 18 Aug 2017, 17:47

Renamed script to MetaCategory.

Identifier
Posts: 4
Joined: 12 Jan 2019, 16:41

Re: [Scan-script] MetaCategory - set category from nzb-file meta-tag

Post by Identifier » 12 Jan 2019, 16:43

I know this is an old thread, but is there a way to make nzbget automatically run this script on .nzb files that are manually placed in the ${MainDir}/nzb directory? (Rather than from RSS feeds). Thanks.

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [Scan-script] MetaCategory - set category from nzb-file meta-tag

Post by hugbug » 12 Jan 2019, 17:56

What makes you think the script is somehow RSS related?

Identifier
Posts: 4
Joined: 12 Jan 2019, 16:41

Re: [Scan-script] MetaCategory - set category from nzb-file meta-tag

Post by Identifier » 18 Jan 2019, 20:11

[Sorry for the late reply - I forgot to subscribe to this thread to get notifications]

Ahh, ok, you're right - I have it listed in the global Extensions script list and it does get run on NZBs that I drop in the nzbs folder. However, it seems to be run after NZBGet does its category matching, so it's not matching my categories with wildcards. For example, I have a "Movies" category with alias "Movies*" so it catches things like Movies > SD, Movies > HD, etc.

Normally, when I get NZBs from a RSS feed, the item initially shows up in the Downloads with category "Movies > SD" in the Category column (with the blue 'URL' icon next to the NZB name), but then the category changes to just "Movies" a couple seconds later (presumably after it downloads the NZB from the URL). And the rules in my "Movies" category get applied, such as putting it in my "Shared Movies" folder (since I have Category1.DestDir set to "/shares/Public/Shared Movies") and running videoSort and the other scripts in Category1.Extensions.

But for NZBs dropped in the nzbs folder, MetaCategory does run now and correctly assigns the category (for example "Movies > HD"), but the category just stays that way during the whole download & post processing and never switches to "Movies". The rules in my "Movies" category never get applied, and the resulting files end up in the "${MainDir}/completed/Movies _ HD" folder (since I have AppendCategoryDir set to Yes), and videoSort doesn't run etc.

Is there any way to make NZBGet do category wildcard matching after scan scripts have been run?

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [Scan-script] MetaCategory - set category from nzb-file meta-tag

Post by hugbug » 23 Jan 2019, 22:18

This is indeed a problem. Nzbget considers category set by a script as final one and doesn't map it. A correct solution would be to extend the script to perform necessary category mapping.

A quick fix for you would be to add a few simple if-commands at the end of the script to change category from "Movies -> HD" to "Movies". Can you try this yourself? Please post your version of the script if you have troubles making it work.

womo
Posts: 9
Joined: 11 Jun 2020, 20:48

Re: [Scan-script] MetaCategory - set category from nzb-file meta-tag

Post by womo » 25 Jun 2020, 16:54

You could hard-code the desired Category translations into the script, or even read all the Category Aliases and apply the matching category name in the script. But if I understand it, the OP problem would still exist.. the matching category extension scripts still won't run because NZBGet won't see the category name you set. Right?

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [Scan-script] MetaCategory - set category from nzb-file meta-tag

Post by hugbug » 25 Jun 2020, 17:01

The extension scripts will be selected according to category set by the script.

womo
Posts: 9
Joined: 11 Jun 2020, 20:48

Re: [Scan-script] MetaCategory - set category from nzb-file meta-tag

Post by womo » 25 Jun 2020, 17:02

Quick question... When I run the script it reads the nzb category name and sets category accordingly, but for instance the meta tag in my nzb is "<meta type="category">TV &gt; Anime</meta>" and the directory "TV _ Anime" is created for it. I was looking to tweak that a bit but don't see where in the script the character entity "&gt;" is translated to "_". Ideas? Thanks

womo
Posts: 9
Joined: 11 Jun 2020, 20:48

Re: [Scan-script] MetaCategory - set category from nzb-file meta-tag

Post by womo » 25 Jun 2020, 17:03

I'll have to test my category extension script again, it didn't seem to be working for me. Thanks.

Post Reply

Who is online

Users browsing this forum: No registered users and 36 guests