Welcome, Guest
Python Scripts for ComicRack

TOPIC: Data Manager 2.xx Series for ComicRack

Data Manager 2.xx Series for ComicRack 1 year 11 months ago #46471

  • jkthemac
  • jkthemac's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 785
  • Thank you received: 267
  • Karma: 56
The reason i ask wasn't for naming conventions but for correcting problems with FileName ala the problem here:

comicrack.cyolito.com/forum/8-help/39820-double-extension-files

This issue could have been fixed in one easy rule if I could have renamed the files in Data Manager. Instead the problem had to be solved outside of ComiRack. I imagine other file name errors in the database may arise that could also be fixed this way.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 1 year 11 months ago #46474

  • Xelloss
  • Xelloss's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 596
  • Thank you received: 150
  • Karma: 30
The problem is that Data Manager works, as the name itself says, only with data in the comicrack database...

The renaming script, in the other hand, works with both, as they rename files, but also change the "link" in the database (to avoid having to readd the comic)

Remember the filename in the database is only a value for finding the comic, and is not the actual place of the file... If they are not the same, it will be a "file not found" or "file deleted" case...

In any case, if a renaming script isn't enough for doing an specific rename rule, you should ask the rename script to add this... not the data manager which is focused in the comicrack database only... or at least it would make more sense...

Although adding "file manager" capabilities to data manager is not a bad idea either... but it would be a BIG change in how the script works...

In addittion, Data Manager is a really good tool to "fix" the links of the comics if you "break" them outside comicrack (a windows script for example). As you can´t change the file link in the database from outside comicrack (ok, you can, but it is not the idea)
Last Edit: 1 year 11 months ago by Xelloss.
The administrator has disabled public write access.
The following user(s) said Thank You: T3KN0Gh057

Data Manager 2.xx Series for ComicRack 1 year 11 months ago #46478

  • jkthemac
  • jkthemac's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 785
  • Thank you received: 267
  • Karma: 56
I am not referring to the renaming script. If you actually edit the comic name in a Comic Rack view it changes the name of the comic in the operating system and the path accordingly. See the picture in my earlier post.

I agree it might be tricky to make sure things work in the file system but it would make for a much more powerful way of correcting errors in filenames or relinking files that are no longer connected due to naming errors.
Last Edit: 1 year 11 months ago by jkthemac.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 1 year 11 months ago #46480

  • T3KN0Gh057
  • T3KN0Gh057's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 407
  • Thank you received: 114
  • Karma: 27
jkthemac wrote:
I agree it might be tricky to make sure things work in the file system but it would make for a much more powerful way of correcting errors in filenames or relinking files that are no longer connected due to naming errors.

Actually it'd be real easy.... but...

Its still out of the scope of Data Manager. Renaming files with Library Organizer is much more efficient and practical. It will remove double extensions AND use a standard convention for book files. I find this is a better option than adding for 2 reasons.
  • The more specialized a script is, the easier it is to track down problems created by the script (not talking about errors in the script itself but end user applications)
  • Smaller scripts doing less is better because often you only need/want to apply one change to all ...and if you need to run multiple scripts to apply multiple options there's even a script that will chain your scripts.. But the point is a script that does everything pretty much negates the reason for adding scripts. Might as well be part of the app itself.

you could always make a small script that would fix doubled extensions.
import re
import sys
import io
import os


def DoDatShit(books):
	Regex = re.compile('(\\.[^.]+)\1)$') # get the first extension as \1 then find second extension with back reference
	
	for book in books:
		if Regex.match(book.FileName):
			Path = book.FilePath
			FileName = book.FileName
			
			NewFileName = RegEx.sub('\1', book.FileName) #fix writing the extension only once using the backreference
			
			try:
				os.rename(Path + os.pathsep + FileName, Path + os.pathsep + NewFileName) ## Rename file using full path to file and full path to renamed file
				book.FileName = NewFileName #Fixing filename in library
			except:
                               pass #do nothing

