Skip to content

Commit

Permalink
Updated to 5.40
Browse files Browse the repository at this point in the history
  • Loading branch information
martastain committed Mar 7, 2022
1 parent d72b4e1 commit d72e069
Show file tree
Hide file tree
Showing 229 changed files with 18,208 additions and 2,701 deletions.
10 changes: 2 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
*.pyc
vendor/
test.py
_old/
test-*
__pycache__
tool*
_import.py
_scripts
_res/
poetry.lock
33 changes: 33 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"python.analysis.extraPaths": [
"./vendor/cherryadmin",
"./vendor/conti",
"./vendor/nebula-core",
"./vendor/nebula-hub",
"./vendor/nxtools",
"./vendor/python-osc",
"./vendor/themis2",
"./vendor/unidecode"
],
"python.linting.flake8Enabled": true,
"python.linting.pydocstyleEnabled": false,
"python.linting.pylintEnabled": false,
"python.linting.enabled": true,
"files.exclude": {
"nx/api/__pycache__": true,
"nx/__pycache__": true,
"cli/__pycache__": true,
"hub/__pycache__": true,
"services/play/__pycache__": true,
"services/worker/__pycache__": true,
"services/watch/__pycache__": true,
"services/psm/__pycache__": true,
"services/meta/__pycache__": true,
"services/mesg/__pycache__": true,
"services/import/__pycache__": true,
"services/conv/__pycache__": true,
"services/__pycache__": true,
"services/broker/__pycache__": true,
"services/play/conti/__pycache__": true
}
}
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Each clip in the rundown is picked by its editorial format, genre, tempo, atmosp

### Playout control

For linear broadcasting, Nebula can control
For linear broadcasting, Nebula can control
[CasparCG](https://casparcg.com), [VLC](https://videolan.org) or [Conti](https://github.com/immstudios/conti).
Broadcasting can run autonomously with and option of starting blocks at a specified time.

Expand Down Expand Up @@ -102,8 +102,8 @@ Installation
------------

See [nebula-setup](https://github.com/nebulabroadcast/nebula-setup)
for installation scripts and instructions.
If you already have a running instance and you are about to add another node,
for installation scripts and instructions.
If you already have a running instance and you are about to add another node,
you may use `support/install_prerequisites.sh` script to install required Python libraries and tools.

- After initial setup, use `make install` command to create symlinks for command-line utilities.
Expand All @@ -126,7 +126,7 @@ Command line tools
- `nxs {[command:start|stop|auto|noauto] id_service:int}` services monitor and control panel
- `nxt [tool_name:string]` plug-in runner


Legal
-----

Expand All @@ -141,8 +141,8 @@ the Free Software Foundation, either version 3 of the License, or

This program 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 General Public License for more details.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.

Need help?
----------
Expand Down
37 changes: 19 additions & 18 deletions cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import cli.run
import cli.adduser
import cli.passwd
import cli.a
import cli.s
import cli.j
import cli.t
import cli.l

__all__ = ["modules"]

import cli.run as run
import cli.adduser as adduser
import cli.passwd as passwd
import cli.a as a
import cli.s as s
import cli.j as j
import cli.t as t
import cli.l as l


modules = {
"run" : run.run,
"adduser" : adduser.adduser,
"passwd" : passwd.passwd,
"a" : a.a,
"s" : s.s,
"j" : j.j,
"t" : t.t,
"l" : l.l
}
"run": run.run,
"adduser": adduser.adduser,
"passwd": passwd.passwd,
"a": a.a,
"s": s.s,
"j": j.j,
"t": t.t,
"l": l.l,
}
51 changes: 29 additions & 22 deletions cli/a.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
from .common import *
import sys

from nx.core.common import config
from nx.core.enum import ObjectStatus
from nx.objects import Asset
from nx.api.get import get_objects


def format_status(key, asset):
colored = "\033[{}m{:<8}\033[0m"
return {
OFFLINE : colored.format(31, "OFFLINE"),
ONLINE : colored.format(32, "ONLINE"),
CREATING : colored.format(33, "CREATING"),
TRASHED : colored.format(34, "TRASHED"),
ARCHIVED : colored.format(34, "ARCHIVE"),
RESET : colored.format(33, "RESET"),
}[asset[key]]
ObjectStatus.OFFLINE: colored.format(31, "OFFLINE"),
ObjectStatus.ONLINE: colored.format(32, "ONLINE"),
ObjectStatus.CREATING: colored.format(33, "CREATING"),
ObjectStatus.TRASHED: colored.format(34, "TRASHED"),
ObjectStatus.ARCHIVED: colored.format(34, "ARCHIVE"),
ObjectStatus.RESET: colored.format(33, "RESET"),
}[asset[key]]


def format_title(key, asset):
return "{:<30}".format(asset[key])


