Scripting way to upload videos to peertube and youtube
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.

33 lines
969 B

  1. from os.path import join, abspath, isfile, dirname, exists
  2. from os import listdir
  3. from shutil import copyfile
  4. import logging
  5. logger = logging.getLogger('Prismedia')
  6. def overwrite_or_not(question):
  7. while True:
  8. reply = str(input(question + ' (Yes/[No]): ') or "No").lower().strip()
  9. if reply[:1] == 'y':
  10. return True
  11. if reply[:1] == 'n':
  12. return False
  13. def genconfig():
  14. path = join(dirname(__file__), 'config')
  15. files = [f for f in listdir(path) if isfile(join(path, f))]
  16. for f in files:
  17. final_f = f.replace(".sample", "")
  18. overwrite = True
  19. if exists(final_f):
  20. overwrite = overwrite_or_not(final_f + " already exists. Do you want to overwrite it?")
  21. if overwrite:
  22. copyfile(join(path, f), final_f)
  23. logger.info(str(final_f) + " correctly generated, you may now edit it to fill your credentials.")
  24. if __name__ == '__main__':
  25. genconfig()