Browse Source

flesh out requirements

master
beadsland 1 year ago
parent
commit
ee4365ae49
12 changed files with 144 additions and 41 deletions
  1. 1
    0
      .gitignore
  2. 9
    0
      META.json
  3. 42
    26
      README.md
  4. 4
    5
      jobs/cal.py
  5. 1
    2
      jobs/cal/tober.py
  6. 1
    2
      jobs/photo.py
  7. 1
    2
      jobs/sous/veil.py
  8. 1
    2
      jobs/upmeet.py
  9. 1
    2
      jobs/wiki.py
  10. 32
    0
      requirements.in
  11. 38
    0
      requirements.txt
  12. 13
    0
      util/genreqs.py

+ 1
- 0
.gitignore View File

@@ -6,3 +6,4 @@ html/pull/*
jobs/sous/pid/*
jobs/nap/sid/*
html/thmb/*
*.bak

+ 9
- 0
META.json View File

@@ -0,0 +1,9 @@
{
"prereqs" : {
"configure" : {
"requires" : {
"Date::Manip" : "6.72"
}
},
},
}

+ 42
- 26
README.md View File

@@ -6,34 +6,50 @@ This project is a work-in-progress. Worse than that, it's a messy hack.

Scripts are structured only accidentally and barely procedural enough to
qualify as more than imperative, there's even less error checking than
documentation, API queries throughout are no more sophisticated than
brute force, and dependencies and requirements go almost entirely
unexplained.
documentation, and API queries throughout are no more sophisticated than
brute force.

In essence, the entire project is in desperate need of refactoring and
packaging for deployment by others. That's all next on the ToDo list.
general cleanup. That's all next on the ToDo list,
along with some outstanding minor feature additions.

## Details

In October of 2017, Hack Manhattan installed a TV by the workspace tables. To
make it easily accessible to everyone in the space, we added a Chromecast. To
make that more useful, we're casting a "default" dashboard now.

The same default dashboard is also displayed on a screen over the intercom
at the entrance to our shop. This screen is driven by a Raspberry Pi.

Based on [dashcast-docker](https://github.com/madmod/dashcast-docker)

Requires:

* [pychromecast](https://github.com/balloob/pychromecast) `876ed6c` and above
* daemonize
* systemd unless you want to write your own init scripts
* a variety of python and perl libraries
* apache 2 (for support of continuously running php scripts)

TODO:

* Still adding a variety of minor features.
* Source files are in desperate need of refactoring
* Probably ought to write a dependency install script
In October of 2017, Hack Manhattan installed a TV by the workspace tables.
To make it easily accessible to everyone in the space, we added a Chromecast.
To make that more useful, we're casting a "default" dashboard now. The same
default dashboard is also displayed on a screen over the intercom
at the entrance to our shop. This screen is driven by an old Raspberry Pi.

Bricodash represents a major revision to last year's defaultcast,
providing more functionality while using a thin-client architecture.

If the early version Raspberry Pi we're using is low powered, the Chromecast
is especially so. The goal has been to provide as much functionality as
possible while keeping client load to a minimum. With this in mind, we rely
heavily on server-side jobs to update various HTML components, allowing the
browser to poll for those files as needed.

**Dependencies:**

* Apache2
* systemd
* python3 + [requirements.txt](requirements.txt)
* Perl + Date::Manip
* ImageMagick

Developed for use under Chromecast or a single-board computer running Chromium. No guarantees as to how it will behave on other browsers.

**Setting Up:**
* install under /opt/bricocast
* soft link to /opt/bricocast/html from within your /var/www/html hierarchy
* install /sysd/defaultcast.service as you would any systemd service
* set up a dedicated user to run sysd/cron.py
* store keys for various scripts under jobs/.keys
* set up a dedicated group including both your cron user and www-data
* create subdirs owned by said group allowing g+w permissions:
* html/pull
* html/thmb
* jobs/nap/sid
* jobs/sous/pid
* configure html/util/camera.php to point to your local camera MJPG camera devices, as appropriate

+ 4
- 5
jobs/cal.py View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

####
## Copyright © 2018 Beads Land-Trujillo.
@@ -38,11 +37,11 @@ def parse_cal(filename):
with open(filename, "rb") as f:
for line in f.readlines():
if line.strip() != "":
spl = line.strip().split("::")
spl = line.strip().decode().split("::")
if len(spl) > 2 and spl[2].strip() != "":
full = "%s %s" % (spl[1], emoji(spl[2].strip()))
arr.append( (spl[0], full) )
else:
elif len(spl) > 1:
arr.append( (spl[0], spl[1]) )

arr = (( recur(t[0]), t[1].strip() ) for t in arr)
@@ -50,7 +49,7 @@ def parse_cal(filename):
return arr

arr = sorted( parse_cal(geek)[:3] + parse_cal(birth)[:3] + parse_cal(usnat)[:3] + parse_cal(local)[:3] )
arr = ( { "start": t[0], "venue": "Holiday", "event": t[1] } for t in arr )
arr = ( { "start": t[0].decode('utf-8'), "venue": "Holiday", "event": t[1].encode().decode('utf-8') } for t in arr )

holidays = list(arr)


+ 1
- 2
jobs/cal/tober.py View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

####
## Copyright © 2018 Beads Land-Trujillo.

+ 1
- 2
jobs/photo.py View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

####
## Copyright © 2018 Beads Land-Trujillo.

+ 1
- 2
jobs/sous/veil.py View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

####
## Copyright © 2018 Beads Land-Trujillo.

+ 1
- 2
jobs/upmeet.py View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

####
## Copyright © 2018 Beads Land-Trujillo.

+ 1
- 2
jobs/wiki.py View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

####
## Copyright © 2018 Beads Land-Trujillo.

+ 32
- 0
requirements.in View File

@@ -0,0 +1,32 @@
cssutils>=1.0.2

pipreqs>=0.4.9

pip_tools>=3.0.0

emoji_data_python>=1.1.0

python_resize_image>=1.1.12

daemonize>=2.4.7

humanize>=0.5.1

PyChromecast>=2.3.0

dateparser>=0.7.0

slacker>=0.9.65

requests>=2.18.4

eventbrite>=3.3.3

Pillow>=5.2.0

beautifulsoup4>=4.6.3

python_dateutil>=2.7.3

piptools>=0.1.1


+ 38
- 0
requirements.txt View File

@@ -0,0 +1,38 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# util/genreqs.py
#
beautifulsoup4==4.6.3
casttube==0.2.0 # via pychromecast
certifi==2018.8.24 # via requests
chardet==3.0.4 # via requests
click==7.0 # via pip-tools
cssutils==1.0.2
daemonize==2.4.7
dateparser==0.7.0
docopt==0.6.2 # via pipreqs
emoji-data-python==1.1.0
eventbrite==3.3.3
humanize==0.5.1
idna==2.7 # via requests
ifaddr==0.1.4 # via zeroconf
ipaddress==1.0.22 # via ifaddr
pillow==5.2.0
pip-tools==3.0.0
pipreqs==0.4.9
piptools==0.1.1
protobuf==3.6.1 # via pychromecast
pychromecast==2.3.0
python-dateutil==2.7.3
python-resize-image==1.1.12
pytz==2018.5 # via dateparser, tzlocal
regex==2018.8.29 # via dateparser
requests==2.19.1
six==1.11.0 # via pip-tools, protobuf, python-dateutil
slacker==0.9.65
tzlocal==1.5.1 # via dateparser
urllib3==1.23 # via requests
yarg==0.1.9 # via pipreqs
zeroconf==0.21.3 # via pychromecast

+ 13
- 0
util/genreqs.py View File

@@ -0,0 +1,13 @@
#!/usr/bin/env python3

import pipreqs
import piptools
import os
import fileinput

os.system("pipreqs . --savepath requirements.in")

for line in fileinput.input(files=["requirements.in"], inplace=True, backup='.bak'):
print(line.replace("==", ">="))

os.system('CUSTOM_COMPILE_COMMAND="util/genreqs.py" pip-compile requirements.in')

Loading…
Cancel
Save