NZBID in PostProcessing

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.
Post Reply
clintonhall
Posts: 449
Joined: 15 Dec 2012, 01:52
Location: Australia
Contact:

NZBID in PostProcessing

Post by clintonhall » 06 Apr 2013, 18:53

Hi hugbug,

New developments at CouchPotato have seen the NZBID written into the "release" table of the database at time of sending nzb to NZBGet,

Now, when renaming completed downloads, CouchPotato matches the NZBID (if renaming triggered from api monitoring) to the release table to ensure the release is correctly flagged as complete and to check the qualities etc.

so, for my postprocessing option, I want to also pass the NZBID through. Is this currently available (is this tag exported?) and if so, what is the name of this variable? If not, can this be made available for future releases?

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

Re: NZBID in PostProcessing

Post by hugbug » 06 Apr 2013, 19:52

The using of NZBID to track nzb-files is unfortunate. These IDs are regenerated when the queue is loaded from disk and therefore should not be used across program sessions. This can be fixed of course.

The pp-script doesn't get NZBID passed. This can be added in the next version as well.

clintonhall
Posts: 449
Joined: 15 Dec 2012, 01:52
Location: Australia
Contact:

Re: NZBID in PostProcessing

Post by clintonhall » 07 Apr 2013, 02:09

Thanks for confirming this.

I'll let everyone over at CouchPotato know.

What they are trying to do is poll the downloader periodically to find the status of the download (using this NZBID) and then trigger the renamer when complete.

What I am still doing is using the downloader to trigger the postprocessing when complete and then tell CouchPotato that the particular download is complete.

For now, I am cheating in that for both sab and nzbget I am just polling CouchPotato to find the id from the "snatched" release for that movie (with a few checks to make sure it is valid etc) so this shouldn't hurt my script as it is (torrents we just match the torrent hash as the downloader id)....

As I understand, the current method in CouchPotato would cause problems if nzbget was restarted during a download? As the NZBID would no longer match the value in CouchPotato's database and therefore it would get the status of a different (or no) download...

mano3m
Posts: 1
Joined: 07 Apr 2013, 08:14

Re: NZBID in PostProcessing

Post by mano3m » 07 Apr 2013, 08:21

Hi hugbug,

As clinton.hall stated, we are trying to improve integration between couchpotato and the downloading programs it supports. One item is the tracking of the status of nzbs sent to the downloader program.

It would be great if you could include an id which is unique for the nzb across sessions, so that we don't lose sight of the nzb. In addition, it would be nice if this id was returned when adding a new nzb. We currently search for the id after adding it to the queue.

Another item we ask the downloaders is how much time is left unil the download is finished (including downloads before this one). I guess such a function/parameter does not yet exist for NZBGet. It would also be nice if this parameter could be added. :)

Thanks a bunch,

Cheers,

mano3m

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

Re: NZBID in PostProcessing

Post by hugbug » 07 Apr 2013, 13:40

The non-persistent NZBID issue will be fixed.

I suggest however a different solution, which will work with all NZBGet versions: instead of saving NZBID on your side let NZBGet save your CouchPotato-ID.

NZBGet has a concept of post-processing parameters. Each download job (nzb-file) in NZBGet has a list of Name=Value-pairs. The post-processing parameters can be set and accessed via RPC.

1) after the nzb-file is added to NZBGet use method "editqueue" to save your ID in the nzb-files pp-parameters. For example "couchpotato_id=123":

Code: Select all

editqueue("GroupSetParameter", 0, "couch potato_id=123", [123])
2) when you check current status using method "listgroups" check in the array "Parameters" for your pp-variable "couchpotato_id".

3) a post-processing script becomes all pp-variables as env. variables (see doc for option <PostProcess>). In this case env. var "NZBPR_couchpotato".

You can use as many pp-parameters as you need.

clintonhall
Posts: 449
Joined: 15 Dec 2012, 01:52
Location: Australia
Contact:

Re: NZBID in PostProcessing

Post by clintonhall » 07 Apr 2013, 17:43

I like it.

Thanks hugbug.

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

Re: NZBID in PostProcessing

Post by hugbug » 01 May 2013, 20:01

r657: all ID fields including NZBID are now persistent and remain their values after restart.

When using please make a version check with RPC-method "version()". You need either "nzbget-11.0" (this is 11.0 stable then) or "nzbget-11.0-testing-r657" (at least 657) or "nzbget-11.0-testing" (without rxxx-part, this is how version is printed in windows releases, in this case you can't be sure if it is at least r657 but just assume it is).

The passing of NZBID to pp-script is not yet implemented but will be added soon.

clintonhall
Posts: 449
Joined: 15 Dec 2012, 01:52
Location: Australia
Contact:

Re: NZBID in PostProcessing

Post by clintonhall » 01 May 2013, 22:08

Thanks hugbug.

I am using a Parameter "couchpotato" in my post processing scripts and I made some changes that have been implemented in CouchPotato whereby we write a unique I'd into the database and then send to NZBGet as Parameter "couchpotato"
So everything is working at this time...

Next time we need to tweak this we will probably go back to the NZBID. :D

From my end.... All downloads have been working great with v11 testing, using multiple pp scripts and using this couchpotato parameter in and from CouchPotato..... I'm loving it and my NAS is enjoying the extra available CPU ;)

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

Re: NZBID in PostProcessing

Post by hugbug » 02 May 2013, 07:06

clintonhall wrote:Next time we need to tweak this we will probably go back to the NZBID. :D
Since it's already implemented I would stick with pp-parameter because it's already works and is compatible with older nzbget versions.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest