3 Commits

Author SHA1 Message Date
c60f1efb8b Merge branch 'release/0.4' 2016-08-04 10:32:23 +01:00
0f29c7c4eb Merge branch 'feature/0.3' 2016-02-03 22:37:06 +00:00
420e06abfb Merge branch 'feature/0.2' 2015-12-12 14:24:25 +00:00
3 changed files with 8 additions and 17 deletions

View File

@@ -48,7 +48,6 @@ def main():
parser.add_argument('--hide_future', help='Hide future dated next actions until the specified number of days',
default=7, type=int)
parser.add_argument('--onetime', help='Update Todoist once and exit', action='store_true')
parser.add_argument('--nocache', help='Disables caching data to disk for quicker syncing', action='store_true')
args = parser.parse_args()
# Set debug
@@ -65,15 +64,9 @@ def main():
# Run the initial sync
logging.debug('Connecting to the Todoist API')
api_arguments = {'token': args.api_key}
if args.nocache:
logging.debug('Disabling local caching')
api_arguments['cache'] = None
api = TodoistAPI(**api_arguments)
api = TodoistAPI(token=args.api_key)
logging.debug('Syncing the current state from the API')
api.sync()
api.sync(resource_types=['projects', 'labels', 'items'])
# Check the next action label exists
labels = api.labels.all(lambda x: x['name'] == args.label)
@@ -87,7 +80,7 @@ def main():
def get_project_type(project_object):
"""Identifies how a project should be handled."""
name = project_object['name'].strip()
if name == 'Inbox':
if project['name'] == 'Inbox':
return args.inbox
elif name[-1] == args.parallel_suffix:
return 'parallel'
@@ -119,7 +112,7 @@ def main():
# Main loop
while True:
try:
api.sync()
api.sync(resource_types=['projects', 'labels', 'items'])
except Exception as e:
logging.exception('Error trying to sync with Todoist API: %s' % str(e))
else:
@@ -149,11 +142,9 @@ def main():
if item_type or len(child_items) > 0:
# Process serial tagged items
if item_type == 'serial':
for child_item in child_items:
first_found = False
if child_item['checked'] == 0 and not first_found:
for idx, child_item in enumerate(child_items):
if idx == 0:
add_label(child_item, label_id)
first_found = True
else:
remove_label(child_item, label_id)
# Process parallel tagged items or untagged parents

View File

@@ -1 +1 @@
todoist-python>=7.0.10,<8.0.0
todoist-python==0.2.26

View File

@@ -2,7 +2,7 @@ from setuptools import setup
setup(
name='NextAction',
version='0.5-dev',
version='0.4',
py_modules=['nextaction'],
url='https://github.com/nikdoof/NextAction',
license='MIT',