Welcome, Guest
Python Scripts for ComicRack

TOPIC: Sabnzbd post-processing script

Re: Sabnzbd post-processing script 5 years 3 days ago #27530

  • manders2600
  • manders2600's Avatar
  • Offline
  • Senior Boarder
  • Posts: 56
  • Thank you received: 8
  • Karma: 9
Oh thank god, lol.

I was pouring through stackoverflow trying to figure out how to dynamically escape the parentheses and special characters for each file. Haha, this is waaay better.

Thanks, I'll give it a go!
The administrator has disabled public write access.

Re: Sabnzbd post-processing script 5 years 3 days ago #27532

  • manders2600
  • manders2600's Avatar
  • Offline
  • Senior Boarder
  • Posts: 56
  • Thank you received: 8
  • Karma: 9
Okay, there are now two issues puzzling me at the moment, and I think if we can resolve these, this script should work:

1. When running this script on a ".cbz" file, everything seems to work until the actual tagging script is run, at which point it returns the error:
Sorry, but /share/comics/process/THYR/temp/Action Comics 06 (2012) (Minutemen-DTs).cbz  is not a comic archive!
However, when I simply run the comictagger script with the same options on the same file, in the same folder, it works perfectly. I should note that I changed one part of this:
subprocess.Popen( [ comictaggercommand, "-s", "-t", "cr", "-f", "-o"  f ] )
by adding a comma after the "-o" to fix a syntax error, so I'm not sure if that is the issue.

2. When running on a ".cbr" file, it seems as though it does not see the file to unrar. I have confirmed that it correctly takes all the steps up through:
os.makedirs( unrar_folder )
However, after this, it returns the response:
UNRAR 4.00 beta 3 freeware      Copyright (c) 1993-2010 Alexander Roshal

Cannot open /share/comics/process/THYR/temp/Action Comics 06 (2012) (Minutemen-DTs).rar
No such file or directory
No files to extract
	zip warning: name not matched: *

zip error: Nothing to do! (try: zip -rm /share/comics/process/THYR/temp/Action Comics 06 (2012) (Minutemen-DTs).zip . -i *)
Last Edit: 5 years 3 days ago by manders2600.
The administrator has disabled public write access.

Re: Sabnzbd post-processing script 5 years 3 days ago #27534

  • manders2600
  • manders2600's Avatar
  • Offline
  • Senior Boarder
  • Posts: 56
  • Thank you received: 8
  • Karma: 9
Updated the original bash script with Mac OSX path and ComicBookLover tagging.
The administrator has disabled public write access.

Re: Sabnzbd post-processing script 5 years 3 days ago #27548

  • ComicTagger
  • ComicTagger's Avatar
  • Offline
  • Senior Boarder
  • Posts: 43
  • Thank you received: 13
  • Karma: 7
OK, I feel bad, I threw you into the Python waters with broken code. Sorry!

I just went through the python script version on your github, and tuned it up, and actually tested it this time, at least on linux.

It should be easier to get running on windows now, as I removed the dependency on the "file" command. Now windows users just need "unrar.exe" and "zip.exe" to run, with download links in the script comments. If those aren't there, it'll just skip the rar->zip conversion, and just run comictagger on the cbz files.

Good luck!
Attachments:
The administrator has disabled public write access.

Re: Sabnzbd post-processing script 5 years 2 days ago #27568

  • manders2600
  • manders2600's Avatar
  • Offline
  • Senior Boarder
  • Posts: 56
  • Thank you received: 8
  • Karma: 9
Booooom Shaka-Laka!!!!!!

Works to perfection.

Awesome, thanks so much!!!!!!!

Seriously, no worries about the broken code. Even though I wasn't able to fix it, I learned a lot of ancillary stuff about python trying. It actually seems like something I will want to learn "from the ground up", so to speak, and this little exercise has been a pretty cool intro.

I'll set up a Windows Sabnzbd first thing tomorrow, and make sure everything works there.

