Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix tests #326

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Code Style
on: [ push, pull_request ]

jobs:
isort:
name: isort
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install Dependencies
run: pip3 install isort
- name: Run isort
run: 'isort --check --diff .'
black:
name: black
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install Dependencies
run: pip3 install black
- name: Run black
run: 'black --check --diff --skip-string-normalization .'
pycodestyle1:
name: pycodestyle (everything but tests)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install Dependencies
run: pip3 install pycodestyle
- name: Run pycodestyle
run: 'pycodestyle --ignore=E402,E501,W503 --exclude=voctocore/tests,doc,example-scripts .'
pycodestyle2:
name: pycodestyle (tests only)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install Dependencies
run: pip3 install pycodestyle
- name: Run pycodestyle
run: 'pycodestyle --ignore=E501 voctocore/tests'
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

8 changes: 0 additions & 8 deletions check_pep8.sh

This file was deleted.

46 changes: 21 additions & 25 deletions doc/composition-mode-images/mk_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
width = 1920
height = 1080

side_by_side_equal = {
"gutter": 20,
"atop": 160,
"btop": 480
}
side_by_side_equal = {"gutter": 20, "atop": 160, "btop": 480}

side_by_side_preview = {
"aleft": 20,
Expand All @@ -17,14 +13,14 @@
"bleft": 1404,
"btop": 781,
"bwidth": 496,
"bheight": 279
"bheight": 279,
}

rump = 4./9. * height
head_x = 2./9. * height
neck_sleeve = 1./6. * height
shoulder = 11./36. * height
shoulder_curve = 5./18. * height
rump = 4.0 / 9.0 * height
head_x = 2.0 / 9.0 * height
neck_sleeve = 1.0 / 6.0 * height
shoulder = 11.0 / 36.0 * height
shoulder_curve = 5.0 / 18.0 * height

path = """
m {start_x:.2f} {start_y:.2f}
Expand All @@ -43,18 +39,18 @@
-{shoulder:.2f} {outter_arm:.2f}
z
""".format(
inner_arm=1./3. * height,
outter_arm=1./2. * height,
inner_arm=1.0 / 3.0 * height,
outter_arm=1.0 / 2.0 * height,
neck_sleeve=neck_sleeve,
rump=rump,
start_x=(width - rump) / 2.,
start_y=height - 15.,
start_x=(width - rump) / 2.0,
start_y=height - 15.0,
head_xl=head_x,
head_xr=head_x + neck_sleeve,
head_y=5./12. * height,
head_y=5.0 / 12.0 * height,
shoulder=shoulder,
shoulder_curve=shoulder_curve,
shoulder_div=shoulder - shoulder_curve
shoulder_div=shoulder - shoulder_curve,
)

gutter = side_by_side_equal["gutter"]
Expand Down Expand Up @@ -109,11 +105,11 @@
""".format(
width=width,
height=height,
twidth=3./4. * width,
theight=1./5. * height,
tround=1./20. * height,
ttop=1./5. * height,
tleft=1./8. * width,
twidth=3.0 / 4.0 * width,
theight=1.0 / 5.0 * height,
tround=1.0 / 20.0 * height,
ttop=1.0 / 5.0 * height,
tleft=1.0 / 8.0 * width,
sspa_xscale=side_by_side_preview["awidth"] / float(width),
sspa_yscale=side_by_side_preview["aheight"] / float(height),
sspax=side_by_side_preview["aleft"],
Expand All @@ -122,11 +118,11 @@
sspb_yscale=side_by_side_preview["bheight"] / float(height),
sspbx=side_by_side_preview["bleft"],
sspby=side_by_side_preview["btop"],
sse_scale=(width - gutter) / (2. * width),
sse_scale=(width - gutter) / (2.0 * width),
ssea=side_by_side_equal["atop"],
ssebx=(width - gutter) / 2. + gutter,
ssebx=(width - gutter) / 2.0 + gutter,
sseby=side_by_side_equal["btop"],
path=path
path=path,
)

print(svg)
2 changes: 1 addition & 1 deletion example-scripts/control-server/generate-cut-list.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
import socket
import datetime
import socket
import sys

host = 'localhost'
Expand Down
10 changes: 6 additions & 4 deletions example-scripts/ffmpeg/record-all-audio-streams.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python3
import socket
import sys
import json
import logging
import shlex
import socket
import subprocess
import logging
import sys
from configparser import SafeConfigParser

logging.basicConfig(level=logging.DEBUG)
Expand Down Expand Up @@ -82,7 +82,9 @@ def getlist(self, section, option):
-flags +global_header -flags +ilme+ildct
-f mpegts
{}
""".format(' '.join(inputs), ' '.join(maps), output)
""".format(
' '.join(inputs), ' '.join(maps), output
)
log.info('running command:\n%s', cmd)
args = shlex.split(cmd)
p = subprocess.run(args)
Expand Down
103 changes: 62 additions & 41 deletions example-scripts/gstreamer/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
"""

