From 70605926ec408bf4c2d46dddc24a3a487a1e6ab9 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 4 Feb 2013 18:38:02 +0530 Subject: [PATCH] warn about files not withint folder depth --- pandora_client/__init__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pandora_client/__init__.py b/pandora_client/__init__.py index cc33e7d..3b4c68e 100644 --- a/pandora_client/__init__.py +++ b/pandora_client/__init__.py @@ -178,6 +178,7 @@ class Client(object): r = self.api.signin(username=self._config['username'], password=self._config['password']) if r['status']['code'] == 200 and not 'errors' in r['data']: self.user = r['data']['user'] + self.folderdepth = r['data']['site'].get('folderdepth', 3) else: self.user = False print '\nlogin failed! check config\n\n' @@ -317,6 +318,8 @@ class Client(object): volumes = self.active_volumes() for name in sorted(volumes): path = volumes[name] + if not path.endswith('/'): + path += '/' conn, c = self._conn() c.execute('SELECT path FROM file WHERE path LIKE ? AND deleted < 0', ["%s%%"%path]) known_files = [r[0] for r in c.fetchall()] @@ -346,6 +349,16 @@ class Client(object): c.execute('UPDATE file SET deleted=? WHERE path=?', (deleted, f)) conn.commit() + ignored=[] + for f in files: + f = f[len(path):] + if len(f.split('/')) == self.folder_depth and not 'Versions' in f or 'Extras' in f: + ignored.append(f) + if ignored: + example = self.folder_depth == 4 and 'L/Last, First/Title (Year)/Title.avi' or 'T/Title/Title.dv' + print 'The following files do not conform to the required folder structure and will be ignored. only files like this are synced:\n\t%s' % example + print '\n'.join(ignored) + print "scanned volume %s: %s files, %s new, %s deleted" % ( name, len(files), len(new_files), len(deleted_files))