示例#1
0
 def _check_if_is_same_dir(self, entry, path):
     con_str = "sqlite://" + CATALOGDIR + entry
     conn = connectionForURI(con_str)
     metadircount = MetaDir.select(MetaDir.q.target == path,
                              connection = conn).count()
     if metadircount > 0:
         return MetaDir.select(MetaDir.q.target == path,
                              connection = conn)[0].target == path
示例#2
0
def get_correct_filename_from_catalog(entry):
    con_str = "sqlite://" + entry
    conn = connectionForURI(con_str)
    metadircount = MetaDir.select(connection = conn).count()
    if metadircount > 0:
        md = MetaDir.select(connection = conn)[0]
        datestr = md.date.strftime("%Y.%m.%d-%H.%M.%S")
        name = md.name
        return name + ".-." + datestr + ".db"
示例#3
0
 def __init__(self, dbmanager):
     self._dbmanager = dbmanager
     self._conn = dbmanager.conn
     MetaDir.createTable(connection = self._conn)
     FileAbstract.createTable(connection = self._conn)
     File.createTable(connection = self._conn)
     Directory.createTable(connection = self._conn)
     Video.createTable(connection = self._conn)
     Audio.createTable(connection = self._conn)
     Photo.createTable(connection = self._conn)
示例#4
0
def clean_catalog_dir():
    for file_ in os.listdir(CATALOGDIR):
        if file_.split(".")[-1] == "db-journal":
            os.remove(CATALOGDIR + file_)
    for file_ in os.listdir(CATALOGDIR):
        con_str = "sqlite://" + CATALOGDIR + file_
        conn = connectionForURI(con_str)
        metadircount = MetaDir.select(connection = conn).count()
        if metadircount == 0:
            os.remove(CATALOGDIR + file_)
示例#5
0
 def create_metadir(self):
     metadircount = MetaDir.select(connection = self._conn).count()
     if not metadircount == 1:
         root = Directory.select(Directory.q.strabs == self._indexer.path, connection = self._conn).getOne()
         self._factory.new_metadir(self._date, self._indexer.path,
                                   self._indexer.countfiles,
                                   self._indexer.countdirs, root.size,
                                   root.strsize, root.name, self._indexer.timer)
         return 0
     else:
         return 1
示例#6
0
 def populate_catalog_list(self):
     self._lsscanlist.clear()
     for _file in os.listdir(CATALOGDIR):
         con_str = "sqlite://" + CATALOGDIR + _file
         conn = connectionForURI(con_str)
         selectmetadir = MetaDir.select(connection = conn)
         if selectmetadir.count() == 1:
             metadir = selectmetadir.getOne()
             self._lsscanlist.append([gtk.icon_theme_get_default().\
                               load_icon(metadir.media_type, 64, gtk.ICON_LOOKUP_FORCE_SVG),
                               "<b>" + metadir.name + "</b>\nFiles: " + 
                               str(metadir.files) + "\nDirectories: " + 
                               str(metadir.dirs) + "\nSize: " + 
                               metadir.strsize, CATALOGDIR + _file])
             self._metadir_dict[CATALOGDIR + _file] = metadir
示例#7
0
 def __init__(self, searchhandler, filename):
     self._searchhandler = searchhandler
     self._filename = filename
     con_str = "sqlite://" + CATALOGDIR + filename
     self._con = sqlobject.connectionForURI(con_str)
     self._metadir = MetaDir.select(connection = self._con)[0]
示例#8
0
def get_scanned_path_from_catalog(entry):
    con_str = "sqlite://" + entry
    conn = connectionForURI(con_str)
    metadircount = MetaDir.select(connection = conn).count()
    if metadircount > 0:
        return MetaDir.select(connection = conn)[0].target