import argparse
import gi
import os
import signal
import socket
import sys

import gi

gi.require_version('Gst', '1.0')
from gi.repository import Gst, GstNet, GObject
from gi.repository import GObject, Gst, GstNet

# init GObject & Co. before importing local classes
GObject.threads_init()
Expand All @@ -35,17 +36,20 @@
def mk_video_src(args, videocaps):
# make video soure part of pipeline

video_device = "device={}".format(args.video_dev) \
if args.video_dev else ""
video_device = "device={}".format(args.video_dev) if args.video_dev else ""

monitor = """
monitor = (
"""
tee name=t !
queue !
videoconvert !
fpsdisplaysink sync=false

t. ! queue !
""" if args.monitor else ""
"""
if args.monitor
else ""
)

if args.video_source == 'dv':
video_src = """
Expand Down Expand Up @@ -122,8 +126,7 @@ def mk_video_src(args, videocaps):


def mk_audio_src(args, audiocaps):
audio_device = "device={}".format(args.audio_dev) \
if args.audio_dev else ""
audio_device = "device={}".format(args.audio_dev) if args.audio_dev else ""

if args.audio_source in ['dv', 'hdv']:
# this only works if video is from DV also.
Expand All @@ -136,12 +139,16 @@ def mk_audio_src(args, audiocaps):
elif args.audio_source == 'pulse':
audio_src = """
pulsesrc {audio_device} name=audiosrc !
""".format(audio_device=audio_device)
""".format(
audio_device=audio_device
)

elif args.audio_source == 'alsa':
audio_src = """
alsasrc {audio_device} name=audiosrc !
""".format(audio_device=audio_device)
""".format(
audio_device=audio_device
)

elif args.audio_source == 'blackmagichdmi':
audio_src = """
Expand Down Expand Up @@ -169,7 +176,9 @@ def mk_client(args):
core_ip = socket.gethostbyname(args.host)
client = """
tcpclientsink host={host} port={port}
""".format(host=core_ip, port=args.port)
""".format(
host=core_ip, port=args.port
)

return client

Expand All @@ -191,8 +200,10 @@ def mk_pipeline(args, server_caps):
def get_server_caps():
# fetch config from server
server_config = Connection.fetchServerConfig()
server_caps = {'videocaps': server_config['mix']['videocaps'],
'audiocaps': server_config['mix']['audiocaps']}
server_caps = {
'videocaps': server_config['mix']['videocaps'],
'audiocaps': server_config['mix']['audiocaps'],
}

return server_caps

Expand Down Expand Up @@ -250,43 +261,53 @@ def get_args():
'''
)

parser.add_argument('-v', '--verbose', action='count', default=0,
help="Also print INFO and DEBUG messages.")
parser.add_argument(
'-v',
'--verbose',
action='count',
default=0,
help="Also print INFO and DEBUG messages.",
)

parser.add_argument('--video-source', action='store',
choices=['dv', 'hdv', 'hdmi2usb',
'blackmagichdmi', 'ximage', 'test'],
default='test',
help="Where to get video from")
parser.add_argument(
'--video-source',
action='store',
choices=['dv', 'hdv', 'hdmi2usb', 'blackmagichdmi', 'ximage', 'test'],
default='test',
help="Where to get video from",
)

parser.add_argument('--video-dev', action='store',
help="video device")
parser.add_argument('--video-dev', action='store', help="video device")

parser.add_argument('--audio-source', action='store',
choices=['dv', 'alsa', 'pulse',
'blackmagichdmi', 'test'],
default='test',
help="Where to get audio from")
parser.add_argument(
'--audio-source',
action='store',
choices=['dv', 'alsa', 'pulse', 'blackmagichdmi', 'test'],
default='test',
help="Where to get audio from",
)

# maybe hw:1,0
parser.add_argument('--audio-dev', action='store',
default='hw:CARD=CODEC',
help="for alsa/pulse, audio device")
parser.add_argument(
'--audio-dev',
action='store',
default='hw:CARD=CODEC',
help="for alsa/pulse, audio device",
)

parser.add_argument('--audio-delay', action='store',
default='10',
help="ms to delay audio")
parser.add_argument(
'--audio-delay', action='store', default='10', help="ms to delay audio"
)

parser.add_argument('-m', '--monitor', action='store_true',
help="fps display sink")
parser.add_argument('-m', '--monitor', action='store_true', help="fps display sink")

parser.add_argument('--host', action='store',
default='localhost',
help="hostname of vocto core")
parser.add_argument(
'--host', action='store', default='localhost', help="hostname of vocto core"
)

parser.add_argument('--port', action='store',
default='10000',
help="port of vocto core")
parser.add_argument(
'--port', action='store', default='10000', help="port of vocto core"
)

args = parser.parse_args()

Expand Down
Loading
Loading