https://github.com/0install/0watch
scans websites for new releases and triggers 0template if required
https://github.com/0install/0watch
Last synced: 2 months ago
JSON representation
scans websites for new releases and triggers 0template if required
- Host: GitHub
- URL: https://github.com/0install/0watch
- Owner: 0install
- License: lgpl-2.1
- Created: 2017-06-29T22:29:06.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2026-04-05T21:02:23.000Z (2 months ago)
- Last Synced: 2026-04-05T22:21:11.492Z (2 months ago)
- Language: Python
- Homepage: https://docs.0install.net/tools/0watch/
- Size: 37.1 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
0watch
======
Copyright Bastian Eicher et al
Introduction
------------
0watch scans websites for new releases using arbitrary Python code snippets.
When new releases are detected [0template](https://github.com/0install/0template) is used to create/update a [Zero Install](http://0install.net/) feed.
To make the `0watch` command available on your command-line you can run:
0install add 0watch https://apps.0install.net/0install/0watch.xml
To use 0watch you need both a template file named like `MyApp.xml.template` and watch file named like `MyApp.watch.py` in the same directory. You can then run:
0watch MyApp.watch.py
Details
-------
A watch file is a Python script that pulls a list of releases from a website. It must set an attribute named `releases` to an array of dictionaries. Each array element represents to a single release and each dictionary tuple is a variable substitution for the template.
A basic watch file could look like this:
```python
from urllib import request
import json
data = request.urlopen(request.Request('https://api.github.com/repos/myproj/myapp/releases')).read()
releases = [{'version': release['tag_name'], 'released': release['published_at'][0:10]} for release in json.loads(data)]
```
For each release reported by the watch file 0watch attempts to determine whether the version is already known. It does this by:
* checking if a file named `MyApp-VERSION.xml` exists in the same directory and
* checking if a file named `MyApp.xml` exists in the same directory and contains an implementation with the version.
0watch then calls 0template once for each new release.
Conditions
----------
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA