evilhero / mylar

An automated Comic Book downloader (cbr/cbz) for use with SABnzbd, NZBGet and torrents
GNU General Public License v3.0
976 stars 169 forks source link

Metadata and comictagger #95

Closed manders2600 closed 10 years ago

manders2600 commented 11 years ago

First off, thanks so much for this awesome program! I know it's probably a lot of work, but I really appreciate it!

Second, I am wondering if there is any thoughts in the future of adding support for reading/writing comicinfo.xml files in either the cbz files (as comicrack reads them) or in the zip comment (as comicbooklover reads them)? Since Comictagger has been developed as a python script, the only requirement would seem to be to use data directly from mylar, rather than having to enter it by hand or separately scrape with Comicrack.

I assume it would need to do the following:

  1. Check to make sure all CBR files are actually RAR archives (checktype.pl, using malor89's perl scripts http://comicrack.cyolito.com/media/kunena/attachments/365/malor89s%20perl%20scripts%202011_02_16.zip )
  2. Convert .cbr to .cbz files:

    mv comic.cbr comic.rar unrar x comic.rar zip -r comic.zip /comic mv comic.zip comic.cbz

  3. Tag with comictagger.py (can set command line options for every data point)

    eg: comictagger.py -s -t cr -m "series=Batman, publisher=DC Comics" comic.cbz

    would save (-s) the series and publisher metadata (-m "series=Batman, publisher=DC Comics") to a comicrack tag (-t cr)

    http://code.google.com/p/comictagger/

evilhero commented 11 years ago

as an fyi, extra script processing is coming soon which will allow you to poinr Mylar to this kind of script to follow post- processing Just near the end of finishing a rewrite of the post-processing and it should be good to go :)

manders2600 commented 11 years ago

Awesome!

Currently, I have added the necessary lines to the ComicRN script to begin my cmtagmylar script just prior to the autoprocessComic script, so that the comic is converted and tagged prior to being moved or renamed.

Will the extra script functionality allow for this, or is it more like Sickbeard in that it only allows further scripts to run after the autoprocessTV script? If the latter, does it pass arguments detailing the new name of the comic if it has been renamed?

manders2600 commented 11 years ago

Also, will it be able to pass information about the comic (eg: comicvine id) to extra scripts as arguments, and/or receive information about the comic after the extra script runs?

The reason being, it would be less redundant to use comictagger to insert metadata based on what was already gotten from mylar. And it would also be useful to verify that the correct comic was downloaded by running the comictagger cover image verification.

Thanks again for this awesome program!

evilhero commented 11 years ago

The extra script functionality is included now in latest development build. Mylar's post-processing has to run first and then an additional script can be run thereafter. Currently it only passes the nzb name and nzb folder path, but I can add in more info easily enough - I just used those two initially because they were already n use by the module.

manders2600 commented 11 years ago

