-
Notifications
You must be signed in to change notification settings - Fork 34
Winner strings and Pi-only schematics #65
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
base: master
Are you sure you want to change the base?
Conversation
|
Thanks for this! I've already cherry-picked and merged your schematic for the Pi here 8950d3b |
Copies replays to a timestamped version to save the video files for futur viewing.
Added the possibility to specify a path to save the replays, to a USB stick for example.
plugins/replay.py
Outdated
| # If we want to keep replays, make a copy of the files with a timestamp. | ||
| if config.save_replays == True: | ||
| copyfile(os.path.join(config.replay_path, "replay_short.h264"), | ||
| os.path.join(config.replay_path, "{}_replay_short.h264".format(int(time.time())))) |
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.
The replay_path is set up to be an in-memory directory (it's in /dev/shm). We should copy these to the SD card so it doesn't fill up RAM and is available even after a reboot, so a different directory should be configured here.
I'd also get the date to preprend to the files before generating them so that they are assured to be the same:
if config.save_replays:
time_prefix = time.strftime("%Y%m%d_%H%M%S", time.localtime())
for file in ['replay_short.h264', 'replay_long.h264']:
copyfile(
os.path.join(config.replay_path, filename),
os.path.join(config.save_replay_path, '{}_{}'.format(time_prefix, filename))
If this is copied to the SD, we'd need to check how long this actually takes, because if you do this in python it'll block the actual replay until the copying is finished.
Maybe it would be better to do it in the backgorund - either in generate_replay.sh (passing some extra parameters and do it in background), or launch a different .sh file that does the copying in the background...
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.
We should also take into account that this'll eventually fill up the SD card, so there should be a limit on the amount of files stored..
|
|
||
| # -- Enable camera, replays and video motiondetector | ||
| #plugins.update(set(['replay', 'camera', 'motiondetector'])) | ||
| #camera_preview = "-p 0,0,128,72" |
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.
Please don't add your config to the repo (same goes for the .vscode files)
|
Hi Swehner,
Thanks for the tips I’ll do that. Was that code part of my pull request? It was not supposed to be, that’s new code that isn’t tested yet. I want to save the goals to try to train an AI that would use the camera to detect goals and exclude center goals, for a start. That’s my 2019 project :)
Jean-Michel
… Le 14 avr. 2019 à 10:23, swehner ***@***.***> a écrit :
@swehner commented on this pull request.
In plugins/replay.py:
> @@ -18,6 +19,14 @@ def replay(self, replay_type, trigger, extra={}):
call_and_log(["video/generate-replay.sh", config.replay_path,
str(config.ignore_recent_chunks),
str(config.long_chunks), str(config.short_chunks)])
+
+ # If we want to keep replays, make a copy of the files with a timestamp.
+ if config.save_replays == True:
+ copyfile(os.path.join(config.replay_path, "replay_short.h264"),
+ os.path.join(config.replay_path, "{}_replay_short.h264".format(int(time.time()))))
We should also take into account that this'll eventually fill up the SD card, so there should be a limit on the amount of files stored..
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I have added customizable and randomized winner strings that are displayed when a team wins. Also, in the documentation I added a schema for the Raspberry Pi only version.