Quellcode durchsuchen

initial commit

master
Romain Kerguelen vor 5 Jahren
Commit
74a0be3ee8
Signiert von: rigelk GPG-Schlüssel-ID: EA12971B0E438F36
4 geänderte Dateien mit 545 neuen und 0 gelöschten Zeilen
  1. +2
    -0
      .gitignore
  2. +60
    -0
      api.py
  3. +461
    -0
      poetry.lock
  4. +22
    -0
      pyproject.toml

+ 2
- 0
.gitignore Datei anzeigen

@ -0,0 +1,2 @@
*.pyc
__pycache__/

+ 60
- 0
api.py Datei anzeigen

@ -0,0 +1,60 @@
from __future__ import print_function
from prismedia import upload import main as upload
import sys
import zerorpc
class PrismediahedronAPI():
prismedia =
def upload(self, *args, **kwargs):
"""upload video using prismedia"""
arguments = [
self.prismedia,
*args,
*kwargs
]
try:
output = subprocess.check_output(
arguments,
stderr=subprocess.STDOUT)
return uploader._geturl(output)
except subprocess.CalledProcessError as cpe:
print "cpe.returncode", cpe.returncode
print "cpe.cmd", cpe.cmd
print "cpe.output", cpe.output
@staticmethod
def _geturl(s):
# the output contains much more than just the url
cue = "Peertube: Watch it at "
for line in s.split("\n"):
if cue in line:
# the url befins right after the cue. Between in url and the end of the line is a single ".",
# which also needs to be remove
return line.split(cue, 1)[1][:-1]
def parse_port():
port = 4242
try:
port = int(sys.argv[1])
except Exception as e:
pass
return '{}'.format(port)
def main():
addr = 'tcp://127.0.0.1:' + parse_port()
s = zerorpc.Server(PrismediahedronAPI())
s.bind(addr)
print('prismediahedron started on {}'.format(addr))
s.run()
if __name__ == '__main__':
main()

+ 461
- 0
poetry.lock
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen


+ 22
- 0
pyproject.toml Datei anzeigen

@ -0,0 +1,22 @@
[tool.poetry]
name = "prismediahedron"
version = "0.1.0"
description = "a zerorpc server exposing prismedia, a video uploader to PeerTube and friends."
authors = ["Rigel Kent <sendmemail@rigelk.eu>"]
license = "AGPL-3.0-only"
[tool.poetry.dependencies]
python = "^3.4"
pyinstaller = "^3.4"
zerorpc = "^0.6.1"
# prismedia
prismedia = { path = "../prismedia/" }
pyzmq = "^18.0"
msgpack-python = "^0.5.6"
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

Laden…
Abbrechen
Speichern