Compare commits

...

54 Commits

Author SHA1 Message Date
Hoffelhas 335cb3ae75 Update README.me to v2.0 2023-01-15 22:17:09 +01:00
Hoffelhas 6a0b64f256
Update README v2.0 2023-01-15 22:11:11 +01:00
Hoffelhas a560a59857 Final preparations for v2.0 2023-01-15 22:00:00 +01:00
Hoffelhas 1f8f6ab182
Merge pull request #31 from obbardc/wip/obbardc/docker-dev
Build and publish Docker image in GitHub actions
2023-01-15 21:57:12 +01:00
Hoffelhas 8a1bc1d5ec Final preparations for v2.0 2023-01-15 21:55:30 +01:00
Hoffelhas 2ce81df5bd
Update README to v2.0 functionalities 2023-01-15 18:10:43 +01:00
Hoffelhas 956f5176af Final preparations for v2.0 2023-01-15 16:38:34 +01:00
Hoffelhas 8fe99f4942
Update README to v2.0.0 functionality. 2023-01-15 15:50:00 +01:00
Hoffelhas 78dca0483e
Update README to v2.0.0 functionality. 2023-01-15 15:48:22 +01:00
Hoffelhas 565967cdc1
Update README to v2.0.0 functionality. 2023-01-15 15:44:37 +01:00
Hoffelhas d6d1ba121f
Update README to v2.0.0 functionality. 2023-01-15 15:42:17 +01:00
Hoffelhas 8b23fbd59a Final preparations for v2.0 2023-01-15 14:08:25 +01:00
Hoffelhas a4f99fa0c1 Minor clean-up of code 2023-01-15 13:53:28 +01:00
Hoffelhas a66905e88c Only sync changes if api.queue has content. Else we'll time out after 45 minutes of no changes. 2023-01-15 11:02:26 +01:00
Hoffelhas cf57687068 Implemented the filtered lists. Significant decrease of api requests and noticable speed-up! 2023-01-15 00:24:17 +01:00
Hoffelhas adb7ae86de Build project and section dictionary from api.get_tasks() to save on api requests. Still todo: implement this into the loops. 2023-01-14 23:57:22 +01:00
Hoffelhas 8541f06d92 Implemented SYNC API and commit queue, to ensure task content updates are sent in batches. This to ensure we don't run into the requests limits. 2023-01-14 22:01:09 +01:00
Hoffelhas b741b83b14 Added possibility to ignore section labelling by providing a * either at the start or end of the section name. Useful for additional flexibility with e.g. kanban board. 2023-01-13 21:32:06 +01:00
Christopher Obbard 0231937b8f Build and publish Docker image in GitHub actions
Add the ability to build a Docker image in GitHub actions and push that
image to the GitHub container registry.

Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2023-01-13 18:13:17 +00:00
Christopher Obbard 2ee1088e9c Add Dockerfile
Add a Dockerfile to have the ability to build a container from the app.

Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2023-01-13 18:13:17 +00:00
Christopher Obbard f47e974c7c Allow setting Todoist API key from environment variable
In the Docker world, secrets (e.g. passwords, API keys) are usually shared
with an application as environment variables so that they can be imported
from separate secure areas: in docker-compose you can specify a file
where secrets are imported from as environment variables.

