From d4409a0411d7684fd18b3d8e43ad425e4b16a1a9 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 28 Dec 2010 20:50:32 +0530 Subject: [PATCH] ignore 0 byte files --- pandora_client/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pandora_client/__init__.py b/pandora_client/__init__.py index e546a8d..604c01a 100644 --- a/pandora_client/__init__.py +++ b/pandora_client/__init__.py @@ -125,12 +125,13 @@ class Client(object): break if update: info = utils.avinfo(path) - oshash = info['oshash'] - deleted = -1 - t = (path, oshash, stat.st_atime, stat.st_ctime, stat.st_mtime, - stat.st_size, json.dumps(info), created, modified, deleted) - c.execute(u'INSERT OR REPLACE INTO file values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', t) - conn.commit() + if info['size'] > 0: + oshash = info['oshash'] + deleted = -1 + t = (path, oshash, stat.st_atime, stat.st_ctime, stat.st_mtime, + stat.st_size, json.dumps(info), created, modified, deleted) + c.execute(u'INSERT OR REPLACE INTO file values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', t) + conn.commit() def scan(self): print "check for new files"