Welcome, Guest
Python Scripts for ComicRack

TOPIC: malor89's ComicRack Scripts

Re: malor89's ComicRack Scripts 5 years 3 months ago #25525

  • malor89
  • malor89's Avatar
  • Offline
  • Senior Boarder
  • Posts: 73
  • Thank you received: 16
  • Karma: 17
That make a lot more sense. I'd suggest sending him a personal message (if you haven't already), since this thread is so old.
The administrator has disabled public write access.

Re: malor89's ComicRack Scripts 4 years 7 months ago #33236

  • laxarus
  • laxarus's Avatar
  • Offline
  • Senior Boarder
  • Posts: 66
  • Thank you received: 3
  • Karma: 0
Hey man, thank you for providing these scripts. They are wonderful. I know it's an old threat but had to ask this. Is it possible to broaden the publisher list in addition to the ones you have provided with the script. I mean i tried to add a lot of publishers to the script but it game me an error. I guess it was too much for python to read a very long line. However, when i try to add one or two there was no problem.

In other words, is it possible to point the script to check for long list of publishers?
Last Edit: 4 years 7 months ago by laxarus.
The administrator has disabled public write access.

Re: malor89's ComicRack Scripts 4 years 7 months ago #33237

  • malor89
  • malor89's Avatar
  • Offline
  • Senior Boarder
  • Posts: 73
  • Thank you received: 16
  • Karma: 17
You should be able to make the list of publishers as long as you want. I removed a couple of the most common publishers, because they often show up in the title of the comic. If you post the list that gave an error, I'll see if I can spot the problem. There might be a special character or something that's the cause.
The administrator has disabled public write access.

Re: malor89's ComicRack Scripts 4 years 7 months ago #33240

  • laxarus
  • laxarus's Avatar
  • Offline
  • Senior Boarder
  • Posts: 66
  • Thank you received: 3
  • Karma: 0
Yeah, special characters might be the issue, but it's more like a reading error. I mean I am trying to add a couple of hundreds of publishers to the one line in the script. And that line cannot handle all the data. I mean after copying and pasting my publisher list, there isn't any room for additional characters. Like when i hit space bar it jumps to the next character instead of leaving a blank. And since that is the case, i don't think, i successfully copied all the data.

And one more thing, considering that Python is case sensitive, it needs to match the exact name of the publisher. However, there are variations of the same publisher name in my archive with lower and upper cases and this is troubling. Is there a way to fix this? Or do i need to rename the files?
The administrator has disabled public write access.

Re: malor89's ComicRack Scripts 4 years 7 months ago #33246

  • malor89
  • malor89's Avatar
  • Offline
  • Senior Boarder
  • Posts: 73
  • Thank you received: 16
  • Karma: 17
I think you are running into the maximum line length for your text editor. You could break the list into multiple lines as in this example.
publishers = '(Papercutz|Eclipse|'
publishers += 'Adhouse Books|After Hours)'
Having a super long list might slow the script down, however. The text search should be case insensitive, but the match result will have the capitalization of the file name and not the publishers list.

I think that could be fixed by searching the publishers list with the result of the first search.

Change:
			m = re.search('(?i)\([^\)]*(?<=[^a-z])'+publishers+'[^a-z](?!dcp)', name) #find publisher
			if(m):
				publisher = m.group(1)
				book.Publisher = publisher
to:
			m = re.search('(?i)\([^\)]*(?<=[^a-z])'+publishers+'[^a-z](?!dcp)', name) #find publisher
			if(m):
				publisher = m.group(1)
				m = re.search('(?i)('+publisher+')', publishers) #find in publishers list to get proper capitalization
				book.Publisher = m.group(1)
So you'd want the publishers list to have the proper capitalization without duplicates
Last Edit: 4 years 7 months ago by malor89.
The administrator has disabled public write access.
The following user(s) said Thank You: laxarus

Re: malor89's ComicRack Scripts 4 years 7 months ago #33260

  • laxarus
  • laxarus's Avatar
  • Offline
  • Senior Boarder
  • Posts: 66
  • Thank you received: 3
  • Karma: 0
Okay, so far multi publisher lines in the script worked like a charm. Though, it needed a through examination of the special characters.

However there is still a problem with upper and lower character cases in the publisher data.

I mean, i did replace the code with your suggestion. However; if the word in the brackets aren't a match with the defined list, the publisher category still shows up empty. I have 2 files named like this:
and my predefined publisher is written like this in the script: Ail
1st file : [Ail] XXXXXXXX

and

