-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finish base finish funtion and feature.
- Loading branch information
Showing
14 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# vscode local history file | ||
.history/ | ||
|
||
# python cache | ||
__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Wox.Plugin.Bark | ||
|
||
Bark for Wox. | ||
|
||
 | ||
|
||
## Bark | ||
|
||
> Bark is an iOS App which allows you to push customed notifications to your iPhone. | ||
More information about Bark for https://github.com/Finb/Bark. | ||
|
||
## Attention | ||
|
||
- You should input in your **device api key** to [constant.py](/bark/constant.py) before you key in the message. | ||
- It is better to paste the message in Wox. If you input the message one by one, Wox would send the message one by one also. There are not **Enter** in Wox. `¯\_(ツ)_/¯ ` | ||
|
||
## Requirements | ||
|
||
- Python3.x | ||
- requests |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from .bark import bark |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import requests | ||
|
||
from .constant import * | ||
|
||
|
||
def bark(message: str) -> int: | ||
url = api_url.format(key=key, message=message) | ||
r = requests.post(url) | ||
|
||
return r.status_code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- coding: utf-8 | ||
|
||
key = "" # key in you device api key | ||
api_url = 'https://api.day.app/{key}/{message}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from ui import Main | ||
|
||
if __name__ == '__main__': | ||
Main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"ID": "1f036b5d3425435784522cad3ed669b3", | ||
"ActionKeyword": "bark", | ||
"Name": "Bark", | ||
"Description": "Bark for Wox.", | ||
"Author": "Zeroto521", | ||
"Version": "0.0.1", | ||
"Language": "python", | ||
"Website": "https://github.com/Zeroto521/Wox.Plugin.Bark", | ||
"IcoPath": "assets\\favicon.png", | ||
"ExecuteFileName": "main.py" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from ui import Main | ||
|
||
if __name__ == '__main__': | ||
t = Main() | ||
res = t.query('test') | ||
print(res) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from .ui import Main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
|
||
RESULT_TEMPLATE = { | ||
'Title': '', | ||
'SubTitle': '', | ||
'IcoPath': 'assets/favicon.png', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import copy | ||
import os | ||
import sys | ||
from typing import List | ||
sys.path.append('../bark') | ||
|
||
from bark import bark | ||
from wox import Wox | ||
|
||
from .template import * | ||
|
||
|
||
class Main(Wox): | ||
|
||
messages_queue = [] | ||
|
||
def sendNormalMess(self, title: str, subtitle: str): | ||
message = copy.deepcopy(RESULT_TEMPLATE) | ||
message['Title'] = title | ||
message['SubTitle'] = subtitle | ||
|
||
self.messages_queue.append(message) | ||
|
||
def query(self, param: str) -> List[dict]: | ||
param = param.strip() | ||
|
||
if param: | ||
status_code = bark(param) | ||
self.sendNormalMess('Bark', 'Done.') | ||
|
||
if status_code == 200: | ||
self.sendNormalMess('Bark', 'Succeed.') | ||
else: | ||
self.sendNormalMess('Bark', 'Fail.') | ||
else: | ||
self.sendNormalMess( | ||
'Bark', 'Input the message which you want to send your device.') | ||
|
||
return self.messages_queue |