View Single Post
Old 08-05-2015, 05:49 AM   #1331
arasyi
Zealot
arasyi ought to be getting tired of karma fortunes by now.arasyi ought to be getting tired of karma fortunes by now.arasyi ought to be getting tired of karma fortunes by now.arasyi ought to be getting tired of karma fortunes by now.arasyi ought to be getting tired of karma fortunes by now.arasyi ought to be getting tired of karma fortunes by now.arasyi ought to be getting tired of karma fortunes by now.arasyi ought to be getting tired of karma fortunes by now.arasyi ought to be getting tired of karma fortunes by now.arasyi ought to be getting tired of karma fortunes by now.arasyi ought to be getting tired of karma fortunes by now.
 
Posts: 105
Karma: 5885446
Join Date: Feb 2014
Device: Kobo Glo
Quote:
Originally Posted by davidfor View Post
That won't work. What if a format other that epub or kepub is being sent? The older versions of the plugin had some other checks. And that needs a call to the super method.
Oops. I didn't realize that this driver also handles other format as well.
If so, why can't you do it like this?
Code:
if mi.uuid not in self.skip_renaming_files:
    if path.endswith(KEPUB_EXT):
        path += EPUB_EXT
    elif path.endswith(EPUB_EXT) and not path.endswith(KEPUB_EXT + EPUB_EXT):
        path = os.path.splitext(path)[0] + KEPUB_EXT + EPUB_EXT
Or, just use the old method:
Code:
def filename_callback(self, path, mi):
    opts = self.settings()
    if opts.extra_customization[self.OPT_EXTRA_FEATURES]:
        debug_print("KoboTouchExtended:filename_callback:Path - {0}".format(path))

        idx = path.rfind('.')
        ext = path[idx:]
        if ext == KEPUB_EXT or (ext == EPUB_EXT and mi.uuid not in self.skip_renaming_files):
            path = "{0}.kepub{1}".format(path[:idx], EPUB_EXT)
            debug_print("KoboTouchExtended:filename_callback:New path - {0}".format(path))

    return path
That seems do the trick in my Glo. The books got sent with the correct filenames (tested with one pdf and one epub files).

Last edited by arasyi; 08-05-2015 at 05:53 AM.
arasyi is offline   Reply With Quote