__init__.py 630 B

1234567891011121314151617181920212223242526
  1. from datetime import datetime
  2. import os
  3. import platform
  4. import subprocess
  5. def create_filename(prefix: str = "propusk") -> str:
  6. return os.path.join(os.environ.get('PHOTO_DIR'), F"{prefix}_{datetime.now().timestamp()}.jpg")
  7. def get_path_wkhtmltopdf() -> str:
  8. match platform.system():
  9. case 'Linux':
  10. result = subprocess.Popen(['whereis wkhtmltopdf'], shell=True, stdout=subprocess.PIPE).stdout.read()
  11. return str(result).split(' ')[1]
  12. case 'Windows':
  13. pass
  14. case _: ...
  15. def main():
  16. print(get_path_wkhtmltopdf())
  17. if __name__ == "__main__":
  18. main()