While you're at it you could add other cleanup fixes... removing double spaces, changing '.' to spaces, etc

Hell i might release a script like that myself.... Add it into Data Manager as a separate script.

NOTE: the above script may not reflect actual ComicRack book attributes and is just a quickly written script to demonstrate... however only the comicrack book attributes would need to be corrected for this to work as presented.
Last Edit: 1 year 11 months ago by T3KN0Gh057.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 1 year 11 months ago #46494

  • johnson_pw
  • johnson_pw's Avatar
  • Offline
  • Junior Boarder
  • Posts: 25
  • Karma: 0
How does the Merge function work?
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 1 year 11 months ago #46498

  • jkthemac
  • jkthemac's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 785
  • Thank you received: 267
  • Karma: 56
I see exactly where you are coming from, but I see your script as the Swiss Army Knife of scripts and I have this compulsion to help people with the many and varied problems that new and even experienced users have with ComicRack. Your script usually grants me a way of doing this, which is great.

As far as I am aware there insn't a script available that allows people to rename their files within ComicRack based on a regex expression and that is far outside my abilities, or rather I don't want to learn the required coding knowledge. My real coding days are happily far behind me.

Given that user queries are never predictable only regex would work as a full solution, and the script would need to be able to use quite a number of fields if it was to be the renaming panacea. At the very least the path, directory, and filename.
Last Edit: 1 year 11 months ago by jkthemac.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 1 year 11 months ago #46534

I am having 2 problems I am hoping someone can help with.

1. When adding a tag, it is not allowing me to check if it already exists, and thus is duplicating in a strange way.

<rule field="Series" modifier="Contains" value="Captain America" /> <rule field="Tags" modifier="NotContains" value="Captain America" /> => <action field="Tags" modifier="Add" value="Captain America" />

Run it once... you get:
Captain America

Run it twice, you (strangely) get:
Captain, America, Captain America

2. It is not filling in the DataManager.processed date. Is there any way to put that in a rule?

Thanks in advance for any assistance!
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 1 year 10 months ago #46570

Bumping as a hopeful plea anyone has any ideas here.
cubbyblues84 wrote:
I am having 2 problems I am hoping someone can help with.

1. When adding a tag, it is not allowing me to check if it already exists, and thus is duplicating in a strange way.

<rule field="Series" modifier="Contains" value="Captain America" /> <rule field="Tags" modifier="NotContains" value="Captain America" /> => <action field="Tags" modifier="Add" value="Captain America" />

Run it once... you get:
Captain America

Run it twice, you (strangely) get:
Captain, America, Captain America

2. It is not filling in the DataManager.processed date. Is there any way to put that in a rule?

Thanks in advance for any assistance!
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 1 year 10 months ago #46571

  • T3KN0Gh057
  • T3KN0Gh057's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 407
  • Thank you received: 114
  • Karma: 27
Unfortunately I'm busy with getting my house finished up at the moment, I look into it when i get the time.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 1 year 10 months ago #46593

  • DodgyEmu
  • DodgyEmu's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 6
  • Karma: 0
Data Manager hangs for me when I use this rule:
<rule field="Title" modifier="RegEx" value=".*\bpart|Part|pt|Pt\b\W+\bOne|one|0*1|i|I\b.*" /> =>
<action field="Title" modifier="RegexReplace" value="(.*)\bpart|Part|pt|Pt\b\W+\bOne|one|0*1|i|I\b(.*)||$1Part 01$2" />
I'm trying to change all titles with 'part one' (or 'Part 1', 'part.1', etc.) in them to be uniformly 'Part 01'.

There may just be an obvious mistake in the RegEx that I'm missing or I'm misunderstanding how the RegexReplace works, but I had a similar rule working in an earlier version of Data Manager.
Any help would be appreciated.
The administrator has disabled public write access.
Time to create page: 0.344 seconds

Who's Online

We have 202 guests and one member online