My next steps will be to add an option to call the renaming feature from comictagger as well as an option to call the mylar post-processing script.


Thanks again!!!!
The administrator has disabled public write access.

Re: Sabnzbd post-processing script 5 years 2 days ago #27575

  • ComicTagger
  • ComicTagger's Avatar
  • Offline
  • Senior Boarder
  • Posts: 43
  • Thank you received: 13
  • Karma: 7
Yeah, Python is a really powerful language, and it can be fun, since you do can complex things easily.

I was thinking (and this would be a good Python exercise for you) you can remove the dependency on external zip command in the python version of the script. After the unrar-ing, all the files are in a sub-sub-folder. Instead of calling zip/zip.exe, you can just recursively iterate over each file, and use the already available "zipfile" class to build up the new zip file.

For examples, just google for examples with something like "python create zip file recursively"

With this, then Windows users just need Python and WinRAR unrar.exe shareware tool installed.

Cheers!
The administrator has disabled public write access.

Re: Sabnzbd post-processing script 4 years 11 months ago #27695

  • manders2600
  • manders2600's Avatar
  • Offline
  • Senior Boarder
  • Posts: 56
  • Thank you received: 8
  • Karma: 9
ComicTagger wrote:
Yeah, Python is a really powerful language, and it can be fun, since you do can complex things easily.

I was thinking (and this would be a good Python exercise for you) you can remove the dependency on external zip command in the python version of the script. After the unrar-ing, all the files are in a sub-sub-folder. Instead of calling zip/zip.exe, you can just recursively iterate over each file, and use the already available "zipfile" class to build up the new zip file.

For examples, just google for examples with something like "python create zip file recursively"

With this, then Windows users just need Python and WinRAR unrar.exe shareware tool installed.

Cheers!

That's a really good idead. I looked at the "zipfile" stuff, but I did a shutil.make_archive instead, since it seemed a little more straightforward. Is there any disadvantage to this approach?
Last Edit: 4 years 11 months ago by manders2600.
The administrator has disabled public write access.

Re: Sabnzbd post-processing script 4 years 11 months ago #27706

  • ComicTagger
  • ComicTagger's Avatar
  • Offline
  • Senior Boarder
  • Posts: 43
  • Thank you received: 13
  • Karma: 7
Nice! I was unaware of the "shutil.make_archive" function. That's perfect, since the unrar goes into a dedicated folder.
The administrator has disabled public write access.

Re: Sabnzbd post-processing script 4 years 10 months ago #28971

  • 600WPMPO
  • 600WPMPO's Avatar
  • Offline
  • Moderator
  • Posts: 3788
  • Thank you received: 557
  • Karma: 233
I tried this script but could not make it work. I have Comictagger & winRar installed in their default directories on a Windows 8 x64 setup. I've replaced Mylar's comicrn.py script with the one from this script. I've checked that the paths to Comictagger & WinRar are correct. I've placed the required script in SabNZB's post-processing directory. I've pointed the script in SabNZB's config dialog to point to this one.

I don't know how (and whether) to make the script executable.

When I download a file via Mylar & SabNZB, it just stays in its directory & the script doesn't seem to do anything.

Please help me...
Now Playing: The ComicRack Manual (Online)

See my new comics & gadgets on: Tumblr!
The administrator has disabled public write access.

Re: Sabnzbd post-processing script 4 years 10 months ago #29129

  • kev0153
  • kev0153's Avatar
  • Offline
  • Junior Boarder
  • Posts: 24
  • Thank you received: 3
  • Karma: 0
Hi,

Tried this out and I'm getting an error

Traceback (most recent call last):
File "/home/kev/.sickbeard/autoProcessTV/ComicRN.py", line 14, in <module>
cmtagmylar (sys.argv[1], sys.argv[3])
TypeError: 'module' object is not callable

Made everything executable so not sure

Thanks
The administrator has disabled public write access.
Time to create page: 0.215 seconds

Who's Online

We have 224 guests and 4 members online