Skip to content

Commit

Permalink
bw: rework background detection logic to be less confusing
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunsi committed Jan 12, 2025
1 parent c233438 commit c02cc86
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 117 deletions.
62 changes: 19 additions & 43 deletions bundlewrap/bundles/voctocore-artwork/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@
from os.path import exists, join


def backgrounds(event_slug, room_number, which):
return {
f'/opt/voc/share/bg_{which}.png': [
join(event_slug, f'saal{room_number}', f'bg_{which}.ts'),
join(event_slug, f'bg_{which}.ts'),
join(event_slug, f'saal{room_number}', f'bg_{which}.png'),
join(event_slug, f'bg_{which}.png'),
join(event_slug, f'saal{room_number}', 'bg.ts'),
join(event_slug, 'bg.ts'),
join(event_slug, f'saal{room_number}', 'bg.png'),
join(event_slug, 'bg.png'),
'default-bg.png',
],
}


directories['/opt/voc/share'] = {
'purge': True,
}
Expand Down Expand Up @@ -43,59 +59,19 @@
event_slug = node.metadata.get('event/slug')

for target_file, possible_sources in {
'/opt/voc/share/overlay_hd.png': [
join(event_slug, f'saal{room_number}', 'overlay_hd.png'),
join(event_slug, 'overlay_hd.png'),
'default-overlay-hd.png',
],
'/opt/voc/share/overlay_slides.png': [
join(event_slug, f'saal{room_number}', 'overlay_slides.png'),
join(event_slug, 'overlay_slides.png'),
'default-overlay-slides.png',
],
'/opt/voc/share/bgloop.ts': [
join(event_slug, f'saal{room_number}', 'bgloop.ts'),
join(event_slug, 'bgloop.ts'),
'default-bgloop.ts',
],
'/opt/voc/share/bg.png': [
join(event_slug, f'saal{room_number}', 'bg.png'),
join(event_slug, 'bg.png'),
'default-bg.png',
],
'/opt/voc/share/bg_lec.png': [
join(event_slug, f'saal{room_number}', 'bg_lec.png'),
join(event_slug, 'bg_lec.png'),
'default-bg_lec.png',
],
'/opt/voc/share/bg_lecm.png': [
join(event_slug, f'saal{room_number}', 'bg_lecm.png'),
join(event_slug, 'bg_lecm.png'),
'default-bg_lecm.png',
],
'/opt/voc/share/bg_sbs.png': [
join(event_slug, f'saal{room_number}', 'bg_sbs.png'),
join(event_slug, 'bg_sbs.png'),
'default-bg_sbs.png',
],
'/opt/voc/share/pause.ts': [
join(event_slug, f'saal{room_number}', 'pause.ts'),
join(event_slug, 'pause.ts'),
'default-pause.ts',
],
'/opt/voc/share/nostream.ts': [
join(event_slug, f'saal{room_number}', 'nostream.ts'),
join(event_slug, 'nostream.ts'),
'default-nostream.ts',
join(event_slug, f'saal{room_number}', 'nostream.png'),
join(event_slug, 'nostream.png'),
'default-nostream.png',
],
'/opt/voc/share/pause-music.mp3': [
join(event_slug, f'saal{room_number}', 'pause-music.mp3'),
join(event_slug, 'pause-music.mp3'),
'default-pause-music.mp3',
],
**backgrounds(event_slug, room_number, 'lec'),
**backgrounds(event_slug, room_number, 'lecm'),
**backgrounds(event_slug, room_number, 'sbs'),
}.items():
source_file = None

Expand Down
2 changes: 0 additions & 2 deletions bundlewrap/bundles/voctocore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ parallel_slide_recording = true
parallel_slide_streaming = true
```

**TODO:** `[metadata.voctocore.backgrounds]` and `static_background_image`

### sources
#### decklink sources
If you use an interlaced video mode (`1080i50` for example), bundlewrap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ sources=${','.join(sorted(sources.keys()))}
% if 'slides' in sources:
livesources=slides
% endif
% if not static_background_image:
backgrounds=${','.join(backgrounds.keys())}
% endif
backgrounds=bg_lec,bg_lecm,bg_sbs,bg_fs

% for sname, sconfig in sorted(sources.items()):
[source.${sname}]
Expand All @@ -35,20 +33,26 @@ audio.${aname} = ${aconfig['streams']}
% endfor

% endfor
% if static_background_image:
[source.background]
kind=img
file=/opt/voc/share/bg.png
[source.bg_lec]
kind=file
location=/opt/voc/share/bg_lec.png
composites=lec

% else:
% for bname, bconfig in backgrounds.items():
[source.${bname}]
% for k,v in sorted(bconfig.items()):
${k}=${v}
% endfor
[source.bg_lecm]
kind=file
location=/opt/voc/share/bg_lecm.png
composites=|lec

[source.bg_sbs]
kind=file
location=/opt/voc/share/bg_sbs.png
composites=sbs,|sbs

[source.bg_fs]
kind=test
pattern=black
composites=fs

% endfor
% endif
[source.break]
kind=file
location=/opt/voc/share/pause.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ sources=${','.join(sorted(sources.keys()))}
% if 'slides' in sources:
livesources=slides
% endif
% if not static_background_image:
backgrounds=${','.join(backgrounds.keys())}
% endif
backgrounds=bg_lec,bg_lecm,bg_sbs,bg_fs

% for sname, sconfig in sorted(sources.items()):
[source.${sname}]
Expand All @@ -35,20 +33,26 @@ audio.${aname} = ${aconfig['streams']}
% endfor

% endfor
% if static_background_image:
[source.background]
kind=img
file=/opt/voc/share/bg.png
[source.bg_lec]
kind=file
location=/opt/voc/share/bg_lec.png
composites=lec

% else:
% for bname, bconfig in backgrounds.items():
[source.${bname}]
% for k,v in sorted(bconfig.items()):
${k}=${v}
% endfor
[source.bg_lecm]
kind=file
location=/opt/voc/share/bg_lecm.png
composites=|lec

[source.bg_sbs]
kind=file
location=/opt/voc/share/bg_sbs.png
composites=sbs,|sbs

[source.bg_fs]
kind=test
pattern=black
composites=fs

% endfor
% endif
[source.break]
kind=file
location=/opt/voc/share/pause.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ sources=${','.join(sorted(sources.keys()))}
% if 'slides' in sources:
livesources=slides
% endif
% if not static_background_image:
backgrounds=${','.join(backgrounds.keys())}
% endif
backgrounds=bg_lec,bg_lecm,bg_sbs,bg_fs

% for sname, sconfig in sorted(sources.items()):
[source.${sname}]
Expand All @@ -35,20 +33,26 @@ audio.${aname} = ${aconfig['streams']}
% endfor

% endfor
% if static_background_image:
[source.background]
kind=img
file=/opt/voc/share/bg.png
[source.bg_lec]
kind=file
location=/opt/voc/share/bg_lec.png
composites=lec

% else:
% for bname, bconfig in backgrounds.items():
[source.${bname}]
% for k,v in sorted(bconfig.items()):
${k}=${v}
% endfor
[source.bg_lecm]
kind=file
location=/opt/voc/share/bg_lecm.png
composites=|lec

[source.bg_sbs]
kind=file
location=/opt/voc/share/bg_sbs.png
composites=sbs,|sbs

[source.bg_fs]
kind=test
pattern=black
composites=fs

% endfor
% endif
[source.break]
kind=file
location=/opt/voc/share/pause.ts
Expand Down
4 changes: 0 additions & 4 deletions bundlewrap/bundles/voctocore/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@
"source": f"voctocore-config-by-version/{voctomix_version}.ini",
"context": {
"audio": node.metadata.get("voctocore/audio", {}),
"backgrounds": node.metadata.get("voctocore/backgrounds", {}),
"event": node.metadata.get("event/slug"),
"has_schedule": node.metadata.get("event/schedule_json", ""),
"keyboard_shortcuts": KEYBOARD_SHORTCUTS,
Expand All @@ -111,9 +110,6 @@
"programout_videosink": node.metadata.get("voctocore/programout_videosink"),
"room_name": node.metadata.get("event/room_name", ""),
"sources": sources,
"static_background_image": node.metadata.get(
"voctocore/static_background_image"
),
"vaapi_enabled": node.metadata.get("voctocore/vaapi"),
},
"triggers": {
Expand Down
23 changes: 0 additions & 23 deletions bundlewrap/bundles/voctocore/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,6 @@
},
},
'voctocore': {
'backgrounds': {
'lec': {
'kind': 'img',
'path': '/opt/voc/share/bg_lec.png',
'composites': 'lec',
},
'lecm': {
'kind': 'img',
'path': '/opt/voc/share/bg_lecm.png',
'composites': '|lec',
},
'sbs': {
'kind': 'img',
'path': '/opt/voc/share/bg_sbs.png',
'composites': 'sbs',
},
'fs': {
'kind': 'test',
'pattern': 'black',
'composites': 'fs',
},
},
'enable_sbs_presets_for_multi_camera': True,
'mirror_view': False, # automatically mirrors SBS/LEC views
'parallel_slide_recording': True,
Expand All @@ -59,7 +37,6 @@
'programout_enabled': False,
'programout_videosink': 'autovideosink',
'srt_publish': True,
'static_background_image': True,
'streaming_use_dynaudnorm': False,
'translators_premixed': False,
'vaapi': False,
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit c02cc86

Please sign in to comment.