Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tomoyukikashiro committed Dec 30, 2018
1 parent 7269be3 commit c463986
Show file tree
Hide file tree
Showing 4 changed files with 201 additions and 0 deletions.
Binary file added 65E397E0-05A2-4DC1-844D-1E56DCA1E1F2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Alfred Workflow For Dropbox Paper

Type `dp` to run !

![image](https://i.gyazo.com/f08089175601d685316c6ef64e508fd7.gif)

## Attention
This workflow only support Alfred 3 (not support v2).

## Usage

### Prepare dropbox app for you

- 1. Go to [My apps](https://www.dropbox.com/developers/apps) page
- 2. `Create app` with full permission
- 3. `Generate access token`

### Download and Install

Download here and double click it to install.

https://github.com/tomoyukikashiro/dropbox-paper-alfred-workflow/releases/latest

### Add token in environment variable

Set token in environment variable.

![image](https://i.gyazo.com/a9469b373754d611b4b3c020dc542251.png)
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
173 changes: 173 additions & 0 deletions info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>bundleid</key>
<string>me.tomoyukikashiro.dropbox-paper-finder</string>
<key>category</key>
<string>Tools</string>
<key>connections</key>
<dict>
<key>65E397E0-05A2-4DC1-844D-1E56DCA1E1F2</key>
<array>
<dict>
<key>destinationuid</key>
<string>AEFAE652-536F-4AB8-B1E9-EEE87EB53D3F</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
</dict>
<key>createdby</key>
<string>Tomoyuki Kashiro</string>
<key>description</key>
<string></string>
<key>disabled</key>
<false/>
<key>name</key>
<string>Dropbox Paper Finder</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>browser</key>
<string></string>
<key>spaces</key>
<string></string>
<key>url</key>
<string>{query}</string>
<key>utf8</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.action.openurl</string>
<key>uid</key>
<string>AEFAE652-536F-4AB8-B1E9-EEE87EB53D3F</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>alfredfiltersresults</key>
<false/>
<key>alfredfiltersresultsmatchmode</key>
<integer>0</integer>
<key>argumenttrimmode</key>
<integer>0</integer>
<key>argumenttype</key>
<integer>0</integer>
<key>escaping</key>
<integer>68</integer>
<key>keyword</key>
<string>dp</string>
<key>queuedelaycustom</key>
<integer>3</integer>
<key>queuedelayimmediatelyinitially</key>
<true/>
<key>queuedelaymode</key>
<integer>0</integer>
<key>queuemode</key>
<integer>1</integer>
<key>runningsubtext</key>
<string>Loading...</string>
<key>script</key>
<string>import sys
import os
import requests
import json
from datetime import datetime
def format_date(str):
return datetime.strptime(str, '%Y-%m-%dT%H:%M:%SZ').isoformat().split('T')[0]
def make_data(data):
subtitle = "{} updated / {} created".format(format_date(data['last_edited_date']), format_date(data['created_date']))
url = "https://paper.dropbox.com/doc/{}".format(data['doc_id'])
return {
'uid': data['doc_id'],
'title': data['title'],
'subtitle': subtitle,
'arg': url,
'autocomplete': data['title']
}
query = sys.argv[1]
token = os.environ['token']
url = 'https://api.dropboxapi.com/2/paper/docs/search'
limit = 100
data = {'query': query, 'limit': limit}
headers = {
'content-type': 'application/json',
'Authorization': "Bearer {}".format(token)
}
r = requests.post(url, headers=headers, data=json.dumps(data))
data = map(make_data, r.json()['docs'])
sys.stdout.write(json.dumps({'items': data}))
</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
<string></string>
<key>subtext</key>
<string>query</string>
<key>title</key>
<string>search dropbox paper</string>
<key>type</key>
<integer>3</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>65E397E0-05A2-4DC1-844D-1E56DCA1E1F2</string>
<key>version</key>
<integer>2</integer>
</dict>
</array>
<key>readme</key>
<string></string>
<key>uidata</key>
<dict>
<key>65E397E0-05A2-4DC1-844D-1E56DCA1E1F2</key>
<dict>
<key>xpos</key>
<integer>230</integer>
<key>ypos</key>
<integer>170</integer>
</dict>
<key>AEFAE652-536F-4AB8-B1E9-EEE87EB53D3F</key>
<dict>
<key>xpos</key>
<integer>430</integer>
<key>ypos</key>
<integer>170</integer>
</dict>
</dict>
<key>variables</key>
<dict>
<key>token</key>
<string></string>
</dict>
<key>variablesdontexport</key>
<array>
<string>token</string>
</array>
<key>version</key>
<string></string>
<key>webaddress</key>
<string></string>
</dict>
</plist>

0 comments on commit c463986

Please sign in to comment.