Commit 6361320d authored by loelkes's avatar loelkes
Browse files

Version 1.1. Rate limit set to 300s by default, corrected typos. Updated README

parent 39c043e0
# Gesetze im Internet # HACKDASH
This package displays a list of the latest laws pusblished by the Federal Ministry of Justice and for Consumer Protection in Germany. In Germany, laws have to be published in the 'Bundesgesetzblatt', a formal publication by the German Government, to be applicable. This package displays a list of all projects in a HACKDASH dashboard.
The package was created for the exhibition * Open Codes. Leben in Digitalen Welten * at the Federal Ministry of Justice and Consumer Protection in Berlin, Germany.
**Note:** The content for this package is exclusivly in German.
**Note:** This package allows the InfoBeamer node to access the internet. **Note:** This package allows the InfoBeamer node to access the internet.
## Settings ## Settings
### Display rotation ### Title
Control the rotation of the screen. Choose between 0° and 180°. This is not used at the moment.
**Note**: This package is currently not responsive and only works for 1920x1080 screens. ### Project name
The name of the dashboard as it appears in the URL.
### Background color ### Background color
...@@ -28,19 +26,6 @@ Select from the fonts in the package. Currently no additional fonts can be insta ...@@ -28,19 +26,6 @@ Select from the fonts in the package. Currently no additional fonts can be insta
Set the font color. Default is set to white. This setting applies to all content on the screen. Set the font color. Default is set to white. This setting applies to all content on the screen.
### Footer
* **Show**. Tick if you want to show the footer. Default is ticked.
* **Size**. Footer text height in pixels. Default is 20.
* **Color** Footer text color. Default is white.
#### Comment
Can be used to give credit for software, data sources or show arbitrary information. This can be useful if you need to mention data sources or licence details.
## Data sources
* [Gesetze im Internet](http://www.gesetze-im-internet.de/)
## Authors ## Authors
* **Christian Lölkes** - *Initial work* - [GitHub](https://github.com/loelkes) * **Christian Lölkes** - *Initial work* - [GitHub](https://github.com/loelkes)
......
...@@ -7,7 +7,7 @@ from hosted import node, device, log ...@@ -7,7 +7,7 @@ from hosted import node, device, log
from datetime import datetime from datetime import datetime
import time, json import time, json
from collections import namedtuple from collections import namedtuple
from textwrap import TextWrapper
class Hackdash(object): class Hackdash(object):
def __init__(self, config): def __init__(self, config):
...@@ -15,6 +15,9 @@ class Hackdash(object): ...@@ -15,6 +15,9 @@ class Hackdash(object):
self.hackdash_api = API(url="https://hackdash.org/api/v2/{}/projects".format(config['project_name'])) self.hackdash_api = API(url="https://hackdash.org/api/v2/{}/projects".format(config['project_name']))
self.created_after = datetime.strptime(config['created_after'], '%d/%m/%Y %H:%M:%S') self.created_after = datetime.strptime(config['created_after'], '%d/%m/%Y %H:%M:%S')
self.lastRefresh = 0 self.lastRefresh = 0
self.lineWidth = 120
self.lineHeight = 30
self.wrapper = TextWrapper(width=self.lineWidth)
def refresh(self): def refresh(self):
self.hackdash_api.query() self.hackdash_api.query()
...@@ -24,10 +27,16 @@ class Hackdash(object): ...@@ -24,10 +27,16 @@ class Hackdash(object):
if project.created > self.created_after: if project.created > self.created_after:
title = self.util.line(u'{} | {}'.format(project.title, project.status), height=50) title = self.util.line(u'{} | {}'.format(project.title, project.status), height=50)
self.util.offset['y'] += 50 self.util.offset['y'] += 50
desc = self.util.line(u'{}...'.format(project.description[:120]), height=30) if len(project.description) > self.lineWidth:
self.util.offset['y'] += 80 for line in self.wrapper.wrap(text=project.description):
desc = self.util.line(line, height=self.lineHeight)
self.util.offset['y'] += self.lineHeight
self.util.lines.append(desc)
else:
desc = self.util.line(u'{}...'.format(project.description[:self.lineWidth]), height=self.lineHeight)
self.util.lines.append(desc)
self.util.offset['y'] += self.lineHeight + 20
self.util.lines.append(title) self.util.lines.append(title)
self.util.lines.append(desc)
def update(self): def update(self):
self.refresh() self.refresh()
......
...@@ -15,7 +15,7 @@ class API(object): ...@@ -15,7 +15,7 @@ class API(object):
def reset(self): def reset(self):
self.tElapsed, self.lines, self.util = 0, [], Util() self.tElapsed, self.lines, self.util = 0, [], Util()
def setupRequests(self, url, user=None, key=None, rateLimit=3600, api_suffix=''): def setupRequests(self, url, user=None, key=None, rateLimit=300, api_suffix=''):
""" """
Setup the request parameters. Setup the request parameters.
......
{ {
"name": "Hackdash", "name": "HACKDASH",
"author": "Christian Lölkes <christian@loelkes.com>", "author": "Christian Lölkes <christian@loelkes.com>",
"desc": "Hackdash projects", "desc": "Displays HACKDASH projects.",
"version": "1.0", "version": "1.1",
"lifecycle": "beta" "lifecycle": "beta"
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment