Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions bin/gopro-dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,18 @@ def fmtdt(dt: datetime.datetime):
duration = recording.video.duration

fns = {
"file-created": lambda f: f.ctime,
"file-modified": lambda f: f.mtime,
"file-accessed": lambda f: f.atime
"file-created": lambda f: f.file.ctime,
"file-modified": lambda f: f.file.mtime,
"file-accessed": lambda f: f.file.atime,
"mp4-created": lambda f: f.creationDateTime
}

if args.video_time_start:
start_date = fns[args.video_time_start](recording.file)
start_date = fns[args.video_time_start](recording)
end_date = start_date + duration.timedelta()

if args.video_time_end:
start_date = fns[args.video_time_end](recording.file) - duration.timedelta()
start_date = fns[args.video_time_end](recording) - duration.timedelta()
end_date = start_date + duration.timedelta()

else:
Expand Down
8 changes: 4 additions & 4 deletions docs/bin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ usage: gopro-dashboard.py [-h] [--font FONT] [--privacy PRIVACY] [--generate {de
[--cache-dir CACHE_DIR] [--profile PROFILE] [--double-buffer] [--ffmpeg-dir FFMPEG_DIR]
[--load {ACCL,GRAV,CORI} [{ACCL,GRAV,CORI} ...]] [--gpx GPX]
[--gpx-merge {EXTEND,OVERWRITE}] [--use-gpx-only]
[--video-time-start {file-created,file-modified,file-accessed}]
[--video-time-end {file-created,file-modified,file-accessed}]
[--video-time-start {file-created,file-modified,file-accessed,mp4-created}]
[--video-time-end {file-created,file-modified,file-accessed,mp4-created}]
[--map-style {osm,tf-cycle,tf-transport,tf-landscape,tf-outdoors,tf-transport-dark,tf-spinal-map,tf-pioneer,tf-mobile-atlas,tf-neighbourhood,tf-atlas,geo-osm-carto,geo-osm-bright,geo-osm-bright-grey,geo-osm-bright-smooth,geo-klokantech-basic,geo-osm-liberty,geo-maptiler-3d,geo-toner,geo-toner-grey,geo-positron,geo-positron-blue,geo-positron-red,geo-dark-matter,geo-dark-matter-brown,geo-dark-matter-dark-grey,geo-dark-matter-dark-purple,geo-dark-matter-purple-roads,geo-dark-matter-yellow-roads,local}]
[--map-api-key MAP_API_KEY] [--layout {default,speed-awareness,xml}]
[--layout-xml LAYOUT_XML] [--exclude EXCLUDE [EXCLUDE ...]]
Expand Down Expand Up @@ -395,10 +395,10 @@ GPX Only:

--use-gpx-only, --use-fit-only
Use only the GPX/FIT file - no GoPro location data (default: False)
--video-time-start {file-created,file-modified,file-accessed}
--video-time-start {file-created,file-modified,file-accessed,mp4-created}
Use file dates for aligning video and GPS information, only when --use-gpx-only -
EXPERIMENTAL! - may be changed/removed (default: None)
--video-time-end {file-created,file-modified,file-accessed}
--video-time-end {file-created,file-modified,file-accessed,mp4-created}
Use file dates for aligning video and GPS information, only when --use-gpx-only -
EXPERIMENTAL! - may be changed/removed (default: None)

Expand Down
4 changes: 2 additions & 2 deletions gopro_overlay/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ def gopro_dashboard_arguments(args=None):

only.add_argument("--use-gpx-only", "--use-fit-only", action="store_true",
help="Use only the GPX/FIT file - no GoPro location data")
only.add_argument("--video-time-start", choices=["file-created", "file-modified", "file-accessed"],
only.add_argument("--video-time-start", choices=["file-created", "file-modified", "file-accessed", "mp4-created"],
help="Use file dates for aligning video and GPS information, only when --use-gpx-only - EXPERIMENTAL! - may be changed/removed")
only.add_argument("--video-time-end", choices=["file-created", "file-modified", "file-accessed"],
only.add_argument("--video-time-end", choices=["file-created", "file-modified", "file-accessed", "mp4-created"],
help="Use file dates for aligning video and GPS information, only when --use-gpx-only - EXPERIMENTAL! - may be changed/removed")

maps = parser.add_argument_group("Mapping", "Display of Maps")
Expand Down
11 changes: 10 additions & 1 deletion gopro_overlay/ffmpeg_gopro.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def find_recording(self, filepath: Path, stat=os.stat) -> GoproRecording:
"-hide_banner",
"-print_format", "json",
"-show_streams",
"-show_entries", "stream_tags:format_tags",
filepath
]
).stdout)
Expand Down Expand Up @@ -127,13 +128,20 @@ def only_if_present(what, l, p):
else:
data_stream = None

creationDateTime = None
try:
creationDateTime = datetime.datetime.fromisoformat(ffprobe_json["format"]["tags"]["creation_time"])
except Exception:
pass

return GoproRecording(
ffmpeg=self.exe,
location=filepath,
file=filestat(filepath, stat=stat),
audio=audio_stream,
video=video_stream,
data=data_stream
data=data_stream,
creationDateTime=creationDateTime
)

def load_frame(self, filepath: Path, at_time: Timeunit) -> Optional[bytes]:
Expand Down Expand Up @@ -201,6 +209,7 @@ class GoproRecording:
audio: Optional[AudioStream]
video: VideoStream
data: Optional[DataStream]
creationDateTime: datetime.datetime

def load_data(self) -> bytes:
track = self.data.stream
Expand Down