Пример #1
0
 def run(self):
     self.docs = os.path.join(self.kindlepath.get(), 'documents')
     self.stext.delete(1.0, END)
     self.status.set('Start processing your books...')
     tkMessageBox.showwarning(
         'Starting...',
         'Process is starting. Click OK button and wait for ' +
         'finish confirmation...',
         icon='question',
         parent=root
     )
     self.frame.update_idletasks()
     if self.days.get() == '':
         ec = extract_cover_thumbs(
             self.is_log.get(), self.is_overwrite_pdoc_thumbs.get(),
             self.is_overwrite_amzn_thumbs.get(),
             self.is_overwrite_apnx.get(),
             self.skip_apnx.get(), self.kindlepath.get(),
             self.docs, self.is_azw, None
         )
     else:
         ec = extract_cover_thumbs(
             self.is_log.get(), self.is_overwrite_pdoc_thumbs.get(),
             self.is_overwrite_amzn_thumbs.get(),
             self.is_overwrite_apnx.get(),
             self.skip_apnx.get(), self.kindlepath.get(),
             self.docs, self.is_azw, self.days.get()
         )
     if ec == 0:
         self.status.set('Process finished.')
         tkMessageBox.showwarning(
             'Finished...',
             'Process finished. Check Message Window for details...',
             icon='info',
             parent=root
         )
     elif ec == 1:
         self.status.set('Process finished with PROBLEMS!')
         tkMessageBox.showwarning(
             'Finished...',
             'Process finished with PROBLEMS! ' +
             'Check Message Window for details...',
             icon='warning',
             parent=root
         )
Пример #2
0
                csvwrite = csv.writer(o, delimiter=';', quotechar='"',
                                      quoting=csv.QUOTE_ALL)
                csvwrite.writerow(['asin', 'author', 'title', 'pages'])
        for dirpath, dirs, files in os.walk(docs):
            for file in files:
                file_extension = os.path.splitext(file)[1].lower()
                if file_extension not in ['.mobi', '.azw', '.azw3']:
                    continue
                print('* Processing: ' + file.decode(
                    sys.getfilesystemencoding()
                ) + '...')
                row = get_pages(dirpath, file)
                if row is None:
                    continue
                if row[0] in asinlist:
                    continue
                with open(mf, 'ab') as o:
                    csvwrite = csv.writer(o, delimiter=';', quotechar='"',
                                          quoting=csv.QUOTE_ALL)
                    csvwrite.writerow(row)
        print('* Dumping completed...')
    else:
        extract_cover_thumbs(args.silent, args.overwrite_pdoc_thumbs,
                             args.overwrite_amzn_thumbs,
                             args.overwrite_apnx, args.skip_apnx,
                             kindlepth, docs, args.azw, args.days)
    if sys.platform == 'darwin':
        ans_ok = user_yes_no_query('Eject Kindle?')
        if ans_ok:
            os.system('diskutil eject ' + kindlepth)