2nd file: [AIL] YYYYYYYY

when i run the script, the first file's publisher is recognized whereas the 2nd file's publisher category remains blank despite the fact that they both have the same publisher name with different capitalizations.

Any help on this one?
Last Edit: 4 years 7 months ago by laxarus.
The administrator has disabled public write access.

Re: malor89's ComicRack Scripts 4 years 7 months ago #33268

  • malor89
  • malor89's Avatar
  • Offline
  • Senior Boarder
  • Posts: 73
  • Thank you received: 16
  • Karma: 17
I can't duplicate the problem. My only ideas is that the middle letter in the file name is a 'l' instead of an 'I', so "all" instead of "ail". Do you have other examples of it working or not working?
The administrator has disabled public write access.

Re: malor89's ComicRack Scripts 4 years 7 months ago #33270

  • laxarus
  • laxarus's Avatar
  • Offline
  • Senior Boarder
  • Posts: 66
  • Thank you received: 3
  • Karma: 0
Okay i did further testing and the problem seems to be with the character 'I'. In other words, the script isn't recognizing the lower case 'i' as upper case 'I'. And it's the same with the reverse of it. Is it possible that this case is related to my windows native language and keyboard?

In other words,

The script is not interpreting the

"Ail" as "AIL"

and

"Interlude" as "interlude"

I figure this is not a coding error, it's more like a library setting.

I did a little searching and the solution to this might be related to converting string to the unicode. I am not sure though. I don't have enough python knowledge ):.
Last Edit: 4 years 7 months ago by laxarus.
The administrator has disabled public write access.

Re: malor89's ComicRack Scripts 4 years 7 months ago #33282

  • malor89
  • malor89's Avatar
  • Offline
  • Senior Boarder
  • Posts: 73
  • Thank you received: 16
  • Karma: 17
If you have python installed you can play around with this test code file.
import re, sys, time

def getCovers(found):
	global covers
	covers = found.group(1).lower()
	return ""
	
	
publishers = '(Papercutz|Eclipse|'
publishers += 'Adhouse Books|After Hours|Ail|Interlude)'

print (publishers)

name = "[interlude] XXXXXXXX"

name = name.replace('[', '(') #brackets with ()
name = name.replace(']', ')')
name = name.replace('#', '')
name = name.replace('.', ' ')

name = re.sub('(?i)(((?<=\()[^\)]*?|both|(?<!\w)\d) covers?( \w[& \w]*(?=[ \)]|$))?)' ,getCovers, name)  #get cover information


(name, x) = re.subn('(?i)c[2t]c\.?', "", name,1) #find cover-to-cover
if(x):
	ads = "(c2c)"
else:
	(name, x) = re.subn('(?i)noads', "", name,1) #find noads
	if(x):
		ads = "(noads)"

(name, x) = re.subn('(?i) alt ', " ", name,1) #find alt
if(x):
	extra = "(alt)"

(name, x) = re.subn('(?i)fixed', " ", name,1) #find fixed
if(x):
	extra = "(fixed)"

name = re.sub('(?i)\(dcp\)', "", name) #remove (dcp) by itself


m = re.search('(?i)\([^\)]*(?<=[^a-z])'+publishers+'[^a-z](?!dcp)', name) #find publisher
#m = re.search('(?i)[^a-z]'+publishers+'[^a-z]', name) #find publisher
if(m):
	publisher = m.group(1)
	print (publisher);
	m = re.search('(?i)('+publisher+')', publishers) #find in publishers list to get proper capitalization
	fixed = m.group(1)
	print (fixed);
Which you can run from the command line.

I copied and pasted your example and don't see a problem. Unless it's some special character that's not between a-z or A-Z.
The administrator has disabled public write access.
The following user(s) said Thank You: laxarus

Re: malor89's ComicRack Scripts 4 years 7 months ago #33362

  • laxarus
  • laxarus's Avatar
  • Offline
  • Senior Boarder
  • Posts: 66
  • Thank you received: 3
  • Karma: 0
Thanks man, you are great. I feel kinda bad to occupy your time but I noticed another problem.
If you have two words that appear in different variations in your publisher list, when you run the script, you will get the last part of the match in the filename.
Let's say, you have 2 predefined publishers in your list:
"Light" and "Blue Light"

and a filename: [Blue Light] XXXXXX.rar

When you run the script on this file, you get "Light" as your publisher instead of "Blue Light"

Is there anyway to fix this?
The administrator has disabled public write access.
Time to create page: 0.525 seconds

Who's Online

We have 248 guests and one member online