Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'Tetris Metadata Subtitles Extractor', modules, & CLI menu. #13

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

r002
Copy link
Contributor

@r002 r002 commented Mar 14, 2021

In the spirit of implementing dubious features that no one specifically requested but I personally find interesting 😅, here's a PR that implements #8, begins adding modules (single monolithic generate.py function, be gone!! 👋), and also adds a basic CLI menu for easier navigation.

In Summary:

Windows.PowerShell.2021-03-14.16-19-46.mp4

Notes:

  • To run: Navigate to your root and run python -m main.runner.
  • All files you're interested in processing need to posses the .mp4 extension and be housed in .\input\.
  • All generated .srt files will be placed in .\output\
  • If you're processing a large file and want to exit early, hitting ctrl-c on your keyboard will exit the main processing loop but not the app.
  • Still need to do a ton of stuff like handle bad CLI menu inputs, etc. It's on the docket. Currently, the app works fine if you behave... 😄

Pictures:

So, for example-- put your input video (*.mp4) files here that you wish to process:

image

And after running the subtitles generator, your .srt will appear here:

image

Your generated .srt should look like this:

image

Using an app like VLC, add the subtitle; it should look like this:

image

Copy link

@JupeOwl JupeOwl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just gonna do something similar but saw this PR which is anyway way better than I could've done

@r002
Copy link
Contributor Author

r002 commented Apr 18, 2021

I was just gonna do something similar but saw this PR which is anyway way better than I could've done

Hi @JupeOwl ! Welcome! 👋😄 So great to see a new face here in Yobi World! 😀

Haha, thanks for the kind words! I know some Python, but tbh, there's probably 90% of the standard library that I don't know. Python is so incredibly powerful and can do so much! I'd chatted with Yobi about a month ago in his Discord and in the end we didn't pursue a CLI menu (for good reasons!) but this was still a fun side-project that I'd enjoyed hacking together. I didn't go farther with this at the time, but my thinking was that:

  • Since many newbies might be using the tool, it'd be cool to offer two modes:
    • A CLI menu version for total beginners who are just interested in the Tetris-side (extracting stats, etc).
    • A command line version for old-school, advanced users who are interested in embedding Yobi's tool in their own scripts.
  • My thinking was that once you extracted stats in a plaintext format out of a video, then you could process that metadata in Excel/Sheets/pandas/a Jupytr notebook to do Nate Silver-style/538 analysis. The potential is endless!! 😁

(Btw, if you're curious: I actually ended up writing about my PR/'ideas-for-next-steps' here: https://community.codenewbie.org/r002/2-python-opencv-classic-tetris-monthly-summary-tool-mar-12-2021-nep)

In general, please contribute and make a PR though! Yobi is awesome and Yobi's CTM Summary Tool is awesome! 🎉🌟✨ Seriously though, the world needs more open-source! Open-source is the way! 🚀🚀🚀

0) Exit

$> """
choice: int = input(prompt)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
choice: int = input(prompt)
choice: str = input(prompt)

Also the program will crash if the input is not a number or out of bounds.
Maybe:

choice_str: str = input(prompt)
choice : Optional(int) = None

try:
    choice = int(choice_str)
except ValueError:
    pass
print()
# dict.get(input, default)
options[int.get(choice, -1)]()

Where -1 would be a 'Command not found' message, similar to unimplemented
A bit ugly, but better than a crash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants