A web based video player for files with multichannel audio where the user can adjust the volume levels.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.1KB

  1. #! /usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. Copyright 2021, Nils Hilbricht, Germany ( https://www.hilbricht.net )
  5. This multichannel video audio mixer is free software: you can redistribute it and/or modify
  6. This program is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU Affero General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU Affero General Public License for more details.
  14. You should have received a copy of the GNU Affero General Public License
  15. along with this program. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>.
  16. """
  17. import configparser
  18. import sys
  19. assert sys.argv[1]
  20. assert sys.argv[1].endswith(".ini"), sys.argv[1]
  21. config = configparser.ConfigParser()
  22. config.read(sys.argv[1])
  23. tracknames = config["Information"]["tracknames"].split(",")
  24. tracknameshtmllist = ""
  25. for trnm in tracknames:
  26. tracknameshtmllist += f'"{trnm}", '
  27. volumeMap = config["Information"]["volumemap"].split(",")
  28. volumeHtmlList = ""
  29. for vl in volumeMap:
  30. volumeHtmlList += f'{round(float(vl), 2)}, '
  31. with open("template.html", "r") as f:
  32. template = f.read()
  33. template = template.replace("$$$VIDEOFILE$$$", config["Information"]["videofile"])
  34. template = template.replace("$$$TITLE$$$", config["Information"]["title"])
  35. template = template.replace("$$$TRACKNAMES$$$", tracknameshtmllist)
  36. template = template.replace("$$$VOLUMEMAP$$$", volumeHtmlList)
  37. template = template.replace("$$$SAMPLERATE$$$", config["Information"]["samplerate"])
  38. template = template.replace("$$$HUMAN$$$", config["Information"]["human"])
  39. template = template.replace("$$$DATE$$$", config["Information"]["date"])
  40. template = template.replace("$$$LICENSE$$$", config["Information"]["license"])
  41. template = template.replace("$$$DESCRIPTION$$$", config["Information"]["description"])
  42. print (template) #stdout. our job is done