From 9e2dd143a190f652a6da00d50aa4c6acb12506d4 Mon Sep 17 00:00:00 2001 From: Alex Zai Date: Fri, 4 Dec 2015 09:44:34 -0800 Subject: [PATCH] (feat) add slides --- src/config.py | 2 +- src/drive_api.py | 5 ++--- src/icons/slides.png | Bin 0 -> 28907 bytes src/util.py | 23 ++++++++--------------- 4 files changed, 11 insertions(+), 19 deletions(-) create mode 100644 src/icons/slides.png diff --git a/src/config.py b/src/config.py index 37e764a..3164168 100644 --- a/src/config.py +++ b/src/config.py @@ -9,7 +9,7 @@ AUTH_URL = 'https://accounts.google.com/o/oauth2/auth?scope=%(scope)s&redirect_uri=%(redirect_uri)s&response_type=code&client_id=%(client_id)s&access_type=offline&approval_prompt=force' % {'scope' : SCOPE, 'redirect_uri' : REDIRECT_URI, 'client_id' : CLIENT_ID} TOKEN_URL = 'https://www.googleapis.com/oauth2/v3/token' -FILES_URL = 'https://www.googleapis.com/drive/v2/files?fields=items&q=mimeType%3D%22application%2Fvnd.google-apps.document%22+or+mimeType%3D%22application%2Fvnd.google-apps.spreadsheet%22' +FILES_URL = 'https://www.googleapis.com/drive/v2/files?maxResults=1000&q=mimeType%3D%22application%2Fvnd.google-apps.document%22+or+mimeType%3D%22application%2Fvnd.google-apps.spreadsheet%22+or+mimeType%3D%22application%2Fvnd.google-apps.presentation%22&fields=items' CACHE_MAX_AGE = 60*60*24*30 # cache set to 1 month diff --git a/src/drive_api.py b/src/drive_api.py index 2c29820..145436e 100644 --- a/src/drive_api.py +++ b/src/drive_api.py @@ -83,8 +83,7 @@ def get_links(cls): if 'error' in response and cls.refresh(): return cls.get_links() else: - unfiltered_list = response['items'] - return util.filter_by_file_type(unfiltered_list, ['spreadsheet', 'document']) + return response['items'] @classmethod def refresh_list(cls): @@ -216,7 +215,7 @@ def add_items(cls, links): for index, link in enumerate(links): title = link['title'] alternateLink = link['alternateLink'] - icon = link['icon'] + icon = util.find_icon(link) wf.add_item( title=title, arg=alternateLink, diff --git a/src/icons/slides.png b/src/ic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on(): except urllib2.URLError as err: pass return False -def filter_by_file_type(list, file_types): - filter_list = [] - for index, link in enumerate(list): - type = '' - try: - type = link['mimeType'].split('.')[2] - except: - pass - if type in file_types: - # refactor - icon = './icons/sheets.png' if type == 'spreadsheet' else './icons/docs.png' - link['icon'] = icon - link['type'] = type - filter_list.append(link) - return filter_list +def find_icon(link): + if link['mimeType'] == 'application/vnd.google-apps.document': + icon = './icons/docs.png' + elif link['mimeType'] == 'application/vnd.google-apps.spreadsheet': + icon = './icons/sheets.png' + elif link['mimeType'] == 'application/vnd.google-apps.presentation': + icon = './icons/slides.png' + return icon