#!/usr/bin/env python # encoding: utf-8 from Alfred import Items, Tools from Notes import Search items = Items() query = Tools.getArgv(1) search = Search() if query is str(): tag_results = search.tags(query, 'tag', reverse=False) else: tag_results = search.tags(query, 'count', reverse=True) if bool(tag_results): for tag, counter in tag_results.items(): items.setItem( arg= tag, # we cannot yet send a hash character with `thearchive://match/{query}` subtitle=u"{0} Hit(s), (\u2318 Paste Into Frontmost Application)". format(counter), title=tag, valid=True, ) items.setIcon('icons/hashtag.png', 'image') items.addMod( arg=u"#{0} ".format(tag), icon_path='icons/paste.png', icon_type='image', key='cmd',
#!/usr/bin/env python # encoding: utf-8 from Alfred import Items, Tools from Notes import Notes, Search items = Items() notes = Notes() search = Search() zettel_id = Tools.getZettelId() query = Tools.getArgv(1) query_alt = u"{0} {1}".format(zettel_id, query) zettel_action = u"\u2318 Add Zettel ID" paste_action = u"\u2325 Paste clipboard" quicklook_action = u"\u21E7 Quicklook" if notes.useZettelId(): query_alt = query query = u"{0} {1}".format(zettel_id, query_alt) zettel_action = u"\u2318 Remove Zettel ID" items.setItem( arg=u"{0}||".format(query), subtitle=u"\"{0}\" ({1}, {2})".format(query, zettel_action, paste_action), title="Create note", ) items.addMod( arg=u"{0}||".format(query_alt), key="cmd", subtitle=u"\"{0}\" ({1})".format(query_alt, paste_action), )
#!/usr/bin/env python # encoding: utf-8 from Alfred import Items, Tools from Notes import Search import urllib items = Items() query = Tools.getArgv(1) search = Search() tasks = search.tasks(query) if len(tasks) > 0: for file in tasks: file_title = file['title'] if file['title'] != str() else search.getNoteFilename(file['path']) items.setItem( arg=file['path'], subtitle=u'\u2192 {0} (\u2318 Open in The Archive, \u2325 Open in Default Editor)'.format(file['filename'].decode('utf-8')), title=file['todo'], type='file', valid=True, variables={ "todo": file['todo'], "todo_query": query, "todo_status": file['status'], }, ) items.addMod( arg=file['path'], icon_path="icons/the-archive.png",
#!/usr/bin/env python # encoding: utf-8 from Alfred import Items, Tools from Notes import Search items = Items() query = Tools.getArgv(1) search = Search() tasks = search.tasks(query) if len(tasks) > 0: for file in tasks: file_title = file['title'] if file['title'] != str( ) else search.getNoteFilename(file['path']) items.setItem( arg=file['path'], subtitle= u'\u2192 {0} (\u2318 Open in The Archive, \u2325 Open in Default Editor)' .format(file['filename'].decode('utf-8')), title=file['todo'], type='file', valid=True, variables={ "todo": file['todo'], "todo_query": query, "todo_status": file['status'], }, ) items.addMod(
#!/usr/bin/env python # encoding: utf-8 from Alfred import Items, Tools from Notes import Search from urllib import pathname2url import os items = Items() query = Tools.getEnv("path_query2") search = Search() note_path = Tools.getEnv("path_query1") note_title = search.getNoteTitle(note_path) filename = pathname2url(os.path.basename(note_path)) back_query = "<EMPTY>" if not query else query actions = [ { "arg": "back|{0}".format(query), "icon": "icons/back.png", "subtitle": "Back to Search with query: {0}".format(back_query), "title": "Back", }, { "arg": u"markdown_link|[{0}]({1})".format(note_title, filename), "icon": "icons/link.png", "subtitle": u"Copy a Markdown Link for \"{0}\" to the Clipboard".format(note_title), "title": "Markdown Link", }, { "arg": u"wiki_link|[[{0}]]".format(note_title),
#!/usr/bin/env python # encoding: utf-8 from Alfred import Tools from Notes import Search import sys query = Tools.getArgv(1) title = Search().getNoteLinkTitle(query).strip() output = '[[' + title + ']]' sys.stdout.write(output)
#!/usr/bin/env python # encoding: utf-8 from Alfred import Items, Tools from Notes import Search items = Items() query = Tools.getArgv(1) search = Search() search_terms, search_type = search.getSearchConfig(query) if len(search_terms) > 0: sorted_file_list = search.notes(search_terms, search_type) else: sorted_file_list = search.getFilesListSorted() for file in sorted_file_list: c_date = Tools.getDateStr(file['ctime']) m_date = Tools.getDateStr(file['mtime']) items.setItem( arg=file['path'], subtitle=u"Created: {0}, Modified: {1} (\u2318 Actions, \u2325 Paste Wiki Link, \u21E7 Quicklook)".format(c_date, m_date), title=file['title'], type="file", ) items.addMod( arg="{0}|>{1}".format(file['path'], query), icon_path="icons/action.png", icon_type="image", key="cmd", subtitle="Enter Actions Menu for the Note...",
#!/usr/bin/env python # encoding: utf-8 from Alfred import Tools from Notes import Search import sys query = Tools.getArgv(1) title = Search().getNoteTitle(query) sys.stdout.write(title)
#!/usr/bin/env python # encoding: utf-8 from Alfred import Tools from Notes import Note, Search from QuerySplitter import QuerySplitter import sys reload(sys) sys.setdefaultencoding('utf-8') query = Tools.getArgv(1).encode('utf-8') clipboard = Tools.getEnv('clipboard') template = Tools.getEnv('template') paste = Tools.getEnv('paste') qs = QuerySplitter(query) if query: note = Note( content=str() if not paste else clipboard, tags=qs.tags, template_path=template, title=qs.title, zettel_id=qs.zettel_id, ) file_path = note.createNote() output = Search().getNoteFilename(file_path) sys.stdout.write(output)
#!/usr/bin/env python # encoding: utf-8 from Alfred import Items, Tools from Notes import Search from urllib import pathname2url import os items = Items() query = Tools.getEnv("path_query2") search = Search() note_path = Tools.getEnv("path_query1") note_title = search.getNoteTitle(note_path) note_link_title = search.getNoteLinkTitle(note_path) filename = pathname2url(os.path.basename(note_path)) back_query = "<EMPTY>" if not query else query actions = [ { "arg": "back|>{0}".format(query), "icon": "icons/back.png", "subtitle": "Back to Search with query: {0}".format(back_query), "title": "Back", }, { "arg": u"markdown_link|>[{0}]({1})".format(note_link_title, filename), "icon": "icons/link.png", "subtitle": u"Copy a Markdown Link for \"{0}\" to the Clipboard".format(
#!/usr/bin/env python # encoding: utf-8 import random import sys from Notes import Search search = Search() sorted_file_list = search.getFilesListSorted() file = random.choice(sorted_file_list) output = search.getNoteFilename(file['path']) sys.stdout.write(output)