Skip to content

Commit

Permalink
adds *@remind*
Browse files Browse the repository at this point in the history
  • Loading branch information
bevesce committed Aug 10, 2013
1 parent 70a6eb3 commit 2041366
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 6 deletions.
7 changes: 6 additions & 1 deletion README.md
Expand Up @@ -10,6 +10,7 @@ This is something that I use everyday and works as it is but I add things when I


# Changelog # # Changelog #


- 2013-08-10 - added actions for **@remind** tag
- 2013-08-10 - added actions for **@followup** tag - 2013-08-10 - added actions for **@followup** tag
- 2013-08-10 - added todify - iOS pythonista script that adds task tagged with *@today* to notification center - 2013-08-10 - added todify - iOS pythonista script that adds task tagged with *@today* to notification center
- 2013-05-19 - minor improvement in how abbreviations in queries are expanded - 2013-05-19 - minor improvement in how abbreviations in queries are expanded
Expand Down Expand Up @@ -291,7 +292,7 @@ At the moment no tasks are removed from Onhold.todo.


### end_the_day ### end_the_day


Joins several of other scripts. Launchd runs it for me at the and of the day. Joins several of other scripts. Launchd runs it for me at the and of the day.


### reminders_to_topy ### ### reminders_to_topy ###


Expand All @@ -300,6 +301,10 @@ some path must be adjusted in AppleScript *reminders_to_topy.applescript*.


It allows to put items into Inbox with Siri on iOS (just put reminder in *Inbox* list and import it when on Mac or set this script in launchd). It allows to put items into Inbox with Siri on iOS (just put reminder in *Inbox* list and import it when on Mac or set this script in launchd).


### remind

Adds items tagged with **@remind(YYYY-MM-DD)** to Reminders.app and changes tag to **@willremind(YYYY-MM-DD)**.

### itopy, utopy, qtopy, todify ### ### itopy, utopy, qtopy, todify ###


Version of script to use in [Pythonista](http://omz-software.com/pythonista/) iOS app. Most of the source was merged to not clutter scripts list in app. Requires [seamless dropbox](https://github.com/bevesce/Seamless-Dropbox) Version of script to use in [Pythonista](http://omz-software.com/pythonista/) iOS app. Most of the source was merged to not clutter scripts list in app. Requires [seamless dropbox](https://github.com/bevesce/Seamless-Dropbox)
Expand Down
8 changes: 7 additions & 1 deletion topy/src/todolist_utils.py
Expand Up @@ -29,7 +29,9 @@ def custom_tag_regexp(tag):
def add_tag_to_text(text, tag, param=None): def add_tag_to_text(text, tag, param=None):
if text[-1] != ' ': if text[-1] != ' ':
text += ' ' text += ' '
text += "@" + tag if not tag.startswith('@'):
tag = '@' + tag
text += tag
if param: if param:
text += '({0})'.format(param) text += '({0})'.format(param)
return text return text
Expand Down Expand Up @@ -84,6 +86,10 @@ def remove_trailing_tags(line):
return ' @'.join(sp[0:idx]) return ' @'.join(sp[0:idx])




def remove_tags(line):
return tag_pattern.sub('', line)


def extract_content(typ, line): def extract_content(typ, line):
text = extract_text(typ, line) text = extract_text(typ, line)
if typ in ('task', 'note'): if typ in ('task', 'note'):
Expand Down
21 changes: 21 additions & 0 deletions utilities/create_reminder.py
@@ -0,0 +1,21 @@
import subprocess

applescript_template = """tell application \\"Reminders\\"
set r to make new reminder
set name of r to \\"{name}\\"
set body of r to \\"{body}\\"
set remind me date of r to date \\"{reminde_me_date}\\"
end tell"""


def create_reminder(name, body, reminde_me_date):
reminde_me_date = reminde_me_date.strftime('%d-%m-%Y %H:%M')
applescript = applescript_template.format(
name=name,
body=body,
reminde_me_date=reminde_me_date,
)
cmd = 'echo "{0}" | osascript'.format(applescript)
subprocess.check_output(
cmd, shell=True
)
6 changes: 2 additions & 4 deletions utilities/end_the_day.py
Expand Up @@ -3,12 +3,12 @@
import topy import topy
# from archive import archive # from archive import archive
from update_lists import update_daily, update_weekly, update_waiting, update_followups from update_lists import update_daily, update_weekly, update_waiting, update_followups
from remind import set_reminders
from tvcal import tvcal from tvcal import tvcal
from log_to_day_one import log_to_day_one from log_to_day_one import log_to_day_one


all_lists = topy.from_files(topy.lists.to_list()) all_lists = topy.from_files(topy.lists.to_list())
inbox_file = open(inbox_path, 'a') inbox_file = open(inbox_path, 'a')
# archive_list = topy.from_file(archive_path)
onhold_list = topy.from_file(onhold_path) onhold_list = topy.from_file(onhold_path)


log_to_day_one(all_lists.deep_copy()) log_to_day_one(all_lists.deep_copy())
Expand All @@ -18,10 +18,8 @@
pass pass
update_weekly(onhold_list, inbox_file) update_weekly(onhold_list, inbox_file)
update_waiting(onhold_list, inbox_file) update_waiting(onhold_list, inbox_file)
# inbox_file.close()


update_daily(all_lists) update_daily(all_lists)
# archive(all_lists, archive_list)
update_followups(all_lists) update_followups(all_lists)
# archive_list.to_file(archive_path) set_reminders(all_lists)
topy.save(all_lists) topy.save(all_lists)
22 changes: 22 additions & 0 deletions utilities/remind.py
@@ -0,0 +1,22 @@
from datetime import datetime
from create_reminder import create_reminder
import topy


def set_reminders(todolist):
for item in todolist.filter('@remind +d'):
if item.has_tag('@remind'):
remind_date_str = item.get_tag_param('@remind')
remind_date = datetime.strptime(remind_date_str, '%Y-%m-%d %H:%M')
item.remove_tag('remind')
create_reminder(
item.title.text,
item.sub_tasks.as_plain_text(indent=False) if item.sub_tasks else '',
remind_date,
)
item.tag('willremind', param=remind_date_str)

if __name__ == '__main__':
all_lists = topy.from_files(topy.lists.to_list())
set_reminders(all_lists)
topy.save(all_lists)

0 comments on commit 2041366

Please sign in to comment.