Esempio n. 1
0
def find_book_and_author(lib_dir=cfg['CALIBRE_LIBRARY'], file_type='*.mobi'):
    lib_dir = os.path.abspath(lib_dir)
    author_position = len(lib_dir.split('/'))
    book_position = -1

    for book_path in ifind_files(lib_dir, file_type):
        chunks = book_path.split('/')
        yield book_path, chunks[author_position], chunks[book_position]
Esempio n. 2
0
def convert_epubs_to_mobi(source_dir, target_dir):
    for book_path in ifind_files(source_dir, '*.epub'):
        convert(book_path, target_dir)
Esempio n. 3
0
def gather_epub(lib_dir=cfg['CALIBRE_LIBRARY'], target_dir='.'):
    for src in ifind_files(lib_dir, pattern='*.epub'):
        dst = os.path.abspath(os.path.join(target_dir, os.path.split(src)[0]))
        copy_file(src, dst)