cyberofficial / Synthalingua

Synthalingua - Real Time Translation
http://synthalingua.site/
GNU Affero General Public License v3.0
221 stars 16 forks source link

Save Transcripts correctly on Linux #29

Closed Expletive closed 1 year ago

Expletive commented 1 year ago

Problem: The transcripts are saved with hardcoded windows paths. On linux, the transcripts would all be dumped in the working directory and have "out\transcript_#" as their filename. See attached image:

image

Changes:

  1. I've used os.path.join() which should work properly on linux in addition to windows.
  2. I've replaced the loop that checked if each possible filename exists with str(len(os.listdir('out'))) to name the files based on how many files are in the output directory.
  3. I've removed the redundant print on line 720. It would always say it's renaming the file to transcript_1.txt, even if it was actually renaming it to transcript_42069.txt
  4. Since I removed the loop, I also changed the last print command so that it prints the correct path of the saved file.
cyberofficial commented 1 year ago

I'll check it later today Before do I push, you should edit the contribution section to include your name and url if any.

https://github.com/cyberofficial/Synthalingua/blob/4d147867e7541d080c71af8ba0130800f6986645/transcribe_audio.py#L300-L306C15

How to use colorma: https://linuxhint.com/colorama-python/

Expletive commented 1 year ago

I'm fine with not being credited, but I guess you're the boss of this repository.

cyberofficial commented 1 year ago

I'm fine with not being credited, but I guess you're the boss of this repository.

Even minor edits need some credit.

cyberofficial commented 1 year ago

All tests passed when merging with current dev build. Will be pushed in the API Update Ver. 1.0.995, just need a few more tweaks to the self hosted api server

Thanks again for the code editing 👍