Read the API key from the TODOIST_API_KEY environment variable first, then
check the command-line argument.

Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2023-01-13 18:11:53 +00:00
Hoffelhas 1312474e53 Manually added a similar fix as proposed in pull request #20 2023-01-13 18:02:46 +01:00
Hoffelhas e41dab3156 Minor cleanup 2023-01-13 17:02:53 +01:00
Hoffelhas 3a02d0d8c9 Fixed merge issues 2023-01-13 17:01:43 +01:00
Hoffelhas 4dcce138c0 Added logic to show correct change counter in terminal 2023-01-13 16:58:16 +01:00
Hoffelhas 707482cf17 Adding and removing headers defined on parentless task level now processes all children correctly. 2023-01-13 16:35:00 +01:00
Hoffelhas bf6ce05ad8 bugfix needed: modify_headers does seem to work correctly at parentless task level 2023-01-12 21:42:21 +01:00
Hoffelhas e1c0060afb check_header function updated 2023-01-12 21:32:51 +01:00
Hoffelhas 685da743ab Fix found for updating the due task date, which keeps the recurring string intact 2023-01-12 21:04:49 +01:00
Hoffelhas 7f766a5df7 Minor update 2023-01-10 20:24:33 +01:00
Hoffelhas ce8044d5a7 Minor update to get_all_data 2023-01-10 20:20:54 +01:00
Hoffelhas 619489a1d0 Initial update of check_header function. Still to finish and test 2023-01-09 22:33:15 +01:00
Hoffelhas af63bb97c0 Minor addition of logging 2023-01-09 21:45:08 +01:00
Hoffelhas 24d88460fb Changed end-of-day functionality, but apparently updating the due-date with the new API will remove the recurring settings. Brilliant. Need to find a fix for this. 2023-01-08 22:23:54 +01:00
Hoffelhas 4aad462ce3 Start=due-x functionality working again. Time set by user is now also included in the diff calculation 2023-01-08 18:42:16 +01:00
Hoffelhas 81769968ae Start=DD-MM-YYYY functionality working again. 2023-01-08 18:13:06 +01:00
Hoffelhas 43e598a87a Fixed -hf flag not working correctly 2023-01-08 17:37:24 +01:00
Hoffelhas b2f2fa270e Bugfix where manually changing the order of sequential tasks would not remove old labels. 2023-01-08 17:11:47 +01:00
Hoffelhas 97a7073f1c Minor cleanup of code 2023-01-08 16:21:50 +01:00
Hoffelhas a589c159c0 Type indication now seems to work on all levels 2023-01-08 15:32:21 +01:00
Hoffelhas 86eb720f50 Overhaul labelling functionality now working on project level. Next: debug section and parentless tasks level. 2023-01-08 14:58:49 +01:00
Hoffelhas aa274d5132 Additional testing of labelling logic 2023-01-07 16:13:43 +01:00
Hoffelhas e9b2dd6f21 Fixed labelling bug with SEQ mode due to legacy code 2023-01-07 15:44:56 +01:00
Hoffelhas fc9aa8da4f Children are now cleaned correctly after task_type change 2023-01-07 15:07:57 +01:00
Hoffelhas 0c64e99455 Core labelling functionality now seems to function. Still need to fix one bug with cleaning children if task_type is set. 2023-01-04 21:12:39 +01:00
Hoffelhas 4a236153d0 Added 'get_all_data' function to use the SYNC API v9 to obtain all the data in your Todoist. Needed for seeing e.g. completed tasks, which the REST API v2 does not provide. 2023-01-04 10:01:00 +01:00
Hoffelhas 374d216a83 Basic SQLite DB functionality now working. Next: rewrite 'get_task_type()' function, and start some refactoring/debugging. 2023-01-03 16:06:46 +01:00
Hoffelhas 2625547002 Basic labelling functionality working again. Still need to fix metadata storage 2023-01-02 16:28:16 +01:00
Hoffelhas 95a71524cd Initial changes made to REST API. Working on a Sync API workaround to find completed tasks now. 2022-12-17 19:31:19 +01:00
Hoffelhas 3a25e05aa3 Initial check of 'T0 task date has changed' still included the time, hence check always failed. Now [:10] has been added to exclude a time during the check 2021-09-20 13:26:47 +02:00
Hoffelhas 7857a397fc Times in a due date could now be processed. At the moment, only the first 10 string characters are read, which only includes 'YYYY-MM-DD'. This has been updated for all relevant variables which use the due date. 2021-08-24 16:14:22 +02:00
Hoffelhas 482f27ff50 Added hotfix for detection of underscore replacement of the exclamation mark 2021-08-24 14:49:34 +02:00
Hoffelhas 2dd6f06b13
Merge pull request #15 from GwyndolynMarchant/datefix
Fix for shifted end-of-day
2021-08-24 14:22:10 +02:00
Gwyndolyn Marchant d0b074e0fe fix for shifted end-of-day 2021-06-16 23:02:27 -04:00
7 changed files with 1215 additions and 571 deletions

41
.github/workflows/ci.yaml vendored Normal file
View File

@ -0,0 +1,41 @@
name: Build and publish Docker image
on:
push:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-publish-docker-image:
name: Build and publish Docker image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

10
Dockerfile Normal file
View File

@ -0,0 +1,10 @@
FROM python:3-slim-bullseye
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
ENTRYPOINT [ "python", "./autodoist.py" ]

View File

@ -1 +0,0 @@
nextaction: python nextaction.py -a $TODOIST_API_KEY -l $TODOIST_NEXT_ACTION_LABEL $DEBUG --nocache

105
README.md
View File

@ -1,13 +1,15 @@
# Autodoist
*Note: v2.0 is a major overhaul of Autodoist, so please be sure to view the README in order to get up to speed with the latest changes. Thanks to everyone for helping out and supporting this project!*
This program adds four major functionalities to Todoist to help automate your workflow:
1) Assign automatic next-action labels for a more GTD-like workflow
1) Assign automatic `@next_action` labels for a more GTD-like workflow
- Flexible options to label tasks sequentially or in parallel
- Limit labels based on a start-date or hide future tasks based on the due date
2) Enable regeneration of sub-tasks in lists with a recurring date. Multiple modes possile.
2) [Temporary disabled] Enable regeneration of sub-tasks in lists with a recurring date. Multiple modes possible.
3) Postpone the end-of-day time to after midnight to finish your daily recurring tasks
4) Make multiple items (un)checkable at the same time
4) Make multiple tasks (un)checkable at the same time
If this tool helped you out, I would really appreciate your support by providing me with some coffee!
@ -17,7 +19,7 @@ If this tool helped you out, I would really appreciate your support by providing
# Requirements
Autodoist has been build with Python 3.9.1, which is the recommended version. Older versions of 3.x should be compatible, however be aware that they have not been tested.
Autodoist has been build with Python 3.11.1, which is the recommended version. Older versions of 3.x should be compatible, however be aware that they have not been tested.
To run Autodoist the following packages are required:
* ```todoist-python```
@ -29,53 +31,75 @@ For your convenience a requirements.txt is provided, which allows you to install
# 1. Automatic next action labels
The program looks for pre-defined tags in the name of every project, section, or parentless tasks in your Todoist account to automatically add and remove `@next_action` labels. To create a simple list of all your next actions you can add a new filter in your Todoist with e.g.: @next_action & #project_name.
The program looks for pre-defined tags in the name of every project, section, or parentless tasks in your Todoist account to automatically add and remove `@next_action` labels.
Projects, sections, and parentless tasks can be tagged independently from each other to create the required functionality. If this tag is not defined, it will not activate this functionality. The result will be a clear, current and comprehensive list of next actions without the need for further thought.
Projects, sections, and parentless tasks can be tagged independently of each other to create the required functionality. If this tag is not defined, it will not activate this functionality. The result will be a clear, current and comprehensive list of next actions without the need for further thought.
See the example given at [running Autodoist](#running-autodoist) on how to run this mode. If the label does not exist yet in your Todoist, a possibility is given to automatically create it. Todoist Premium is required in order to use labels and to make this functionality possible.
See the example given at [running Autodoist](#running-autodoist) on how to run this mode. If the label does not exist yet in your Todoist, a possibility is given to automatically create it.
## Useful filter tip
For a more GTD-like workflow, you can use Todoist filters to create a clean and cohesive list that only contains your actionable tasks. As a simple example you could use the following filter:
For a more GTD-like workflow, you can use Todoist filters to create a clean and cohesive list that only contains your actionable tasks. As a simple example, you could use the following filter:
`@next_action & #PROJECT_NAME`
## Sequential processing
If a project, section, or parentless task ends with `--`, both the parentless tasks and its sub-tasks will be treated as a priority queue and the most important will be labeled. Importance is determined by order in the list.
If a project, section, or parentless task ends with a dash `-`, the tasks will be treated sequentially in a priority queue, where only the first task that is found is labeled. If a task contains sub-tasks, the first lowest task is labeled instead.
![Serial task](https://i.imgur.com/SUkhPiE.gif)
![Sequential task labeling](https://i.imgur.com/ZUKbA8E.gif)
## Parallel processing
If a project, section, or parentless task name ends with `//`, both the parentless tasks and its sub-tasks will be treated as parallel. A waterfall processing is applied, where the lowest possible sub-tasks are labelled.
If a project, section, or parentless task name ends with an equal sign `=`, all tasks will be treated in parallel. A waterfall processing is applied, where the lowest possible (sub-)tasks are labelled.
![Parallel task](https://i.imgur.com/NPTLQ8B.gif)
![Parallel task labeling](https://i.imgur.com/xZZ0kEM.gif)
## Advanced labelling
If a project or section ends with `-/`, all parentless tasks are processed sequentially, and its sub-tasks in parallel.
Projects, sections, and (parentless) tasks can be used to specify how the levels under them should behave. This means that:
[See example](https://i.imgur.com/uGJFeXB.gif)
- A project can accept up to three tags, to specify how the sections, parentless tasks, and subtasks should behave.
- A section can accept up to two tags, to specify parentless tasks and subtasks should behave.
- A task at any level can be labelled with one tag, to specify how its sub-tasks should behave.
If a project or section ends with `/-`, all parentless tasks are processed in parallel, and its sub-tasks sequentially.
Tags can be applied on each level simultaneously, where the lower level setting will always override the one specified in the levels above.
[See example](https://i.imgur.com/5lZ1BVI.gif)
### Shorthand notation
Any parentless task can also be be given a type by appending `//` or `--` to the name of the task. This works if there is no project type, and will override a previously defined project type.
If fewer tags then needed are specified, the last one is simply copied. E.g. if a project has the tag `=` this is similar to `===`, or if a project has `=-` this is similar to `=--`. Same for sections, `=` is similar to `==`.
[See example 1 with a parallel project](https://i.imgur.com/d9Qfq0v.gif)
### Project labeling examples
- If a project ends with `---`, only the first section has tasks that are handled sequentially.
- If a project ends with `=--`, all sections have tasks that are handled sequentially.
- If a project ends with `-=-`, only the first section has parallel parentless tasks with sequential sub-tasks.
- If a project ends with `--=`, only the first section and first parentless tasks has parallel sub-tasks.
- If a project ends with `==-`, all sections and all parentless tasks will have sub-tasks are handled sequentially.
- If a project ends with `=-=`, all sections will have parentless tasks that are processed sequentially, but all sub-tasks are handled in parallel.
- If a project ends with `-==`, only the first section has parallel tasks.
- If a project ends with `===`, all tasks are handled in parallel.
[See example 2 with a serial project](https://i.imgur.com/JfaAOzZ.gif)
### Section labeling examples
- If a section ends with `--`, only the first parentless task will have sub-tasks that are handled sequentially.
- If a section ends with `=-`, all parentless tasks will have sub-tasks that are handled sequentially.
- If a section ends with `-=`, only the first parentless task has sub-tasks that are handled in parallel.
- If a section ends with `==`, all tasks are handled in parallel.
### Tasks labeling examples
- If a task ends with `-`, the sub-tasks are handled sequentially.
- If a task ends with `=`, the sub-tasks are handled in parallel.
### Kanban board labeling
A standard workflow for Kanban boards is to have one actionable task per column/section, which is then moved to the next column when needed. Most often, the most right column is the 'done' section. To ensure that every column only has one labelled task and the last column contains no labelled tasks, you could do either of two things:
- Add the `=--` tag to the project name, and disable labelling for the 'done' section by adding `*` to either the start or end of the section name.
- Add the `--` tag to every section that you want to have labels.
Note: Todoist sections don't like to have a slash in the name, it will automatically change to an underscore. The default label options will recognize this to make it work regardless. Of course you're always free to define your own custom label symbols.
## Start/Due date enhanced experience
Two methods are provided to hide tasks that are not relevant yet.
- Prevent labels by defining a start-date that is added to the task itself. The label is only assigned if this date is reached. You can define the start-date by adding 'start=DD-MM-YYYY'. On the other hand the start date can be defined as several days or weeks before the due-date by using either 'start=due-<NUMBER_OF_DAYS>d' or 'start=due-<NUMBER_OF_WEEKS>w'. This is especially useful for recurring tasks!
- Prevent labels by defining a start-date that is added to the task itself. The label is only assigned if this date is reached. You can define the start-date by adding 'start=DD-MM-YYYY'. On the other hand, the start date can be defined as several days or weeks before the due-date by using either 'start=due-<NUMBER_OF_DAYS>d' or 'start=due-<NUMBER_OF_WEEKS>w'. This is especially useful for recurring tasks!
[See an example of using start-dates](https://i.imgur.com/WJRoJzW.png).
- Prevent labels of all tasks if the due date is too far in the future. Define the amount by running with the argument '-hf <NUMBER_OF_DAYS>'.
@ -83,7 +107,13 @@ Two methods are provided to hide tasks that are not relevant yet.
# 2. Regenerate sub-tasks in recurring lists
The program looks for all parentless tasks with a recurring date. If they contain sub-tasks, they will be regenerated in the same order when the parentless task is checked. Todoist Premium is not required for this functionality.
*DISCLAIMER: This feature has been disabled for now due to two reasons:*
- *Regeneration is a [core feature of Todoist nowadays](https://todoist.com/help/articles/can-i-reset-sub-tasks). This was made possible thanks to all of you who are using and supporting Autodoist, which resulted in Doist to include this too! Thank you all for making this happen!*
- *In the new REST API v2 it's currently not possible to see completed tasks, which makes regeneration a bit difficult.*
*Nevertheless, the Todoist implementation is still more limited than Autodoist, it does not restore the original order of the sub-tasks, and deeper sub-tasks can't be reset. I therefore believe it is still useful for this feature to be re-enabled in the near future.*
Autodoist looks for all parentless tasks with a recurring date. If they contain sub-tasks, they will be regenerated in the same order when the parentless task is checked.
![See example](https://i.imgur.com/WKKd14o.gif)
@ -94,21 +124,21 @@ To give you more flexibility, multiple modes are provided:
When this functionality is activated, it is possible to chose which mode is used as overall functionality for your Todoist. See the example given at [running Autodoist](#running-autodoist).
In addition you can override the overall mode by adding the labels `Regen_off`, `Regen_all`, or `Regen_all_if_completed` to one of your main recurrings task. These labels will automatically be created for you.
In addition you can override the overall mode by adding the labels `Regen_off`, `Regen_all`, or `Regen_all_if_completed` to one of your main recurring task. These labels will automatically be created for you.
# 3. Postpone the end-of-day
You have a daily recurring task, but you're up working late and now it's past midnight. When this happens Todoist will automatically mark it overdue, and when checked by you it moves to tomorrow. This means that after a good nights rest you can't complete the task that day!
You have a daily recurring task, but you're up working late and now it's past midnight. When this happens, Todoist will automatically mark it overdue and when checked by you it moves to tomorrow. This means that after a good night's rest you can't complete the task that day!
By setting an alternative time for the end-of-day you can now finish your work after midnight and the new date will automatically be corrected for you. Todoist Premium is not required for this functionality.
By setting an alternative time for the end-of-day you can now finish your work after midnight and the new date will automatically be corrected for you.
![See example 1](https://i.imgur.com/tvnTMOJ.gif)
# 4. Make multiple items uncheckable / re-checkable at the same time
# 4. Make multiple tasks uncheckable / re-checkable at the same time
Todoist allows the asterisk symbol `* ` to be used to ensure tasks can't be checked by turning them into headers. Now you are able to do this en masse!
Simply add `** ` or `!* ` in front of a project, section, or top item, to automatically turn all the items that it includes into respectively headers or checkable tasks. Note: when used in a project title or section title, Todoist will replace an exclamation mark with an underscore; this functionality should nevertheless still work.
Simply add `** ` or `-* ` in front of a project, section, or parentless task to automatically turn all the tasks that it includes into respectively headers or checkable tasks.
# Executing Autodoist
@ -122,7 +152,7 @@ If you want to enable labelling mode, run with the `-l` argument:
python autodoist.py -a <API Key> -l <LABEL_NAME>
If you want to enable regeneration of sub-tasks in recurring lists, run with the `-r` argument followed by a mode number for the overall functionality (1: no regeneration, 2: regenerate all, 3: regenerate ony if all sub-tasks are completed):
If you want to enable regeneration of sub-tasks in recurring lists, run with the `-r` argument followed by a mode number for the overall functionality (1: no regeneration, 2: regenerate all, 3: regenerate only if all sub-tasks are completed):
python autodoist.py -a <API Key> -r <NUMBER>
@ -136,10 +166,12 @@ These modes can be run individually, or combined with each other.
Several additional arguments can be provided, for example to change the suffix tags for parallel and sequential projects:
python autodoist.py --pp_suffix <tag>
python autodoist.py --ss_suffix <tag>
python autodoist.py --p_suffix <tag>
python autodoist.py --s_suffix <tag>
Or if you want to hide all tasks due in the future:
Note: Be aware that Todoist sections don't like to have a slash '/' in the name, which will automatically change to an underscore. Detection of the tag will not work.
If you want to hide all tasks due in the future:
python autodoist.py --hf <NUMBER_OF_DAYS>
@ -150,3 +182,14 @@ In addition, if you experience issues with syncing you can increase the api sync
For all arguments, please check out the help:
python autodoist.py --help
## Docker container
To build the docker container, check out the repository and run:
docker build . --tag autodoist:latest
To run autodoist inside the docker container:
docker run -it autodoist:latest

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +1,2 @@
requests>=2.25.1
todoist_python>=8.1.3
requests==2.28.1
todoist_api_python==2.0.2

View File

@ -2,12 +2,12 @@ from setuptools import setup
setup(
name='autodoist',
version='1.5',
version='2.0',
py_modules=['autodoist'],
url='https://github.com/Hoffelhas/automation-todoist',
license='MIT',
author='Alexander Haselhoff',
author_email='alexander.haselhoff@outlook.com',
author_email='xela@live.nl',
description='Added functionality for Todoist: 1) next-action labels, 2) sub-task regeneration, 3) postpone end of day, and 4) (un)header items simultaneously)',
install_requires=[
'todoist-python',