View Full Version : MobiDeDRM


jabberwock_11
12-06-2008, 11:50 PM
Alright, I know this has been gone over before and I have browsed the previous threads to see if I can work out my issue for myself, but I am getting nowhere quick. I have python and the mobidedrm, but when I go into the command prompt and pull up python it is unable to recognize mobidedrm. Basicly it keeps telling me that it can not find it. I have unzipped the folder and followed several suggestions posted in other threads, but no luck.

I either get NameError: name 'mobidedrm' is not defined when I type mobidedrm or I get SyntaxError: invalid syntax when I type cd mobidedrm

I am trying to climb the learning curve, I relly am...any help would be greatly appreciated.

FizzyWater
12-07-2008, 12:37 AM
cd is a DOS command to change the directory - aka "folder" - you're in. So trying to send the cd command with mobidedrm crashes becauses mobidedrm is a file (a python script, to be exact), not a folder.

I had followed the instructions in the thread "How to use Igorsk's script" (http://www.mobileread.com/forums/showthread.php?t=18310), so python is in my "path" designator in Windows.

I'm also using both tompke's mobi executable files (https://dev.mobileread.com/trac/mobiperl/wiki) (I installed Perl, but haven't been able to get that to work yet! - the executables are saved in the "RunScripts" directory) and Kovid's Calibre (http://calibre.kovidgoyal.net/) (which I install and periodically update as he puts out new releases) to convert the deDRM'd file to various HTML files. (Eventually, I'll just choose one, but in the beginning I had different problems with each one, so I run all three automatically. If the file created by Kovid's Calibre mobi2oeb works, I delete the other two).

So when I'm running mobidedrm, I'm opening the Command prompt window and then doing the cd command with the folder my Mobipocket book is saved in. Then I make a folder with the book's name, move the file in it (and a copy of tompke's executable, because I'm still learning this command line stuff and couldn't figure out how to run it without it being in the same folder as the book!). I run the scripts, delete the duplicate of tompke's executable, and go on to the next book.

I'll copy the code below. I've got it saved as a text file with a .bat extension. I update the book information (using an Excel spreadsheet with formulas - I'm lazy!) for the number of books I want to convert, save and close the file, then doubleclick it from Windows Explorer to get it to start running.

@ECHO OFF
ECHO ************************************************** ********
ECHO ** Script to convert multiple Mobipocket files to HTML **
ECHO ************************************************** ********

:: Change directory to the script folder

j:
CD \RunScripts


:: Create new folder for 1st book and move files into it
ECHO.
ECHO Creating folder for Book1 and moving files...
ECHO.
MD \RunScripts\Book1
MOVE J:\RunScripts\Book1.prc J:\RunScripts\Book1
COPY J:\RunScripts\mobi2html.exe J:\RunScripts\Book1
CD Book1
:: Run fourth deDRM script [Format - Mobidedrm04 infile.mobi outfile.mobi PID (may replace MOBI with PRC)]
ECHO.
ECHO Running attempt to unlock file - make take a little while...
ECHO.
mobidedrm04 Book1.prc Book1_v4.prc 1aaa11aaaa
:: RunExploderScripts (mobi2oeb now converts <i> to <span class="italic">, so may want to remove it eventually)
ECHO.
ECHO Running conversion to html scripts on unlocked PRC file...
ECHO.
mobi2oeb Book1_v4.prc
mobi2html Book1_v4.prc unpack4 --rawhtml > Book1_v4_raw.html
mobihuff Book1_v4.prc Book1_v4_decompress.html
DEL J:\RunScripts\Book1\mobi2html.exe
CD ..

:: Create new folder for next book and move files into it
:: (repeat code above for Book2 want to convert, etc.)


:: End
PAUSE
EXIT

jabberwock_11
12-07-2008, 01:01 AM
The problem is getting mobidedrm to run in the first place. I know that cd changes the file, but it was all I could think of. I can not get python to run the mobidedrm.

Most of wha you wrote is Greek to me, it just doesn't shine any lights for me. I installed python and figured out how to get into it, but getting it to run mobidedrm is not happening...I just wanna read my books...sigh. Obviously I am not a huge computer programing type person, but there has got to be a way for me to figure this out.

wallcraft
12-07-2008, 01:12 AM
I suggest looking at Visual Kindle Guide (http://wiki.mobileread.com/wiki/Visual_Kindle_Guide) in the Wiki. Start with Command Prompt, and then look at KindleFix. This is very similar to mobidedrm, but with fewer arguments.

If you downloaded mobidedrm as a .txt file, it is possible that the filename extension has not been changed (i.e. you have mobidedrm.py.txt). See Book Designer issue (http://www.mobileread.com/forums/showpost.php?p=302112&postcount=4) for how to fix this.

Seabound
12-07-2008, 01:16 AM
Once you've installed it, python should really be transparent to you as a user. Try these steps:

* Copy the mobidedrm script to the directory where the ebooks you want to convert reside.

* Bring up a windows command screen (type in "cmd.exe" at start the menu search window).

* cd to the directory where your ebooks and mobidedrm reside.

* Type in "mobidedrm.py" or whatever you named the mobidedrm script. Doing this should give you an output with Usage giving the syntax (command, input name, output name, PID) for using the script. Follow this syntax.

FizzyWater
12-07-2008, 01:19 AM
Okay, first question, are you on Windows XP? (That's all I know, as far as this stuff goes).

Second, you said you installed Python - did you follow this step (thanks TallMomof2):
Edit the PATH to include the Python executable and the path to the scripts (where you placed Igor's scripts). In XP right-click on "My Computer" then click on "Properties","Advanced" tab, "Environmental Variables". In the System Variables window find and highlight "PATH" and click edit. Add the paths. The two paths I added were ;c:\Python25 and ;c:\Python25\Tools\Scripts. Please note that each path starts with a semi-colon ";" Be sure your typing is correct and click "OK" Keep clicking "OK" until you're out of the System Properties window.

The install may have already entered those path directions, so scroll through the whole PATH list to see if both of these are there. Add whichever ones are missing to the end of the list.

Third, is your copy of the Mobidedrm saved in c:\Python25\Tools\scripts? (And is it version "4" - the one that is the updated version of Mobidedrm02 [instructions on how to update it are here, I'll look to see where])?

EDITED: Interesting. Seabound and I do not do this the same way. My version of the script is in the Python folder tree. So you'll want to pick one way and follow those instructions. If you try to do what both of us are telling you, you'll be even more lost! :o

desertgrandma
12-07-2008, 12:05 PM
The problem is getting mobidedrm to run in the first place. I know that cd changes the file, but it was all I could think of. I can not get python to run the mobidedrm.

Most of wha you wrote is Greek to me, it just doesn't shine any lights for me. I installed python and figured out how to get into it, but getting it to run mobidedrm is not happening...I just wanna read my books...sigh. Obviously I am not a huge computer programing type person, but there has got to be a way for me to figure this out.

Jabberwock, do NOT give up. If this board could guide ME thru it, you can do it too. It may take a while, but the results are well worth it. Keep on asking questions, and be patient. (from one who thought she could never get it, either!) :D

pdurrant
12-07-2008, 01:17 PM
One big problem people have on Windows is that by default it hides file extensions. It may be that your python script is actually called mobidedrm.py.txt, which is why python won't run it or find it.

There's an option somewhere to always display filename extensions. Turn it on.

Alright, I know this has been gone over before and I have browsed the previous threads to see if I can work out my issue for myself, but I am getting nowhere quick. I have python and the mobidedrm, but when I go into the command prompt and pull up python it is unable to recognize mobidedrm. Basicly it keeps telling me that it can not find it. I have unzipped the folder and followed several suggestions posted in other threads, but no luck.

I either get NameError: name 'mobidedrm' is not defined when I type mobidedrm or I get SyntaxError: invalid syntax when I type cd mobidedrm

I am trying to climb the learning curve, I relly am...any help would be greatly appreciated.

jabberwock_11
12-07-2008, 05:09 PM
I am so close that I can taste it. First off, in case it matters, I am using Windows Vista.

I am able to pull up mobidedrm in the command prompt, but when I follow it's syntax it just returns me to it.

I go to the folder with my books and mobidedrm (C:\Users\Nick\Documents\My eBooks>) and type mobidedrm.py and I get this:

MobiDeDRM v 0.02. Copyright 2008 The Dark Reverser Removes protection from Mobipocket books Usage: mobidedrm infile.mobi outfile.mobi PID then below that is the C:\Users\Nick\Documents\My eBooks>

so I type: mobidedrm.py Name_of_Book.prc mymobipid# (mymobipid# being my computer's pid with mobipocket reader) and then I get this again:

MobiDeDRM v 0.02. Copyright 2008 The Dark Reverser Removes protection from Mobipocket books Usage: mobidedrm infile.mobi outfile.mobi PID then below that is the C:\Users\Nick\Documents\My eBooks>

What am I doing wrong? What else do I need to do?

pdurrant
12-07-2008, 05:37 PM
You're not using the correct command line.

MobiDeDRM says:
Usage: mobidedrm infile.mobi outfile.mobi PID

You enter:
mobidedrm.py Name_of_Book.prc mymobipid#

You should enter:
mobidedrm.py Name_of_Book.prc Name_of_Unlocked_Book.prc mymobipid#


I am so close that I can taste it. First off, in case it matters, I am using Windows Vista.

I am able to pull up mobidedrm in the command prompt, but when I follow it's syntax it just returns me to it.

I go to the folder with my books and mobidedrm (C:\Users\Nick\Documents\My eBooks>) and type mobidedrm.py and I get this:

MobiDeDRM v 0.02. Copyright 2008 The Dark Reverser Removes protection from Mobipocket books Usage: mobidedrm infile.mobi outfile.mobi PID then below that is the C:\Users\Nick\Documents\My eBooks>

so I type: mobidedrm.py Name_of_Book.prc mymobipid# (mymobipid# being my computer's pid with mobipocket reader) and then I get this again:

MobiDeDRM v 0.02. Copyright 2008 The Dark Reverser Removes protection from Mobipocket books Usage: mobidedrm infile.mobi outfile.mobi PID then below that is the C:\Users\Nick\Documents\My eBooks>

What am I doing wrong? What else do I need to do?

jabberwock_11
12-07-2008, 05:45 PM
YES!YES!YES!YES!!!! You are my new hero! It worked like a charm and then the beautiful, wonderous, awesome Calibre managed to convert the DRM free file to an .lrf file for my Sony Reader! Thank you all so much for the help and guidance, it took a lot of doing, but you guys got me to the end! Now can actually read the books that I bought before I understood about DRM and not being able to transfer from one format to another...

FizzyWater
12-07-2008, 07:15 PM
Woo-hoo! Congratulations on getting it to work.

JSWolf
12-07-2008, 09:18 PM
YES!YES!YES!YES!!!! You are my new hero! It worked like a charm and then the beautiful, wonderous, awesome Calibre managed to convert the DRM free file to an .lrf file for my Sony Reader! Thank you all so much for the help and guidance, it took a lot of doing, but you guys got me to the end! Now can actually read the books that I bought before I understood about DRM and not being able to transfer from one format to another...
Now to get it to work even better you'll want to upgrade MobiDeDRM.py 0.02 to convert it to 0.04 which works all the time. 0.02 will work most of the time, but not all. And sometimes when it says it works, it really doesn't. So as long as you are using 0.02, be prepared for some failure.

The following link is to the post that has the patches you'll have to hand apply to convert 0.02 to 0.04.

http://www.mobileread.com/forums/showthread.php?p=222142&#post222142

pdurrant
12-17-2008, 06:33 PM
I've just posted patches to take 0.02 to 0.05, which makes it work with even more Mobipocket files.

http://www.mobileread.com/forums/showthread.php?p=309292


Now to get it to work even better you'll want to upgrade MobiDeDRM.py 0.02 to convert it to 0.04 which works all the time. 0.02 will work most of the time, but not all. And sometimes when it says it works, it really doesn't. So as long as you are using 0.02, be prepared for some failure.

The following link is to the post that has the patches you'll have to hand apply to convert 0.02 to 0.04.

http://www.mobileread.com/forums/showthread.php?p=222142&#post222142