From fc72c48908132d181122710c79ab60c21cb166b0 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 18 Nov 2012 19:18:25 +0100 Subject: [PATCH] upload info in upload stage, ignore ~ temp files --- pandora_client/__init__.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pandora_client/__init__.py b/pandora_client/__init__.py index 236a5be..fd4f21e 100644 --- a/pandora_client/__init__.py +++ b/pandora_client/__init__.py @@ -329,7 +329,9 @@ class Client(object): for filename in sorted(filenames): if isinstance(filename, str): filename = filename.decode('utf-8') - if not filename.startswith('._') and not filename in ('.DS_Store', ): + if not filename.startswith('._') \ + and not filename in ('.DS_Store', ) \ + and not filename.endswith('~'): file_path = os.path.join(dirpath, filename) if os.path.exists(file_path) and os.stat(file_path).st_size>0: files.append(file_path) @@ -487,7 +489,19 @@ class Client(object): r = self.api.update(post) data = r['data']['data'] files = r['data']['file'] + info = r['data']['info'] + if info: + print 'info for %d files requested' % len(info) + post = {'info': {}} + for oshash in info: + i = self.info(oshash) + if i: + post['info'][oshash] = i + if post['info']: + print 'uploading info for %d files' % len(post['info']) + r = self.api.update(post) + if files: print 'uploading %s files' % len(files) for oshash in files: