Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 07-13-2010, 03:09 PM   #1
tobidope
Junior Member
tobidope began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jul 2010
Device: Kindle 2
Calibre leaving behind garbage in the filesystem?

Hello

after looking through my Calibre folder I noticed there are some folders which don't have a corresponding author. It seems that after reorganizing my library old files are left behind leading to duplicated files. Can anyone else confirm this? I cleaned my Calibre folder with the following python script
Code:
# -*- coding: utf8 -*-
import os
import shutil
import sqlite3

BASE_PATH = r'C:\Users\tobias\Documents\My Dropbox\Public\Calibre Bibliothek'
DB = 'metadata.db'
CALIBRE2OPDS_FOLDER = '_catalog'

con = sqlite3.connect(os.path.join(BASE_PATH, DB))
db_folders = set(n[0].split('/')[0] for n in con.execute('select path from books').fetchall())
con.close()
file_folders = set(d for d in os.listdir(BASE_PATH)
                   if os.path.isdir(os.path.join(BASE_PATH, d)) and
                   d != CALIBRE2OPDS_FOLDER)

for f in file_folders - db_folders:
    print("Deleting unused directory {0}".format(f))
    shutil.rmtree(os.path.join(BASE_PATH, f))
I haven't opened a bug till now. Still wondering if I'm doing something wrong.

Regards
Tobias
tobidope is offline   Reply With Quote
Old 07-13-2010, 03:17 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,950
Karma: 5036099
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
calibre will leave behind folders if they are not empty (i.e. they contain files not managed by calibre).
kovidgoyal is online now   Reply With Quote
Old 07-13-2010, 03:25 PM   #3
tobidope
Junior Member
tobidope began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jul 2010
Device: Kindle 2
But I can't remember adding files manually. All folders seemed to be from books which had the wrong author after adding the book. After changing the metadata of the book the old folder was left behind with all files. I keep watching it and will file a bug when I can reproduce it. By the way, great app! My donation should arrive soon!
tobidope is offline   Reply With Quote
Old 07-13-2010, 03:39 PM   #4
itimpi
Wizard
itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.
 
Posts: 4,055
Karma: 777825
Join Date: Nov 2008
Device: Sony PRS-950, iphone/ipad (Marvin/iBooks/QuickReader)
I notice that you have CALIBRE2OPDS mentioned in your script. Recent releases of calibre2opds adds a thumbnail file to the calibre book folders so if the only file left behind is a .jpg or a .png file this might be the culprit? If it is the case then mention it here and then we can see if something can be done about that for the future.
itimpi is offline   Reply With Quote
Reply

Tags
bug

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre puts garbage JPG files on the Nook HunterZ Calibre 25 09-12-2010 09:23 AM
Leaving iRex for Nook jjansen iRex 2 08-01-2010 01:26 PM
any harm from leaving the reader turned on? ebooker Sony Reader 11 11-21-2009 04:41 AM
Leaving Calibre running kills my desktop manager rogue_ronin Calibre 3 10-24-2009 08:27 PM
Any reason to load books using Calibre instead of copying to filesystem? radius Calibre 4 08-07-2008 03:05 AM


All times are GMT -4. The time now is 06:29 AM.


MobileRead.com is a privately owned, operated and funded community.