Welcome, Guest
Python Scripts for ComicRack

TOPIC: Standardize Library files

Re:Standardize Library files 8 years 11 months ago #2508

  • snitch7
  • snitch7's Avatar
  • Offline
  • Senior Boarder
  • Posts: 61
  • Karma: 0
NOT modified
The administrator has disabled public write access.

Re:Standardize Library files 8 years 11 months ago #2509

  • Quaraxkad
  • Quaraxkad's Avatar
  • Offline
  • Senior Boarder
  • Posts: 61
  • Karma: 2
Hmm... I just found something in the script I hadn't seen before. Line 35:
dir=rootfolder+dir+name.rstrip(".")+"\\"

Change it to
dir=rootfolder+dir+"\\"
The administrator has disabled public write access.

Re:Standardize Library files 8 years 11 months ago #2510

  • snitch7
  • snitch7's Avatar
  • Offline
  • Senior Boarder
  • Posts: 61
  • Karma: 0
Well there it is . Thank you.
The administrator has disabled public write access.

Re:Standardize Library files 8 years 7 months ago #3221

  • chaoshunter
  • chaoshunter's Avatar
  • Offline
  • Junior Boarder
  • Posts: 29
  • Karma: 0
Amazing script! Along with Guided Rename, my library practically organizes itself. However, I wanted to organize my library a different way and I didn't know what to edit.
if book.Format!="Edit":
			if book.Series=="":
				name=book.ShadowSeries
			else:
				name=book.Series
			if name != "":
				fi = FileInfo(book.FilePath)
				if book.Volume == -1:
					if book.ShadowVolume != -1:
						name = name + " (Volume " + str(book.ShadowVolume) + ")"
				else:
					name = name + " (Volume " + str(book.Volume) + ")"
				if book.Publisher == "":
					dir="!No Publisher\\"
				else:
					dir=book.Publisher+"\\"
				if book.Imprint == "":
					dir=dir+"!No Imprint\\"
				else:
					dir=dir+book.Imprint+"\\"

That's my code as it stands. What I want to do is basically:
Publisher/Imprint/Series Name(Without Volume)/Series with Volume

So something like X-Force would be:
Marvel Comics/Marvel Universe/X-Force/Volume 3

I hope that makes sense and I hope you guys can help me out.

Once again, great script.
Last Edit: 8 years 7 months ago by chaoshunter.
The administrator has disabled public write access.

Re:Standardize Library files 8 years 7 months ago #3222

  • Quaraxkad
  • Quaraxkad's Avatar
  • Offline
  • Senior Boarder
  • Posts: 61
  • Karma: 2
chaoshunter wrote:
Publisher/Imprint/Series Name(Without Volume)/Series with Volume

Not exactly clear on what you mean. Is this right?

Publisher/Imprint/Series/Volume 1/issue.cbr
and for issues without a volume number...
Publisher/Imprint/Series/issue.cbr
The administrator has disabled public write access.

Re:Standardize Library files 8 years 7 months ago #3224

  • chaoshunter
  • chaoshunter's Avatar
  • Offline
  • Junior Boarder
  • Posts: 29
  • Karma: 0
Yes, that's precisely what I need.
The administrator has disabled public write access.

Re:Standardize Library files 8 years 7 months ago #3226

  • Quaraxkad
  • Quaraxkad's Avatar
  • Offline
  • Senior Boarder
  • Posts: 61
  • Karma: 2
chaoshunter wrote:
Yes, that's precisely what I need.

I think this should do it. Try it on some test files first to make sure it works. This script doesn't include any filename editing, I assume that's done somewhere else in your script. I haven't tested it, but it should sort files like this:
Publisher/Imprint/Series/Volume 1/filename.cbr
Publisher/Imprint/Series/filename.cbr

if book.Format!="Edit":
	if book.Series=="":
		name=book.ShadowSeries
	else:
		name=book.Series
	if name != "":
		fi = FileInfo(book.FilePath)
		if book.Publisher == "":
			dir="!No Publisher\\"
		else:
			dir=book.Publisher+"\\"
		if book.Imprint == "":
			dir=dir+"!No Imprint\\"
		else:
			dir=dir+book.Imprint+"\\"
		dir=dir+name+"\\"
		if book.Volume != -1:
			dir=dir+"Volume "+book.Volume+"\\"
(click the 'Quote' button on this post to copy and paste the code with tabs, you NEED the tabs.)
Last Edit: 8 years 7 months ago by Quaraxkad.
The administrator has disabled public write access.

Re:Standardize Library files 8 years 7 months ago #3229

  • chaoshunter
  • chaoshunter's Avatar
  • Offline
  • Junior Boarder
  • Posts: 29
  • Karma: 0
I just want to preface this by saying that I followed the steps at the beginning of this topic to remove the file renaming out of the script.

After trying to use the code that you gave me, I get two problems:

On a series without a volume number, two folders are created:
DC Comics/DC Universe/Batman - Battle for the Cowl/Batman - Battle for the Cowl/filename.cbr

I'm guessing that's because it didn't have a volume number.

However, when I try to use it on a comic that does have a volume number, it says:
Exception has been thrown by target of an invocation.

I've attached my copy of the script if you want to look at it.

Once again, thanks for all your help.

File Attachment:

File Name: Standardiz...57ca.zip
File Size:1 KB
Last Edit: 8 years 7 months ago by chaoshunter.
The administrator has disabled public write access.

Re:Standardize Library files 8 years 7 months ago #3232

  • Quaraxkad
  • Quaraxkad's Avatar
  • Offline
  • Senior Boarder
  • Posts: 61
  • Karma: 2
chaoshunter wrote:
After trying to use the code that you gave me, I get two problems:

Here's why you get two folders with the series name:
dir=rootfolder+dir+name.rstrip(".")+"\\"
This is two lines after the new code. It strings together the root folder with the new directory path, and then adds the series name to the end, which was already done. To fix that, you need to swap some lines around.

Change this:
dir=dir+name+"\\"
				if book.Volume != -1:
					dir=dir+"Volume "+book.Volume+"\\"
				name=name.replace("*"," ").replace("\"","''").replace("?","_").replace("\\"," ").replace("/"," ").replace(":","").replace(": "," ")
				dir=rootfolder+dir+name.rstrip(".")+"\\"

To this:
name=name.replace("*"," ").replace("\"","''").replace("?","_").replace("\\"," ").replace("/"," ").replace(":","").replace(": "," ")
				dir=rootfolder+dir+name.rstrip(".")+"\\"
				if book.Volume != -1:
					dir=dir+"Volume "+book.Volume+"\\"
The administrator has disabled public write access.

Re:Standardize Library files 8 years 7 months ago #3241

First, big props to Quarxkad for helping out with customizations/answering questions before I'm able to. I appreciate the help, and when I don't respond it's usually because he's got the issue under control by the time I even find out about it.

I'm considering some revisions to the script to make it a little more modular as well as be able to include some new hooks (like normalizing the filename without moving the files/screwing with the directory structure at all). If anyone else has any suggestions/fixes/etc. along those lines, let me know and I'll try to roll it all out at once (I've been trying to keep the number of releases down).
The administrator has disabled public write access.
Time to create page: 0.385 seconds

Who's Online

We have 246 guests and 4 members online