Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Sony Reader

Notices

Reply
 
Thread Tools Search this Thread
Old 11-30-2010, 10:43 AM   #16
lack
Zealot
lack has never been to obedience school.lack has never been to obedience school.lack has never been to obedience school.lack has never been to obedience school.lack has never been to obedience school.lack has never been to obedience school.lack has never been to obedience school.lack has never been to obedience school.lack has never been to obedience school.lack has never been to obedience school.lack has never been to obedience school.
 
lack's Avatar
 
Posts: 113
Karma: 44088
Join Date: Sep 2010
Location: Osaka, Japan
Device: PRS-650
Oh well I'll just post it anyway

copy below code to a text editor, and then save it as a .vbs file the run it.
You will need to tweak it to suit your need, I'll explain some on the bottom, other than that feel free to ask.
Code:
topFolder = "D:\One Piece\"
zipExec = """C:\Program Files\7-Zip\7z.exe"" a -tzip ""@dest"" ""@src"""

dim fso, wsh
dim execStr
dim f, f1, sf, f2, sf2, mf, fullPath
dim chapterFileName, chapterTitle, volumeFileName

Set fso = createobject("Scripting.FileSystemObject")
Set wsh = WScript.CreateObject("WScript.Shell")

Set f = fso.GetFolder(topFolder)
Set sf = f.SubFolders
For Each f1 in sf
	'<Step 1> create cbz for each subfolders plus comics.txt
	Set mf = fso.CreateTextFile(f1.path & "\comics.txt", True, True)
	Set sf2 = f1.SubFolders
	For Each f2 in sf2
		'directory name is the title
		chapterTitle = "Chapter " & f2.name
		chapterFileName = f2.name & ".cbz"
		
		fullPath = f1.path & "\" & chapterFileName 
		if fso.fileExists(fullPath) then fso.deleteFile(fullPath) 'delete previously created cbz file if exists
		execStr = replace(replace(zipExec, "@dest", fullPath), "@src", f2.path & "\*")
		wsh.run execStr, , True
		'write entry in comics.txt
		mf.WriteLine(chapterFileName & ":" & chapterTitle)
	Next
	mf.Close
	'<Step 1 ends here>
	
	'<Step 2> create cbc - directory name is the volume title
	volumeFileName = f1.name & ".cbc"
	execStr = replace(replace(zipExec, "@dest", f.path & "\" & volumeFileName), "@src", f1.path & "\*.cbz"" """ & f1.path & "\comics.txt")
	wsh.run execStr, , True
	'<Step 2 ends here>
	
	'<Step 3> cleanup - delete cbz and comics.txt
	execStr = "cmd /C del  """ & f1.Path & "\*.cbz"""
	wsh.run execStr, , True
	execStr = "cmd /C del  """ & f1.Path & "\comics.txt"""
	wsh.run execStr, , True
	'<Step 3 ends here>
Next
set fso = nothing
set wsh = Nothing
If any of you knows vbscript the script would be self-explanatory. For others, read below.

First of all, edit the [zipExec] to the command prompt of your zip program. I use 7zip installed with common configuration, and the command of the code above works for it.

Then you will need to edit [topFolder] to your manga directory.
for example, mine was "D:\One Piece\". Be sure to add the trailing backslash.
below this directory there are volume folders, with names like "volume 01", "volume 02" etc. Below the volume folder, is chapter folders, with names ranging from "001-xxxx", "002", to "one_piece_501" etc. Inside the chapter folders is the images.

I've labeled the script with <step 1>, <step 2> and <step 3>

<step 1> zips the images in each chapters in [its folder's name].cbz, and create a comics.txt in each volume folder containing the list of cbz files and its corresponding chapter title, which is just the chapter folder name plus "Chapter " added in front. After this step is finished you will have several cbz and one comics.txt in each volume folder.

<step 2> zips all the cbz and comics.txt to a single cbc, and put it in the top folder. File name is the volume folder name.

<step 3> just deletes all the cbz and comics.txt

If your naming is perfect by the time the script finishes (600 chapters here, about 20 mins, 3 yr old core 2 duo machine) you will have, in the topFolder, only cbc files of your volumes.

If you are not sure, have a lot of naming problems or want to set the chapter titles by yourself, just backup the original script, delete <step 2> thru <step 3>, run it and you can edit the corresponding comics.txt after the script finishes.

After all is done, get the backup, now delete <step 1> instead and build the cbc only. delete <step 3> if you don't want to delete the cbz right away.

Hope this helps
lack is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PRS-350 et PRS-650 : tactile sans reflet ? Grimaud Sony Reader 72 09-16-2011 06:13 AM
An Australian review of the PRS-350 and PRS-650 hedgeddown Sony Reader 7 10-15-2010 02:19 AM
Does PRS-350 or PRS-650 slow down in the sun? JSWolf Sony Reader 56 09-29-2010 08:49 PM
Prs-900 vs. prs-650 vs. prs-600 fyre182 Sony Reader 12 09-29-2010 02:48 PM
PRS-650 PRS-350 Please report eventual fading under direct sunlight of new models sigmax Sony Reader 11 09-26-2010 12:50 AM


All times are GMT -4. The time now is 03:41 AM.


MobileRead.com is a privately owned, operated and funded community.