Cool. I would assume (though I haven't played with it just yet) that any additional script would need the new path and file name of the comic, passed as arguments, if that comic has been sorted or renamed, simply because it would need to know what file to act on.

Though, like I said, I haven't played with it, as I'm traveling back home today. I should be able to take a look at some things tonight, but it would also be extremely useful to be able to pass each bit of metadata to the extra script as arguments/variables.

Thanks!

manders2600 commented 11 years ago

I took a look at this, and it should work perfectly with my post-processing script if I make some rewrites, though I am a bit reticent to do so. The tricky part is that this would ideally happen in the reverse order if this functionality (or something similar) were added to mylar base.

At least as I’m looking at it, and let me know if I’m off-base here, it would be preferable to have the cbrs converted to cbzs and tags inserted prior to renaming, for all comics in the downloaded folder. The idea being that in future builds of mylar the information for renaming and processing could possibly be taken directly from the metadata tags themselves. This would enable the script to use metadata collected from mylar if the comics were downloaded by mylar itself, but would also allow for tagging, renaming, and processing by mylar (via ComicRN.py) if the comics were downloaded directly as an nzb, or even if the comics lived in a preexisting folder.

In addition, this would allow for the scanning in of existing, tagged libraries, regardless of their folder structure.

In other words, if there were a second option (something like “Pre-Scripts”) for a user to add a script to be executed prior to autoprocessComics.py, this might make things a little more future-proof?

For my own purposes, I added a line in ComicRN.py to call my cmtagmylar.py script prior to autoprocessComics.py, as I’m nowhere near competent enough in python to make the kind of modifications it looks like you made, haha.

manders2600 commented 11 years ago

Just reread my previous post, and to be clear on the reasoning, my cmtagmylar.py post-processing script currently checks, converts, and tags all cbr and cbz files in the downloaded folder. So, if you download 15 random comics in one nzb, they all get tagged, whereas if this occurred after autoprocessComics.py ran, obviously it would need to be restricted to the single file (so as not to run through all the files in the destination folder).

apastuszak commented 11 years ago

I am trying to use the existing scripts from manders2600 and they are not working for me.

I keep getting the following error:

Traceback (most recent call last): File "C:\SickBeard-win32-alpha-build499\autoProcessTV\ComicRN.py", line 14, in cmtagmylar (sys.argv[1], sys.argv[3]) TypeError: 'module' object is not callable

The cbr is converted to a cbz and it's tagged properly, but sickbeard never gets updated.

manders2600 commented 11 years ago

Hey, I've been a bit absent from here in the last couple of weeks, some family issues came up and I kind of had to drop everything. I'll be back in action more this weekend (so much to catch up on in RL). Are you using the dev or master version of those scripts?

apastuszak commented 11 years ago

I am using the master. I'd be willing to try dev.

On Thu, Jan 31, 2013 at 1:30 PM, manders2600 notifications@github.comwrote:

Hey, I've been a bit absent from here in the last couple of weeks, some family issues came up and I kind of had to drop everything. I'll be back in action more this weekend (so much to catch up on in RL). Are you using the dev or master version of those scripts?

— Reply to this email directly or view it on GitHubhttps://github.com/evilhero/mylar/issues/95#issuecomment-12957813.

apastuszak commented 11 years ago

I tried using dev in the pre and post processing and it doesn't seem to do anything at all. I just get the cbr sitting in the folder.

manders2600 commented 11 years ago

Okay, I should be able to test6 this out tonight, but can you post the output from sabnzbd when running the dev script as a pre-script? Thanks!

apastuszak commented 11 years ago

You want sab output or mylar output? Doesn't the dev script run in mylar?

On Fri, Feb 1, 2013 at 1:03 PM, manders2600 notifications@github.comwrote:

Okay, I should be able to test6 this out tonight, but can you post the output from sabnzbd when running the dev script as a pre-script? Thanks!

— Reply to this email directly or view it on GitHubhttps://github.com/evilhero/mylar/issues/95#issuecomment-13005971.

manders2600 commented 11 years ago

The output from sab (scriptlog) for that particular nzb should have all of the post-processing stuff.

apastuszak commented 11 years ago

Here ya go!

Loading config from C:\SickBeard-win32-alpha-build499\autoProcessTV\autoProcessComics.cfg Opening URL: http://localhost:8090/post_process?nzb_name=The+Walking+Dead+094+%282012%29+%28Digital+1920px%29+%28Zone-Empire%29&nzb_folder=D%3A%5CComics%5CThe+Walking+Dead+094+%282012%29+%28Digital+1920px%29+%28Zone-Empire%29 nzb name: The Walking Dead 094 (2012) (Digital 1920px) (Zone-Empire)

nzb folder: D:\Comics\The Walking Dead 094 (2012) (Digital 1920px) (Zone-Empire)

nzbname: The.Walking.Dead.094.(2012).(Digital.1920px).(Zone-Empire)

Issue Number: 94

issue detected greater than 10, but less than 100

Zero level supplement set to none.Issue will be set as : 94

Issue Year: 2012

Publisher: Image

Series: The Walking Dead

Year: 2003

Comic Location: D:\Comics\The Walking Dead-(2003)

initiating pre script detection.

mylar.PRE_SCRIPTS : C:\SickBeard-win32-alpha-build499\autoProcessTV\cmtagmylar.py

pre script detected...enabling: C:\SickBeard-win32-alpha-build499\autoProcessTV\cmtagmylar.py

cmd to be executed: ['C:SickBeard-win32-alpha-build499autoProcessTVcmtagmylar.py', 'The Walking Dead 094 (2012) (Digital 1920px) (Zone-Empire)', 'D:\Comics\The Walking Dead 094 (2012) (Digital 1920px) (Zone-Empire)', "{'seriesmeta': [{'publisher': u'Image', 'issueid': u'317616', 'name': u'The Walking Dead', 'issueyear': u'2012', 'comicyear': u'2003', 'issue': u'94.00', 'comicid': u'18166'}]}"]

Executing command ['C:SickBeard-win32-alpha-build499autoProcessTVcmtagmylar.py', 'The Walking Dead 094 (2012) (Digital 1920px) (Zone-Empire)', 'D:\Comics\The Walking Dead 094 (2012) (Digital 1920px) (Zone-Empire)', "{'seriesmeta': [{'publisher': u'Image', 'issueid': u'317616', 'name': u'The Walking Dead', 'issueyear': u'2012', 'comicyear': u'2003', 'issue': u'94.00', 'comicid': u'18166'}]}"]

Absolute path to script: C:SickBeard-win32-alpha-build499autoProcessTVcmtagmylar.py

Unable to run pre_script: ['C:SickBeard-win32-alpha-build499autoProcessTVcmtagmylar.py', 'The Walking Dead 094 (2012) (Digital 1920px) (Zone-Empire)', 'D:\Comics\The Walking Dead 094 (2012) (Digital 1920px) (Zone-Empire)', "{'seriesmeta': [{'publisher': u'Image', 'issueid': u'317616', 'name': u'The Walking Dead', 'issueyear': u'2012', 'comicyear': u'2003', 'issue': u'94.00', 'comicid': u'18166'}]}"]

Original Filename: The Walking Dead 094 (2012) (Digital 1920px) (Zone-Empire).cbr

Original Extension: .cbr

New Filename: The Walking Dead 94 (2012)

Source:D:\Comics\The Walking Dead 094 (2012) (Digital 1920px) (Zone-Empire)/The Walking Dead 094 (2012) (Digital 1920px) (Zone-Empire).cbr

Destination:D:\Comics\The Walking Dead-(2003)/The Walking Dead 94 (2012).cbr

Removed temporary directory : D:\Comics\The Walking Dead 094 (2012) (Digital 1920px) (Zone-Empire)

Post Processing SUCCESSFULL!

manders2600 commented 11 years ago

Okay, are you using the "master" branch of mylar? The issue with Windows in the past has been that it does not handle the "/"s. The dev build has this fix: https://github.com/evilhero/mylar/issues/141 which I have not tested, but will be testing tonight.

You can see the part in the output that reads:

cmd to be executed: ['C:SickBeard-win32-alpha-build499autoProcessTVcmtagmylar.py',

. . . does not have the back-slashes for the directories.

apastuszak commented 11 years ago

I am using the master branch. I'll switch over to dev when I get home tonight.

apastuszak commented 11 years ago

Switches to dev. It has a different set of issues:

Loading config from C:\SickBeard-win32-alpha-build499\autoProcessTV\autoProcessComics.cfg Opening URL: http://localhost:8090/post_process?nzb_name=Chew+029+%282012%29+%28Digital%29+%28Zone-Empire%29.cbr&nzb_folder=D%3A%5CComics%5CChew+029+%282012%29+%28Digital%29+%28Zone-Empire%29.cbr nzb name: Chew 029 (2012) (Digital) (Zone-Empire).cbr

nzb folder: D:\Comics\Chew 029 (2012) (Digital) (Zone-Empire).cbr

Removed extension from nzb: .cbr

nzbname: Chew.029.(2012).(Digital).(Zone-Empire)

Issue Number: 29

issue detected greater than 10, but less than 100

Zero level supplement set to none.Issue will be set as : 29

Issue Year: 2012

Publisher: Image

Series: Chew

Year: 2009

Comic Location: D:\Comics/Chew-(2009)

initiating pre script detection.

mylar.PRE_SCRIPTS : C:\SickBeard-win32-alpha-build499\autoProcessTV\cmtagmylar.py

pre script detected...enabling: C:\SickBeard-win32-alpha-build499utoProcessTV\cmtagmylar.py

cmd to be executed: ['C:SickBeard-win32-alpha-build499\x07utoProcessTVcmtagmylar.py', 'Chew 029 (2012) (Digital) (Zone-Empire).cbr', 'D:\Comics\Chew 029 (2012) (Digital) (Zone-Empire).cbr', "{'seriesmeta': [{'publisher': u'Image', 'issueid': u'362195', 'name': u'Chew', 'issueyear': u'2012', 'comicyear': u'2009', 'issue': u'29.00', 'comicid': u'26611'}]}"]

Executing command ['C:SickBeard-win32-alpha-build499\x07utoProcessTVcmtagmylar.py', 'Chew 029 (2012) (Digital) (Zone-Empire).cbr', 'D:\Comics\Chew 029 (2012) (Digital) (Zone-Empire).cbr', "{'seriesmeta': [{'publisher': u'Image', 'issueid': u'362195', 'name': u'Chew', 'issueyear': u'2012', 'comicyear': u'2009', 'issue': u'29.00', 'comicid': u'26611'}]}"]

Absolute path to script: C:SickBeard-win32-alpha-build499utoProcessTVcmtagmylar.py

Unable to run pre_script: ['C:SickBeard-win32-alpha-build499\x07utoProcessTVcmtagmylar.py', 'Chew 029 (2012) (Digital) (Zone-Empire).cbr', 'D:\Comics\Chew 029 (2012) (Digital) (Zone-Empire).cbr', "{'seriesmeta': [{'publisher': u'Image', 'issueid': u'362195', 'name': u'Chew', 'issueyear': u'2012', 'comicyear': u'2009', 'issue': u'29.00', 'comicid': u'26611'}]}"]

Original Filename: Chew 029 (2012) (Digital) (Zone-Empire).cbr

Original Extension: .cbr

New Filename: Chew 29 (2012)

Source:D:\Comics\Chew 029 (2012) (Digital) (Zone-Empire).cbr\Chew 029 (2012) (Digital) (Zone-Empire).cbr

Destination:D:\Comics/Chew-(2009)/Chew 29 (2012).cbr

Removed temporary directory : D:\Comics\Chew 029 (2012) (Digital) (Zone-Empire).cbr

Post Processing SUCCESSFULL!

manders2600 commented 11 years ago

Yeah, I haven't gotten a chance to tesdt this out, but I'll be able to do it this weekend. Obviously, the back-slashes are still an issue in Windows:

cmd to be executed: ['C:SickBeard-win32-alpha-build499\x07utoProcessTVcmtagmylar.py'

Absolute path to script: C:SickBeard-win32-alpha-build499utoProcessTVcmtagmylar.py

I'll try looking at some ways to work around this for Windows, but this should be an issue with all pre- and post-scripts run in Windows.

Perhaps, try "C:\SickBeard-win32-alpha-build499\autoProcessTV\cmtagmylar.py" (double the back-slashes) in the pre-script path.

evilhero commented 11 years ago

actually maybe try this, in PostProcessor.py:

line 95 (add the # to comment out the line): currentScriptName = str(mylar.PRE_SCRIPTS).decode("string_escape")

to:

# currentScriptName = str(mylar.PRE_SCRIPTS).decode("string_escape")

and....

line 98: script_cmd = shlex.split(currentScriptName) + [str(nzb_name), str...

add posix=False: script_cmd = shlex.split(currentScriptName, posix=False) + [str(nzb_name), str....

I don't run a windows machine with Mylar so I can't really test it, but the losing of the '\' is inherit in the shlex module apparently, and forcing the posix mode to False seems to stop it from happening.

I can commit it, but I'd rather not be doing hunches without some tests of some kind (as this has been a few iterations that haven't worked thus far I believe).

apastuszak commented 11 years ago

The frustrating part for me was that the server in my house ALWAYS ran Linux. My house was always Linux and Mac. I decided to leave the Windows 7 preload this time, rather than deal with UEFI boot issues.... Ah well....

Let me go make the changes.

apastuszak commented 11 years ago

Ok, made the changes. Looks like it threw a 500 error:

Loading config from C:\SickBeard-win32-alpha-build499\autoProcessTV\autoProcessComics.cfg Opening URL: http://localhost:8090/post_process?nzb_name=Chew+026+%282012%29+%28Digital%29+%28Zone-Empire%29.cbr&nzb_folder=D%3A%5CComics%5CChew+026+%282012%29+%28Digital%29+%28Zone-Empire%29.cbr <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

``` 500 Internal Server Error ``` ```

500 Internal Server Error

The server encountered an unexpected condition which prevented it from fulfilling the request.

Traceback (most recent call last):
```

  File "C:\mylar\cherrypy_cprequest.py", line 645, in respond

```
response.body = self.handler()
```

  File "C:\mylar\cherrypy\lib\encoding.py", line 188, in **call**

```
self.body = self.oldhandler(*args, **kwargs)
```

  File "C:\mylar\cherrypy_cpdispatch.py", line 29, in **call**

```
return self.callable(*self.args, **self.kwargs)
```

  File "C:\mylar\mylar\webserve.py", line 243, in post_process

```
result = PostProcess.Process()
```

  File "C:\mylar\mylar\PostProcessor.py", line 298, in Process

```
self._run_pre_scripts(nzbn, nzbf, seriesmetadata )
```

  File "C:\mylar\mylar\PostProcessor.py", line 96, in _run_pre_scripts

```
self._log("pre script detected...enabling: " + str(currentScriptName), logger.DEBUG)
```

NameError: global name 'currentScriptName' is not defined

```
Powered by CherryPy 3.2.0
```
evilhero commented 11 years ago

Sorry that was my mistake, when I said to comment out line 95, I should've said to just remove the .decode portion, so it should have been:

(remove the # to uncomment out the line (my mistake), and remove the whole .decode portion as follows):

line 95 :

# currentScriptName = str(mylar.PRE_SCRIPTS).decode("string_escape")

to:

currentScriptName = str(mylar.PRE_SCRIPTS)

apastuszak commented 11 years ago

Now I get 4 backslashes.

Loading config from C:\SickBeard-win32-alpha-build499\autoProcessTV\autoProcessComics.cfg Opening URL: http://localhost:8090/post_process?nzb_name=Chew+027+%282011%29+%28Harkonnen-DCP%29.cbz&nzb_folder=D%3A%5CComics%5CChew+027+%282011%29+%28Harkonnen-DCP%29.cbz nzb name: Chew 027 (2011) (Harkonnen-DCP).cbz

nzb folder: D:\Comics\Chew 027 (2011) (Harkonnen-DCP).cbz

Removed extension from nzb: .cbz

nzbname: Chew.027.(2011).(Harkonnen-DCP)

Issue Number: 27

issue detected greater than 10, but less than 100

Zero level supplement set to none.Issue will be set as : 27

Issue Year: 2011

Publisher: Image

Series: Chew

Year: 2009

Comic Location: D:\Comics/Chew-(2009)

initiating pre script detection.

mylar.PRE_SCRIPTS : C:\mylar\cmtagmylar.py

pre script detected...enabling: C:\mylar\cmtagmylar.py

cmd to be executed: ['C:\mylar\cmtagmylar.py', 'Chew 027 (2011) (Harkonnen-DCP).cbz', 'D:\Comics\Chew 027 (2011) (Harkonnen-DCP).cbz', "{'seriesmeta': [{'publisher': u'Image', 'issueid': u'270477', 'name': u'Chew', 'issueyear': u'2011', 'comicyear': u'2009', 'issue': u'27.00', 'comicid': u'26611'}]}"]

Executing command ['C:\mylar\cmtagmylar.py', 'Chew 027 (2011) (Harkonnen-DCP).cbz', 'D:\Comics\Chew 027 (2011) (Harkonnen-DCP).cbz', "{'seriesmeta': [{'publisher': u'Image', 'issueid': u'270477', 'name': u'Chew', 'issueyear': u'2011', 'comicyear': u'2009', 'issue': u'27.00', 'comicid': u'26611'}]}"]

Absolute path to script: C:\mylar\cmtagmylar.py

Unable to run pre_script: ['C:\mylar\cmtagmylar.py', 'Chew 027 (2011) (Harkonnen-DCP).cbz', 'D:\Comics\Chew 027 (2011) (Harkonnen-DCP).cbz', "{'seriesmeta': [{'publisher': u'Image', 'issueid': u'270477', 'name': u'Chew', 'issueyear': u'2011', 'comicyear': u'2009', 'issue': u'27.00', 'comicid': u'26611'}]}"]

Original Filename: Chew 027 (2011) (Harkonnen-DCP).cbz

Original Extension: .cbz

New Filename: Chew 27 (2011)

Source:D:\Comics\Chew 027 (2011) (Harkonnen-DCP).cbz\Chew 027 (2011) (Harkonnen-DCP).cbz

Destination:D:\Comics/Chew-(2009)/Chew 27 (2011).cbz

Removed temporary directory : D:\Comics\Chew 027 (2011) (Harkonnen-DCP).cbz

Post Processing SUCCESSFULL!

apastuszak commented 11 years ago

Scratch that. It looks like it worked.

apastuszak commented 11 years ago

And I spoke too soon....

I'm ready to try and stick Linux on this thing....

Loading config from C:\SickBeard-win32-alpha-build499\autoProcessTV\autoProcessComics.cfg Opening URL: http://localhost:8090/post_process?nzb_name=Chew+022+%282011%29+%28digital-Empire%29.cbr&nzb_folder=D%3A%5CComics%5CChew+022+%282011%29+%28digital-Empire%29.cbr nzb name: Chew 022 (2011) (digital-Empire).cbr

nzb folder: D:\Comics\Chew 022 (2011) (digital-Empire).cbr

Removed extension from nzb: .cbr

nzbname: Chew.022.(2011).(digital-Empire)

Issue Number: 22

issue detected greater than 10, but less than 100

Zero level supplement set to none.Issue will be set as : 22

Issue Year: 2011

Publisher: Image

Series: Chew

Year: 2009

Comic Location: D:\Comics/Chew-(2009)

initiating pre script detection.

mylar.PRE_SCRIPTS : C:\mylar\cmtagmylar.py

pre script detected...enabling: C:\mylar\cmtagmylar.py

cmd to be executed: ['C:\mylar\cmtagmylar.py', 'Chew 022 (2011) (digital-Empire).cbr', 'D:\Comics\Chew 022 (2011) (digital-Empire).cbr', "{'seriesmeta': [{'publisher': u'Image', 'issueid': u'305698', 'name': u'Chew', 'issueyear': u'2011', 'comicyear': u'2009', 'issue': u'22.00', 'comicid': u'26611'}]}"]

Executing command ['C:\mylar\cmtagmylar.py', 'Chew 022 (2011) (digital-Empire).cbr', 'D:\Comics\Chew 022 (2011) (digital-Empire).cbr', "{'seriesmeta': [{'publisher': u'Image', 'issueid': u'305698', 'name': u'Chew', 'issueyear': u'2011', 'comicyear': u'2009', 'issue': u'22.00', 'comicid': u'26611'}]}"]

Absolute path to script: C:\mylar\cmtagmylar.py

Unable to run pre_script: ['C:\mylar\cmtagmylar.py', 'Chew 022 (2011) (digital-Empire).cbr', 'D:\Comics\Chew 022 (2011) (digital-Empire).cbr', "{'seriesmeta': [{'publisher': u'Image', 'issueid': u'305698', 'name': u'Chew', 'issueyear': u'2011', 'comicyear': u'2009', 'issue': u'22.00', 'comicid': u'26611'}]}"]

Original Filename: Chew 022 (2011) (digital-Empire).cbr

Original Extension: .cbr

New Filename: Chew 22 (2011)

Source:D:\Comics\Chew 022 (2011) (digital-Empire).cbr\Chew 022 (2011) (digital-Empire).cbr

Destination:D:\Comics/Chew-(2009)/Chew 22 (2011).cbr

Removed temporary directory : D:\Comics\Chew 022 (2011) (digital-Empire).cbr

Post Processing SUCCESSFULL!

apastuszak commented 11 years ago

What the heck? The cut and paste from the log is not showing the double backslashes.

This block of logfile has double backslashes in it.

Executing command ['C:\mylar\cmtagmylar.py', 'Chew 022 (2011) (digital-Empire).cbr', 'D:\Comics\Chew 022 (2011) (digital-Empire).cbr', "{'seriesmeta': [{'publisher': u'Image', 'issueid': u'305698', 'name': u'Chew', 'issueyear': u'2011', 'comicyear': u'2009', 'issue': u'22.00', 'comicid': u'26611'}]}"]

and

evilhero commented 11 years ago

This might sound stupid but is the pyrhon.exe in your PATH environment? If you can't just type it in in a dos cmd prompt, it wouldn't be able to execute via the script.

apastuszak commented 11 years ago

It is. I'm running 64 bit python.

On Sat, Feb 2, 2013 at 11:17 PM, evilhero notifications@github.com wrote:

This might sound stupid but is the pyrhon.exe in your PATH environment? If you can't just type it in in a dos cmd prompt, it wouldn't be able to execute via the script.

— Reply to this email directly or view it on GitHubhttps://github.com/evilhero/mylar/issues/95#issuecomment-13042162.

apastuszak commented 11 years ago

I think it's time for me to build a Linux VM and do some testing. The machine has 8 GB of RAM. I think I can spare 1 GB for a Fedora or Ubuntu VM.

evilhero commented 11 years ago

I tried something else in the latest development commit - forcing the posix compliancy of the the path...not sure if it works as intended for non-linux users, but the other way wasn't working obviously either.

apastuszak commented 11 years ago

Dumb question.

There is really harm in converting and metadata tagging everything. It's an added value for those that use it, and can safely be ignored for those that don't. Any reason we can't add this feature directly to Mylar?

On Wednesday, February 6, 2013, evilhero wrote:

I tried something else in the latest development commit - forcing the posix compliancy of the the path...not sure if it works as intended for non-linux users, but the other way wasn't working obviously either.

— Reply to this email directly or view it on GitHubhttps://github.com/evilhero/mylar/issues/95#issuecomment-13202684.

evilhero commented 11 years ago

Primarily because of the amount of work it would take to have Mylar actually do it within the program itself, when other 3rd party programs exist that do it already and do it well. Passing the values to the external script (whether pre or post) allows for this type of inclusion. I honestly don't have the inclination to dedicate a few weeks worth of time and energy just to metatagging alone - and you never EVER assume that users want something done to their files without their knowledge simply because they don't use it. I know personally if I don't use something, I don't want it modifying my file(s) in any way, shape or form regardless of it's intention. Giving the users the option to use it or not is always the best practice.

I may try to integrate a program like comictagger into Mylar in a more conventional way, but that's something that I'd need to talk to the developer about and would be aways away at this point in time at least.

apastuszak commented 11 years ago

All very valid points.

On Wed, Feb 6, 2013 at 3:31 PM, evilhero notifications@github.com wrote:

Primarily because of the amount of work it would take to have Mylar actually do it within the program itself, when other 3rd party programs exist that do it already and do it well. Passing the values to the external script (whether pre or post) allows for this type of inclusion. I honestly don't have the inclination to dedicate a few weeks worth of time and energy just to metatagging alone - and you never EVER assume that users want something done to their files without their knowledge simply because they don't use it. I know personally if I don't use something, I don't want it modifying my file(s) in any way, shape or form regardless of it's intention. Giving the users the option to use it or not is always the best practice.

I may try to integrate a program like comictagger into Mylar in a more conventional way, but that's something that I'd need to talk to the developer about and would be aways away at this point in time at least.

— Reply to this email directly or view it on GitHubhttps://github.com/evilhero/mylar/issues/95#issuecomment-13203454.

apastuszak commented 11 years ago

Installed latest dev branch. Here is what SabNZBd shows:

Loading config from C:\SickBeard-win32-alpha-build499\autoProcessTV\autoProcessComics.cfg Opening URL: http://localhost:8090/post_process?nzb_name=The+Walking+Dead+82+%282011%29+%28ScAnarky-CPS%29.cbz&nzb_folder=D%3A%5CComics%5CThe+Walking+Dead+82+%282011%29+%28ScAnarky-CPS%29.cbz <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

``` 500 Internal Server Error ``` ```

500 Internal Server Error

The server encountered an unexpected condition which prevented it from fulfilling the request.

Traceback (most recent call last):
```

  File "C:\mylar\cherrypy_cprequest.py", line 645, in respond

```
response.body = self.handler()
```

  File "C:\mylar\cherrypy\lib\encoding.py", line 188, in **call**

```
self.body = self.oldhandler(*args, **kwargs)
```

  File "C:\mylar\cherrypy_cpdispatch.py", line 29, in **call**

```
return self.callable(*self.args, **self.kwargs)
```

  File "C:\mylar\mylar\webserve.py", line 246, in post_process

```
result = PostProcess.Process()
```

  File "C:\mylar\mylar\PostProcessor.py", line 298, in Process

```
self._run_pre_scripts(nzbn, nzbf, seriesmetadata )
```

  File "C:\mylar\mylar\PostProcessor.py", line 96, in _run_pre_scripts

```
self._log("pre script detected...enabling: " + str(currentScriptName), logger.DEBUG)
```

NameError: global name 'currentScriptName' is not defined

```
Powered by CherryPy 3.2.0
```
tinybilbo commented 11 years ago

"Quote" apastuszak I am trying to use the existing scripts from manders2600 and they are not working for me. I keep getting the following error: Traceback (most recent call last): File "C:\SickBeard-win32-alpha-build499\autoProcessTV\ComicRN.py", line 14, in cmtagmylar (sys.argv[1], sys.argv[3]) TypeError: 'module' object is not callable The cbr is converted to a cbz and it's tagged properly, but sickbeard never gets updated. "EndQuote"

I've been having this problem with my setup as well (Debian Squeeze) - here's my error...

"Running ComicRN.py, the Post-SabNZBd/Mylar script ComicRN.py: converting Iron Man 002 (2013) (Digital) (Zone-Empire).rar to be zip format Traceback (most recent call last): File "/root/.sabnzbd/Scripts/ComicRN.py", line 14, in cmtagmylar (sys.argv[1], sys.argv[3]) TypeError: 'module' object is not callable"

However sabnzbd WAS downloading correctly, and the script WAS unpacking, rezipping, and tagging correctly, It wasn't moving the file and updating in Mylar.

What I could see from the error output, was that that manders2600 ComicRN was trying to RERUN the convert cbr to cbz section of cmtagmylar.py (and not finding a .cbr), and thus crapping out. So I removed line 14 (cmtagmylar (sys.argv[1], sys.argv[3])) from ComicRN, and now everything works, Including displaying correctly in Mylar.

From sabnzbd "Repair [Iron Man 002 (2013) (Digital) (Zone-Empire)] No par2 sets Script Post Processing SUCCESSFULL! (More) Category mylarcomics"

I don't know if removing that line is going affect a download that is already zipped (cbz), because I know nothing about scripting, and can barely follow one... maybe manders2600 can have a look...

If I download a cbz I'll update this thread as to whether it tags and moves correctly

apastuszak commented 11 years ago

Ok, what is the final determination on this? Is this never going to work on Windows. I really need to build a Linux VM to test this on Linux.

apastuszak commented 11 years ago

Latest attempt tonight and here is what I get

Loading config from C:\SickBeard-win32-alpha-build499\autoProcessTV\autoProcessComics.cfg Opening URL: http://localhost:8090/post_process?nzb_name=Uncanny+X-Men+003+%282013%29+%28digital%29+%28Zone-Empire%29&nzb_folder=D%3A%5CComics%5CUncanny+X-Men+003+%282013%29+%28digital%29+%28Zone-Empire%29 nzb name: Uncanny X-Men 003 (2013) (digital) (Zone-Empire)

nzb folder: D:\Comics\Uncanny X-Men 003 (2013) (digital) (Zone-Empire)

nzbname: Uncanny.X-Men.003.(2013).(digital).(Zone-Empire)

Issue Number: 3

issue detected less than 10

Zero level supplement set to none. Issue will be set as : 3

Issue Year: 2013

Publisher: Marvel

Series: Uncanny X-Men

Year: 2013

Comic Location: D:\Comics/Uncanny X-Men-(2013)

initiating pre script detection.

mylar.PRE_SCRIPTS : C:\SickBeard-win32-alpha-build499\autoProcessTV\cmtagmylar.py

pre script detected...enabling: C:\SickBeard-win32-alpha-build499\autoProcessTV\cmtagmylar.py

cmd to be executed: ['C:\SickBeard-win32-alpha-build499\autoProcessTV\cmtagmylar.py', 'Uncanny X-Men 003 (2013) (digital) (Zone-Empire)', 'D:\Comics\Uncanny X-Men 003 (2013) (digital) (Zone-Empire)', "{'seriesmeta': [{'publisher': u'Marvel', 'issueid': u'392362', 'name': 'Uncanny X-Men', 'issueyear': u'2013', 'comicyear': u'2013', 'issue': u'3.00', 'comicid': u'57181'}]}"]

Executing command ['C:\SickBeard-win32-alpha-build499\autoProcessTV\cmtagmylar.py', 'Uncanny X-Men 003 (2013) (digital) (Zone-Empire)', 'D:\Comics\Uncanny X-Men 003 (2013) (digital) (Zone-Empire)', "{'seriesmeta': [{'publisher': u'Marvel', 'issueid': u'392362', 'name': 'Uncanny X-Men', 'issueyear': u'2013', 'comicyear': u'2013', 'issue': u'3.00', 'comicid': u'57181'}]}"]

Absolute path to script: C:\SickBeard-win32-alpha-build499\autoProcessTV\cmtagmylar.py

Unable to run pre_script: ['C:\SickBeard-win32-alpha-build499\autoProcessTV\cmtagmylar.py', 'Uncanny X-Men 003 (2013) (digital) (Zone-Empire)', 'D:\Comics\Uncanny X-Men 003 (2013) (digital) (Zone-Empire)', "{'seriesmeta': [{'publisher': u'Marvel', 'issueid': u'392362', 'name': 'Uncanny X-Men', 'issueyear': u'2013', 'comicyear': u'2013', 'issue': u'3.00', 'comicid': u'57181'}]}"]

Original Filename: Uncanny X-Men 003 (2013) (digital) (Zone-Empire).cbr

Original Extension: .cbr

New Filename: Uncanny X-Men 3 (2013)

Source:D:\Comics\Uncanny X-Men 003 (2013) (digital) (Zone-Empire)\Uncanny X-Men 003 (2013) (digital) (Zone-Empire).cbr

Destination:D:\Comics/Uncanny X-Men-(2013)/Uncanny X-Men 3 (2013).cbr

Removed temporary directory : D:\Comics\Uncanny X-Men 003 (2013) (digital) (Zone-Empire)

Post Processing SUCCESSFULL!

apastuszak commented 11 years ago

I think I just fixed this!

Please my post here:

https://github.com/manders2600/Sabnzbd-Comictagger-Mylar-Script/issues/8

Comictagger now will convert CBRs to CBZs for you. You can probably remove a good chunk of code, now that that is included directly in comictagger.

apastuszak commented 11 years ago

Can I close this, since I got it working?

evilhero commented 11 years ago

This prolly can be closed since I've incorporated the script within Mylar now and no longer needs to be called as a pre-script. It's is a configurable option that only asks for the location of the comictagger installation. The next commit will have this (which for those keeping track will be a big commit).