Created
April 27, 2010 02:49
-
-
Save Sakurina/380264 to your computer and use it in GitHub Desktop.
facilitate converting MangaDLC libraries into CBZs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// mangadump - a quick Cycript hack for MangaDLC | |
// by Yanik Magnan - http://r-ch.net | |
/* | |
* Here's how it works. | |
* | |
* Launch MangaDLC and switch to the Library tab. | |
* Inject this cycript into the process, and a mangadump.sh | |
* shell script will be created in /tmp. | |
* Chmod it with executable permissions and run it; | |
* all of the MangaDLC 'library' will be copied into /tmp/MangaOutput | |
* in folders with meaningful names and ordered pages. | |
* | |
* UPDATE (May 10th): | |
* Now automatically zips the folders up into cbz files and moves them | |
* directly into CloudReaders on my iPad. There needs to be a little | |
* tuning, like automatically determining where CloudReaders is installed | |
* and reordering pages, as they are not always in the right order. | |
*/ | |
var fileContents = "mkdir -p \"/tmp/MangaOutput/cbz\"\n"; | |
for (var b in UIApp.delegate.booksViewController.books) { | |
var book = UIApp.delegate.booksViewController.books[b]; | |
var chapters = [book.chapters getAllObjectsAsArray]; | |
for (var c in chapters) { | |
var chapter = chapters[c]; | |
// Make a directory for that chapter | |
fileContents += "mkdir -p \"/tmp/MangaOutput/" + chapter.title + "\"\n"; | |
// Get each page | |
var pages = [chapter.pages getAllObjectsAsArray]; | |
for (var p in pages) { | |
var page = pages[p]; | |
// Log to file a cp command | |
var pageFile = "/var/mobile/Library/MangaDLC/Documents/images/"+book.uuid+"/"+chapter.uuid+"/"+page.uuid; | |
var targetFile = "\"/tmp/MangaOutput/" + chapter.title + "/"+ page.number + ".jpg\""; | |
fileContents += "cp "+ pageFile + " " + targetFile + "\n"; | |
} | |
fileContents += "zip -r \"/tmp/MangaOutput/cbz/" + chapter.title + "\" \"/tmp/MangaOutput/" + chapter.title + "\"\n"; | |
} | |
} | |
fileContents += "cd /tmp/MangaOutput/cbz\n"; | |
fileContents += "for i in *.zip; do mv \"$i\" \"`basename \"$i\" .zip`.cbz\"; done\n"; | |
fileContents += "mv ./* /var/mobile/Applications/81AA570C-E378-4279-9282-6AF47022C2F2/Documents/\n" | |
[fileContents writeToFile:@"/tmp/mangadump.sh" atomically:YES]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment