-
Notifications
You must be signed in to change notification settings - Fork 0
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
cleanup prints #19
Closed
Closed
cleanup prints #19
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5b4ac25
cleanup prints
alik-git aa46491
remove return, not needed
alik-git efe58a0
add explainer at the top
alik-git d895fc1
colorlogging and fix fstrings
alik-git 9106312
isort imports
alik-git d3b39eb
add colorlogging as dependency
alik-git 425c6a8
move colorlogging to requirements.txt
alik-git File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,33 @@ | ||
import krec | ||
import argparse | ||
from pathlib import Path | ||
|
||
|
||
""" | ||
"""Usage: | ||
# Just extract and view | ||
python examples/test_extract.py input.mkv -v | ||
|
||
# Extract and save | ||
python examples/test_extract.py input.mkv -o output.krec -v | ||
""" | ||
|
||
import argparse | ||
import logging | ||
from pathlib import Path | ||
|
||
import krec | ||
|
||
|
||
def main(args): | ||
print(f"Extracting from: {args.input_file}") | ||
logging.info(f"Extracting from: {args.input_file}") | ||
|
||
try: | ||
extracted_krec = krec.extract_from_video(args.input_file, verbose=args.verbose) | ||
print("Extraction successful") | ||
print(f"Extracted KRec has {len(extracted_krec)} frames") | ||
logging.info("Extraction successful") | ||
logging.info(f"Extracted KRec has {len(extracted_krec)} frames") | ||
|
||
if args.output_file: | ||
output_path = Path(args.output_file) | ||
extracted_krec.save(str(output_path)) | ||
print(f"Saved to: {output_path}") | ||
logging.info(f"Saved to: {output_path}") | ||
|
||
except Exception as e: | ||
print(f"Error: {e}") | ||
return 1 | ||
|
||
return 0 | ||
logging.error(f"Error: {e}") | ||
|
||
|
||
if __name__ == "__main__": | ||
|
@@ -38,5 +36,7 @@ def main(args): | |
parser.add_argument("-o", "--output-file", type=str, help="Output KRec file path (optional)") | ||
parser.add_argument("-v", "--verbose", action="store_true", help="Enable verbose output") | ||
|
||
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s") | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually, you can add |
||
args = parser.parse_args() | ||
exit(main(args)) | ||
main(args) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, i thought i disabled f-strings in logging in pylint... this is not ideal, see here: https://pylint.readthedocs.io/en/stable/user_guide/messages/warning/logging-fstring-interpolation.html