formats = {
"id" : lambda key, asset: "{:<5}".format(asset[key]),
"status" : format_status,
"title" : format_title,
}
"id": lambda key, asset: f"{asset[key]:<5}",
"status": format_status,
"title": format_title,
}


def a(*args):
args = list(args)
print ()
print()
cols = ["id", "status", "title", "mtime"]

if args and args[0].isdigit():
Expand All @@ -34,22 +42,21 @@ def a(*args):
else:
id_view = False


if args:
ft = " ".join(args)
else:
ft = False


for response, asset in get_objects(Asset, order="id DESC", id_view=id_view, fulltext=ft):
l = ""
for _, asset in get_objects(Asset, order="id DESC", id_view=id_view, fulltext=ft):
line = ""
for key in cols:
l+= " " + str(formats[key](key, asset) if key in formats else asset.show(key))
l+="\n"
l=l.lstrip()

line += " " + str(
formats[key](key, asset) if key in formats else asset.show(key)
)
line += "\n"
line = line.lstrip()
try:
sys.stdout.write(l)
sys.stdout.write(line)
sys.stdout.flush()
except IOError:
pass
28 changes: 16 additions & 12 deletions cli/adduser.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
from .common import *
import sys

from nxtools import logging
from nx.objects import User


def adduser(*args):
print ()
print()
try:
login = input("Login: ").strip()
password = input("Password (will be echoed): ").strip()
is_admin = input("Admin (yes/no): ").strip()
full_name = input("Full name (default: {}): ".format(login)).strip() or login
full_name = input(f"Full name (default: {login}): ").strip() or login
email = input("Email: ").strip()
except KeyboardInterrupt:
print ()
print()
logging.warning("Interrupted by user")
sys.exit(0)
u = User()
u["login"] = login
u["full_name"] = full_name
u["email"] = email
u["is_admin"] = 1 if is_admin == "yes" else 0
u.set_password(password)
u.save()
print ()
user = User()
user["login"] = login
user["full_name"] = full_name
user["email"] = email
user["is_admin"] = 1 if is_admin == "yes" else 0
user.set_password(password)
user.save()
print()
logging.goodnews("User created")
2 changes: 0 additions & 2 deletions cli/common.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
from nebula import *

colored = "\033[{}m{:<8}\033[0m"
60 changes: 40 additions & 20 deletions cli/j.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
from .common import *
import sys

from nx.db import DB
from nx.objects import Asset
from nx.core.enum import ObjectStatus


def format_status(key, asset):
colored = "\033[{}m{:<8}\033[0m"
return {
OFFLINE : colored.format(31, "OFFLINE"),
ONLINE : colored.format(32, "ONLINE"),
CREATING : colored.format(33, "CREATING"),
TRASHED : colored.format(34, "TRASHED"),
ARCHIVED : colored.format(34, "ARCHIVE"),
RESET : colored.format(33, "RESET"),
}[asset[key]]
ObjectStatus.OFFLINE: colored.format(31, "OFFLINE"),
ObjectStatus.ONLINE: colored.format(32, "ONLINE"),
ObjectStatus.CREATING: colored.format(33, "CREATING"),
ObjectStatus.TRASHED: colored.format(34, "TRASHED"),
ObjectStatus.ARCHIVED: colored.format(34, "ARCHIVE"),
ObjectStatus.RESET: colored.format(33, "RESET"),
}[asset[key]]


def format_title(key, asset):
return "{:<30}".format(asset[key])

formats = {
"id" : lambda key, asset: "{:<5}".format(asset[key]),
"status" : format_status,
"title" : lambda key, asset: "{:<24}".format(asset[key]),
}


formats = {
"id": lambda key, asset: "{:<5}".format(asset[key]),
"status": format_status,
"title": lambda key, asset: "{:<24}".format(asset[key]),
}


cols = ["id", "status", "title", "ctime", "mtime"]
Expand All @@ -29,7 +34,8 @@ def format_title(key, asset):
def j(*args):
print
db = DB()
db.query("""
db.query(
"""
SELECT
j.id,
j.id_action,
Expand All @@ -52,16 +58,30 @@ def j(*args):
ORDER BY
id DESC LIMIT 50
""")
"""
)

for id, id_action, settings, priority, retries, status, progress, message, creation_time, start_time, end_time, meta in db.fetchall():
for (
id,
id_action,
settings,
priority,
retries,
status,
progress,
message,
creation_time,
start_time,
end_time,
meta,
) in db.fetchall():
asset = Asset(meta=meta)

l = "{:<30}".format(asset)
l+= "{} {:.02f}%\n".format(status, progress)
line = "{:<30}".format(asset)
line += "{} {:.02f}%\n".format(status, progress)

try:
sys.stdout.write(l)
sys.stdout.write(line)
sys.stdout.flush()
except IOError:
pass
Loading

0 comments on commit d72e069

Please sign in to comment.