Files
dashdrm-mp4ff/gen.py
√(noham)² 08e66f21d7 Initial commit: dashdrm-mp4ff plugin
Add a Streamlink plugin (plugin/dashdrm_mp4ff.py) to support DRM-protected MPEG-DASH streams with optional mp4ff-decrypt integration. Include README with usage and installation notes, an interactive helper (gen.py) that reads vault.json and prints Streamlink commands, a vault.json example, pyproject.toml (declares inquirerpy dependency), .python-version, and .gitignore. This provides the plugin, packaging metadata, and tooling needed to run and test DASH-DRM streams locally.
2026-05-23 19:13:16 +02:00

47 lines
1.2 KiB
Python

import json
from InquirerPy import prompt
from InquirerPy.base.control import Choice
VAULT_FILE = "vault.json"
def load_vault():
try:
with open(VAULT_FILE, "r") as f:
return json.load(f)["channels"]
except FileNotFoundError:
return []
def main():
channels = load_vault()
if not channels:
print("No channels found in vault.json")
return
choices = [
Choice(value=channel, name=f"{channel.get('number', '?')} - {channel.get('name', 'Unknown')}")
for channel in channels
]
questions = [
{
"type": "list",
"name": "channel",
"message": "Select a channel to generate the streamlink command for:",
"choices": choices,
}
]
result = prompt(questions)
selected_channel = result.get("channel")
if selected_channel:
mpd_url = selected_channel.get("mpd_url", "")
keys_list = selected_channel.get("keys", [])
keys_str = ",".join(keys_list)
command = f'streamlink -l debug --plugin-dirs "./plugin" --dashdrm-mp4ff-use-mp4ff --dashdrm-mp4ff-decryption-key "{keys_str}" "dashdrm://{mpd_url}" best'
print(command)
if __name__ == "__main__":
main()