Merge branch 'master' of github.com:AnonymusRaccoon/Autopipe

This commit is contained in:
Zoe Roux
2020-11-15 18:25:06 +01:00
+8 -7
View File
@@ -21,25 +21,26 @@ class DownloadExample(Coordinator):
def name(cls):
return "DownloadExample"
@property
def input(self):
return RssInput(f"http://www.obsrv.com/General/ImageFeed.aspx?{self.query}",
lambda x: FileData(x.title, x["media_content"][0]["url"], False))
@property
def pipeline(self) -> List[Union[Pipe, Callable[[APData], Union[APData, Pipe]]]]:
return [Output(DownloaderPipe())]
def get_input(self):
return RssInput(f"http://www.obsrv.com/General/ImageFeed.aspx?{self.query}",
lambda x: FileData(x.title, x["media:content"], True))
```
### For this coordinator to be found by autopipe, you must use one of the three following way
1) Place your coordinator file into the `autopipe/coordinators` folders, import your coordinator in the `autopipe/coordinators/__init__.py` file and place your coordinator name in the `__all__` array of this file.
2) Run autopipe with the coordinator argument set to the path of your file followed by ':' and the coordinator's class name. For example if your coordinator's file is named `coordinator.py`, is located in the current directory and your coordinator's name is `DownloadExample`, your coordinator argument would be `../coordinator.py:DownloadExample`
3) Send your coordinator file to the standard input of autopipe and use `-` as your coordinator name. **SOON**
3) Send your coordinator file to the standard input of autopipe and use `-` as your coordinator name. *SOON*
### To run this, you have two ways
### To run this, you have three ways
1) Use the autopipe file in the bin folder like so: ``./autopipe <coordinator> [coordinator_parameters]``
2) Use the module syntaxe like so: ``python -m autopipe <coordinator> [coordinator_parameters]``
3) Use the shebang ``#!/usr/bin/env autopipe -``, set your coordinator file executable (``chmod +x file.py``) and execute it. *SOON*
## Coordinators options
A pipeline always start with an `Input`. You specify the instance of thte input manager you will use in the `get_input()` method.