Exemplo n.º 1
0
 def run(self, path_to_ebook):
     from calibre.gui2 import is_ok_to_use_qt
     from PyQt4.Qt import QMessageBox
     PID = self.site_customization
     data_file = file(path_to_ebook, 'rb').read()
     ar = PID.split(',')
     for i in ar:
         try:
             unlocked_file = DrmStripper(data_file, i).getResult()
         except DrmException:
             # ignore the error
             pass
         else:
             of = self.temporary_file('.mobi')
             of.write(unlocked_file)
             of.close()
             return of.name
     if is_ok_to_use_qt():
         d = QMessageBox(
             QMessageBox.Warning, "MobiDeDRM Plugin",
             "Couldn't decode: %s\n\nImporting encrypted version." %
             path_to_ebook)
         d.show()
         d.raise_()
         d.exec_()
     return path_to_ebook
Exemplo n.º 2
0
 def run(self, path_to_ebook):
     from calibre.gui2 import is_ok_to_use_qt
     from PyQt4.Qt import QMessageBox
     PID = self.site_customization
     data_file = file(path_to_ebook, 'rb').read()
     ar = PID.split(',')
     for i in ar:
         try:
             unlocked_file = DrmStripper(data_file, i).getResult()
         except DrmException:
             # ignore the error
             pass
         else:
             of = self.temporary_file('.mobi')
             of.write(unlocked_file)
             of.close()
             return of.name
     if is_ok_to_use_qt():
         d = QMessageBox(QMessageBox.Warning, "MobiDeDRM Plugin", "Couldn't decode: %s\n\nImporting encrypted version." % path_to_ebook)
         d.show()
         d.raise_()
         d.exec_()
     return path_to_ebook