ziped nzb files

Get help, report and discuss bugs.
ruede2000
Posts: 1
Joined: 29 Sep 2008, 23:22

ziped nzb files

Post by ruede2000 » 29 Sep 2008, 23:25

soooooooo hugbug made an update

works fine.

how is strcat() managed with #!/bin/sh? (something renames the zip files to *.processed and i wanted to cat that .processed to the $NzbFile var.



anyway did it a bit unclean but it works and fits my needs :) (no error report what so ever ^^)

nzbprocess.sh:

#!/bin/sh

DownloadDir=$1
NzbFile=$2

cd "$DownloadDir"
unzip "$NzbFile" *.[nN][zZ][bB]
rm *.processed

greetings

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

Re: ziped nzb files

Post by hugbug » 30 Sep 2008, 06:34

Thanks for your feedback.

NZBGet calls nzbprocess-script for every file witch is not ended with ".processed", ".queued" or ".error". if the file was an nzb-file, it queue it and rename to ".queued" (or ".error", if something goes wrong). Other files are renamed to ".processed". That's to prevent the calling of script for the same file on next directory scan.

If you don't need the original zip/rar and don't like the ".processed"-file to stay you can just delete the original file from the script. Of cause you need to check the file extension before, to not delete nzb-files :)

I'm not good at script programming, even doesn't know how to check the extension :oops:

Hope someone with skills (dalrun and ydrol, are you hearing? :)) can improve the script.

What I like the script to do:
  • extract nzb-files from zip and rar files. Not all files, but only nzb-files;
  • touch extracted files if the date is in a future; it can touch all extracted files, but if it could touch only bad files, it would be even better;
  • optionally delete the original zip/rar file;
  • optionally check the length of name of extracted file, and if it is smaller than the name of zip/rar-file, use the name from zip/rar file. If you wonder why, sometimes downloaded files have unmeaning (short) names and I rename them by saving from browser. However the packed files inside archives still have the same short bad names.

dalrun
Posts: 170
Joined: 09 Sep 2008, 17:12
Contact:

Re: ziped nzb files

Post by dalrun » 12 Oct 2008, 04:09

hugbug wrote:If you don't need the original zip/rar and don't like the ".processed"-file to stay you can just delete the original file from the script.
Doing that generates "ERROR Could not rename file /foo.zip to /foo.zip.processed! Errcode: 2"

As an aside, NzbProcess is sending the directory with a trailing slash and PostProcess sends a double slash (dir//cat IIRC).

Is there a site that's packing nzbs in rar files?

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

Re: ziped nzb files

Post by hugbug » 12 Oct 2008, 09:19

dalrun wrote:Doing that generates "ERROR Could not rename file /foo.zip to /foo.zip.processed! Errcode: 2"
May be because directory is opened for listing in nzbget. I'll look into it.
dalrun wrote:As an aside, NzbProcess is sending the directory with a trailing slash and PostProcess sends a double slash (dir//cat IIRC).
Hmm, I have different results. NzbProcess sends with trailing slash:

Code: Select all

[DETAIL] NZB-Process: ============================
[DETAIL] NZB-Process: /home/user/download/nzbprocess.sh
[DETAIL] NZB-Process: /home/user/download/nzb/
[DETAIL] NZB-Process: /home/user/download/nzb/Moyea-partest.nzb
[DETAIL] NZB-Process: ============ END ================
PostProcess sends without slash:

Code: Select all

DETAIL  Post-Process: ============================
DETAIL  Post-Process: /home/user/download/postprocess.sh
DETAIL  Post-Process: /home/user/download/dst/Moyea-partest
DETAIL  Post-Process: /home/user/download/nzb/Moyea-partest.nzb
DETAIL  Post-Process: /home/user/download/dst/Moyea-partest/Moyea SWF to iPhone Converter V2.        4.vol1+2.PAR2
DETAIL  Post-Process: 2
DETAIL  Post-Process: 1
DETAIL  Post-Process: 0
DETAIL  Post-Process: ============ END ================
PostProcess makes it correct (without slash), nzbprocess - not. I'll fix it with nzbprocess.
dalrun wrote:Is there a site that's packing nzbs in rar files?
Merlin's Portal packs rars.

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

Re: ziped nzb files

Post by hugbug » 12 Oct 2008, 11:52

dalrun wrote: Doing that generates "ERROR Could not rename file /foo.zip to /foo.zip.processed! Errcode: 2"
Fixed in r240.
PostProcess makes it correct (without slash), nzbprocess - not. I'll fix it with nzbprocess.
Fixed in r239. Now nzbprocess also does not have trailing slash.

dalrun
Posts: 170
Joined: 09 Sep 2008, 17:12
Contact:

Re: ziped nzb files

Post by dalrun » 12 Oct 2008, 19:46

hugbug wrote:Hmm, I have different results.
It looks like the PostProcess DestDir//nzb-name slashes got fixed since I last checked. Thanks for removing the trailing slash from NzbProcess directory.
hugbug wrote:Merlin's Portal packs rars
While I'm not impressed by their layout (prefer nzbsrus and nzbmatrix, wish I could have the best of both), I've added unrar to PPWeb NzbProcess (next release).
hugbug wrote:What I like the script to do:
If a Perl script is acceptable, I could probably pull the needed subs from the PPWeb script. Since I haven't heard a good reason for keeping anything but the nzb, PPWeb always deletes the zips/rars and any other files (e.g. nfos included in nzbmatrix zips). I'm not sure what would be gained by checking the timestamp before touching the nzb (PPWeb touches all extracted nzbs). PPWeb always replaces the extracted-name with the archive-name (nzbmatrix nzb-names are all numerical).

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

Re: ziped nzb files

Post by hugbug » 12 Oct 2008, 20:38

dalrun wrote: If a Perl script is acceptable
Although I would prefer a bash-script, but if you can reuse code from PPWeb, that make sense of cause.
I did not tried perl on my router yet, but I hope it works :).
dalrun wrote: I'm not sure what would be gained by checking the timestamp before touching the nzb (PPWeb touches all extracted nzbs).
Touching all files is OK.
dalrun wrote: PPWeb always replaces the extracted-name with the archive-name (nzbmatrix nzb-names are all numerical).
Also OK for me.

Thanks, Dave.

dalrun
Posts: 170
Joined: 09 Sep 2008, 17:12
Contact:

Re: ziped nzb files

Post by dalrun » 13 Oct 2008, 04:42

hugbug wrote:Although I would prefer a bash-script


Maybe someone else will post something, Perl is the only language I have half a clue about. If $ perl -v and $ nzbprocess.pl talk back, you should be fine.
Attachments
nzbprocess.pl.tar.gz
(841 Bytes) Downloaded 134 times

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

Re: ziped nzb files

Post by hugbug » 13 Oct 2008, 08:14

Works perfect. Thank you.

neilt0
Posts: 261
Joined: 10 Sep 2008, 19:11

Re: ziped nzb files

Post by neilt0 » 13 Oct 2008, 19:57

Is there a way of allowing upload of zipped or rar'd files via the web interface?

This would be particularly useful when sending NZBs over a remote connection.

Thanks.

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests