-
Notifications
You must be signed in to change notification settings - Fork 30
Closed
Description
Hello,
I'm trying to integrate Taskwarrior with Claws-mail client and for the purpose I've modified the mutt2task script as follows (my Python skills are very rusty):
#!/usr/bin/env python3
"""
Creates a new task with the given message's filename as annotation attachment.
"""
import email
import sys
from tasklib import TaskWarrior, Task
def get_task_description(message):
description = 'claws: "{}"'.format(message['subject'])
return description
def main():
try:
file_name = sys.argv[1]
fp = open(file_name)
message = email.message_from_file(fp)
desc = get_task_description(message)
tw = TaskWarrior(data_location='~/task', create=False)
task = Task(tw, description=desc, tags=['inbox','email'])
task.save()
task.add_annotation(str(file_name))
except Exception as e:
print(e)
sys.exit(2)
if __name__ == "__main__":
main()
which I try to use as Claws-mail's User Action.
The problem is that the script does not work all the time, iow. sometimes when invoked as:
claws2task /home/gour/.claws-mail/newscache/news.gmane.io/gmane.mail.sylpheed.claws.general/76558
it produces the following output:
Unique identifiers 177 with description: claws: "Re: Action to integrate Claws with Taskwarrior" matches multiple tasks: ['']
and sometimes it simply works correctly and creates a task with appropriate annotatation - I plan to add custom .desktop file to be able to use xdg-open to open annotated link with claws-mail --select somemsg.
Do you have any idea why the script does not work reliably?
Sincerely,
Gour
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels