Commit 9726a49a authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

init

parents
#!/usr/bin/env python3
import argparse
import os.path
import xml.etree.ElementTree as ET
from pathlib import Path
import requests
from tqdm import tqdm
parser = argparse.ArgumentParser(description='Get video(s) from BBB')
parser.add_argument('--meeting', default='e95c2bd3e4e7ee81bd53eaae33f147b86f5c8384-1593758725366')
parser.add_argument('--server', default='webconf.laas.fr')
FILES = [
'captions.json', 'cursor.xml', 'deskshare.xml', 'metadata.xml', 'panzooms.xml', 'presentation_text.json',
'shapes.svg', 'slides_new.xml', 'presentation/deskshare.png', 'presentation/logo.png', 'video/webcams.webm'
]
def download_from_url(url, dst):
"""thx https://gist.github.com/wy193777/0e2a4932e81afc6aa4c8f7a2984f34e2"""
file_size = int(requests.head(url).headers["Content-Length"])
first_byte = os.path.getsize(dst) if os.path.exists(dst) else 0
if first_byte >= file_size:
return file_size
header = {"Range": "bytes=%s-%s" % (first_byte, file_size)}
pbar = tqdm(total=file_size, initial=first_byte, unit='B', unit_scale=True, desc=url.split('/')[-1])
resp = requests.get(url, headers=header, stream=True)
with dst.open('ab') as fileh:
for chunk in resp.iter_content(chunk_size=1024**2):
if chunk:
fileh.write(chunk)
pbar.update(1024**2)
pbar.close()
return file_size
def download(server, meeting):
"TODO"
# playback = f'https://{server}/playback/presentation/2.0/playback.html'
path = Path('data') / meeting
if path.exists():
print('error: you already downloaded this one.')
return
for dirname in ['presentation', 'video']:
(path / dirname).mkdir(parents=True)
for filename in FILES:
download_from_url(f'https://{server}/presentation/{meeting}/{filename}', path / filename)
for child in ET.parse(f'data/{meeting}/shapes.svg').getroot():
if child.attrib['class'] == 'slide':
filename = child.attrib['{http://www.w3.org/1999/xlink}href']
filepath = path / filename
if not filepath.parent.exists():
filepath.parent.mkdir()
download_from_url(f'https://{server}/presentation/{meeting}/{filename}', filepath)
if __name__ == '__main__':
args = parser.parse_args()
download(server=args.server, meeting=args.meeting)
This diff is collapsed.
[tool.poetry]
name = "bbb2vid"
version = "0.1.0"
description = "export a BBB presentation to a single video"
authors = ["Guilhem Saurel <guilhem.saurel@laas.fr>"]
license = "BSD-2-Clause"
[tool.poetry.dependencies]
python = "^3.6"
requests = "^2.24.0"
tqdm = "^4.49.0"
svglib = "^1.0.1"
[tool.poetry.dev-dependencies]
ipython = "^7.16"
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment