forked from platypush/platypush
s/runbullet/platypush/g
This commit is contained in:
parent
50413dd89d
commit
6c2ea3767c
18 changed files with 37 additions and 37 deletions
26
README.md
26
README.md
|
@ -1,4 +1,4 @@
|
||||||
Runbullet
|
Platypush
|
||||||
=========
|
=========
|
||||||
|
|
||||||
Execute any command or custom complex logic on your devices, wherever they are, using your PushBullet account.
|
Execute any command or custom complex logic on your devices, wherever they are, using your PushBullet account.
|
||||||
|
@ -7,13 +7,13 @@ Installation
|
||||||
------------
|
------------
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
pip install runbullet
|
pip install platypush
|
||||||
```
|
```
|
||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
Copy /etc/runbullet/config.example.yaml to /etc/runbullet/config.yaml (system-wise settings) or ~/.config/runbullet/config.yaml (user-wise settings).
|
Copy /etc/platypush/config.example.yaml to /etc/platypush/config.yaml (system-wise settings) or ~/.config/platypush/config.yaml (user-wise settings).
|
||||||
|
|
||||||
Edit the file to include:
|
Edit the file to include:
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ Each target device is identified by a unique device_id in the messages sent over
|
||||||
Shell interface
|
Shell interface
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
`runbullet` installs `pusher`, a command-line tool to send PushBullet messages to the connected devices in the format used by runbullet.
|
`platypush` installs `pusher`, a command-line tool to send PushBullet messages to the connected devices in the format used by platypush.
|
||||||
|
|
||||||
Some examples:
|
Some examples:
|
||||||
|
|
||||||
|
@ -52,13 +52,13 @@ The logic to execute is specified by the `--action` option, whose format is `pac
|
||||||
Available plugins
|
Available plugins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
* `runbullet.plugins.shell`: The simplest and yet most versatile plugin. Executes a remote command on the host identified by the `--target` device_id. Example:
|
* `platypush.plugins.shell`: The simplest and yet most versatile plugin. Executes a remote command on the host identified by the `--target` device_id. Example:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
pusher --target laptop --action shell.exec --cmd "scp /home/user/photos/*.jpg backup_host:/mnt/hd/photos"
|
pusher --target laptop --action shell.exec --cmd "scp /home/user/photos/*.jpg backup_host:/mnt/hd/photos"
|
||||||
```
|
```
|
||||||
|
|
||||||
* `runbullet.plugins.music.mpd`: Controls the playback on a mpd/mopidy music server. Requires the package `mpd2` on the target machine. Example:
|
* `platypush.plugins.music.mpd`: Controls the playback on a mpd/mopidy music server. Requires the package `mpd2` on the target machine. Example:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
pusher --target raspberry --action music.mpd.play
|
pusher --target raspberry --action music.mpd.play
|
||||||
|
@ -72,13 +72,13 @@ music.mpd:
|
||||||
port: 6600
|
port: 6600
|
||||||
```
|
```
|
||||||
|
|
||||||
* `runbullet.plugins.switch.wemo`: Controls a WeMo Switch smart switch device. Requires the package `ouimeaux` on the target machine. Example:
|
* `platypush.plugins.switch.wemo`: Controls a WeMo Switch smart switch device. Requires the package `ouimeaux` on the target machine. Example:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
pusher --target raspberry --action switch.wemo.on
|
pusher --target raspberry --action switch.wemo.on
|
||||||
```
|
```
|
||||||
|
|
||||||
* `runbullet.plugins.light.hue`: Controls a Philips Hue smart lights system. Requires the package `phue` on the target machine. Example:
|
* `platypush.plugins.light.hue`: Controls a Philips Hue smart lights system. Requires the package `phue` on the target machine. Example:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
pusher --target raspberry --action light.hue.scene --name "Sunset" --group "Living Room"
|
pusher --target raspberry --action light.hue.scene --name "Sunset" --group "Living Room"
|
||||||
|
@ -87,13 +87,13 @@ pusher --target raspberry --action light.hue.scene --name "Sunset" --group "Livi
|
||||||
Writing your plugins
|
Writing your plugins
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
Writing your own `runbullet` plugin, that would execute your own custom logic whenever a bullet with your plugin name is received, is a very simple task.
|
Writing your own `platypush` plugin, that would execute your own custom logic whenever a bullet with your plugin name is received, is a very simple task.
|
||||||
|
|
||||||
1. Create your plugin directory under `runbullet/plugins` (e.g. `light/batsignal`).
|
1. Create your plugin directory under `platypush/plugins` (e.g. `light/batsignal`).
|
||||||
|
|
||||||
2. In the case above, `runbullet.plugins.light.batsignal` will be your package name.
|
2. In the case above, `platypush.plugins.light.batsignal` will be your package name.
|
||||||
|
|
||||||
3. Create an `__init__.py` under `runbullet/plugins/light/batsignal`.
|
3. Create an `__init__.py` under `platypush/plugins/light/batsignal`.
|
||||||
|
|
||||||
4. If your module is `light/batsignal`, then its main class should be named `LightBatsignalPlugin`.
|
4. If your module is `light/batsignal`, then its main class should be named `LightBatsignalPlugin`.
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ class LightBatsignalPlugin(LightPlugin):
|
||||||
|
|
||||||
6. It's a good practice to define a `status` method in your plugin, which returns a 2-items list like `[output, error]`.
|
6. It's a good practice to define a `status` method in your plugin, which returns a 2-items list like `[output, error]`.
|
||||||
|
|
||||||
7. Rebuild and reinstall `runbullet` if required and relaunch it.
|
7. Rebuild and reinstall `platypush` if required and relaunch it.
|
||||||
|
|
||||||
8. Test your new plugin by sending some bullets to it:
|
8. Test your new plugin by sending some bullets to it:
|
||||||
|
|
||||||
|
|
|
@ -105,10 +105,10 @@ def parse_config_file(config_file=None):
|
||||||
locations = [
|
locations = [
|
||||||
# ./config.yaml
|
# ./config.yaml
|
||||||
os.path.join(wrkdir, 'config.yaml'),
|
os.path.join(wrkdir, 'config.yaml'),
|
||||||
# ~/.config/runbullet/config.yaml
|
# ~/.config/platypush/config.yaml
|
||||||
os.path.join(os.environ['HOME'], '.config', 'runbullet', 'config.yaml'),
|
os.path.join(os.environ['HOME'], '.config', 'platypush', 'config.yaml'),
|
||||||
# /etc/runbullet/config.yaml
|
# /etc/platypush/config.yaml
|
||||||
os.path.join(os.sep, 'etc', 'runbullet', 'config.yaml'),
|
os.path.join(os.sep, 'etc', 'platypush', 'config.yaml'),
|
||||||
]
|
]
|
||||||
|
|
||||||
for loc in locations:
|
for loc in locations:
|
|
@ -1,5 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
import runbullet
|
import platypush
|
||||||
|
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class Backend(Thread):
|
||||||
cls._init(self, **config)
|
cls._init(self, **config)
|
||||||
|
|
||||||
def is_local(self):
|
def is_local(self):
|
||||||
from runbullet.backend.local import LocalBackend
|
from platypush.backend.local import LocalBackend
|
||||||
return isinstance(self, LocalBackend)
|
return isinstance(self, LocalBackend)
|
||||||
|
|
||||||
def on_msg(self, msg):
|
def on_msg(self, msg):
|
||||||
|
@ -48,7 +48,7 @@ class Backend(Thread):
|
||||||
return # No target
|
return # No target
|
||||||
|
|
||||||
target = msg.pop('target')
|
target = msg.pop('target')
|
||||||
if target != runbullet.get_device_id() and not self.is_local():
|
if target != platypush.get_device_id() and not self.is_local():
|
||||||
return # Not for me
|
return # Not for me
|
||||||
|
|
||||||
if 'action' not in msg:
|
if 'action' not in msg:
|
|
@ -7,10 +7,10 @@ import re
|
||||||
import sys
|
import sys
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from runbullet import parse_config_file
|
from platypush import parse_config_file
|
||||||
from runbullet.backend.kafka import KafkaBackend
|
from platypush.backend.kafka import KafkaBackend
|
||||||
from runbullet.backend.local import LocalBackend
|
from platypush.backend.local import LocalBackend
|
||||||
from runbullet.backend.pushbullet import PushbulletBackend
|
from platypush.backend.pushbullet import PushbulletBackend
|
||||||
|
|
||||||
|
|
||||||
def print_usage():
|
def print_usage():
|
|
@ -3,7 +3,7 @@ backend.kafka:
|
||||||
pusher: True # The pusher executable will use this backend by default
|
pusher: True # The pusher executable will use this backend by default
|
||||||
logging: DEBUG
|
logging: DEBUG
|
||||||
server: your_server:9092
|
server: your_server:9092
|
||||||
topic: runbullet
|
topic: platypush
|
||||||
|
|
||||||
backend.pushbullet:
|
backend.pushbullet:
|
||||||
disabled: True
|
disabled: True
|
||||||
|
@ -12,7 +12,7 @@ backend.pushbullet:
|
||||||
device: your_pushbullet_virtual_device_name
|
device: your_pushbullet_virtual_device_name
|
||||||
|
|
||||||
backend.local:
|
backend.local:
|
||||||
fifo: /tmp/runbullet.fifo
|
fifo: /tmp/platypush.fifo
|
||||||
|
|
||||||
# device_id: <your_device_id> (default: current hostname)
|
# device_id: <your_device_id> (default: current hostname)
|
||||||
# debug: True (default: False)
|
# debug: True (default: False)
|
22
setup.py
22
setup.py
|
@ -15,42 +15,42 @@ def pkg_files(dir):
|
||||||
return paths
|
return paths
|
||||||
|
|
||||||
def create_etc_dir():
|
def create_etc_dir():
|
||||||
path = '/etc/runbullet'
|
path = '/etc/platypush'
|
||||||
try:
|
try:
|
||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
if isinstance(e, PermissionError):
|
if isinstance(e, PermissionError):
|
||||||
print('WARNING: Could not create /etc/runbullet')
|
print('WARNING: Could not create /etc/platypush')
|
||||||
elif e.errno == errno.EEXIST and os.path.isdir(path):
|
elif e.errno == errno.EEXIST and os.path.isdir(path):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
plugins = pkg_files('runbullet/plugins')
|
plugins = pkg_files('platypush/plugins')
|
||||||
backend = pkg_files('runbullet/backend')
|
backend = pkg_files('platypush/backend')
|
||||||
create_etc_dir()
|
create_etc_dir()
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name = "runbullet",
|
name = "platypush",
|
||||||
version = "0.2.2.dev2",
|
version = "0.2.2.dev2",
|
||||||
author = "Fabio Manganiello",
|
author = "Fabio Manganiello",
|
||||||
author_email = "info@fabiomanganiello.com",
|
author_email = "info@fabiomanganiello.com",
|
||||||
description = ("Runbullet service"),
|
description = ("Platypush service"),
|
||||||
license = "MIT",
|
license = "MIT",
|
||||||
python_requires = '>= 3',
|
python_requires = '>= 3',
|
||||||
keywords = "pushbullet notifications automation",
|
keywords = "pushbullet notifications automation",
|
||||||
url = "https://github.com/BlackLight/runbullet",
|
url = "https://github.com/BlackLight/platypush",
|
||||||
# packages = ['runbullet'],
|
# packages = ['platypush'],
|
||||||
packages = find_packages(),
|
packages = find_packages(),
|
||||||
# package_data = {'': plugins},
|
# package_data = {'': plugins},
|
||||||
scripts = ['runbullet/bin/pusher'],
|
scripts = ['platypush/bin/pusher'],
|
||||||
entry_points = {
|
entry_points = {
|
||||||
'console_scripts': [
|
'console_scripts': [
|
||||||
'runbullet=runbullet:main',
|
'platypush=platypush:main',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
data_files = [
|
data_files = [
|
||||||
('/etc/runbullet', ['runbullet/config.example.yaml'])
|
('/etc/platypush', ['platypush/config.example.yaml'])
|
||||||
],
|
],
|
||||||
long_description = read('README.md'),
|
long_description = read('README.md'),
|
||||||
classifiers = [
|
classifiers = [
|
||||||
|
|
Loading…
Reference in a new issue