Skip to content

Commit

Permalink
Merge pull request #129 from SenorPez/0.5-devel
Browse files Browse the repository at this point in the history
0.5.2 Release :shipit:
  • Loading branch information
SenorPez authored Jan 23, 2017
2 parents bf668ab + e86483e commit d3ecb72
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 28 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

Combines telemetry data with replay video to improve Project CARS replays.

Current release: 0.5.1
Current edge state: Pretty Close To Smooth
Current mood: Content
Current release: 0.5.2
Current edge state: Getting There, Maybe
Current mood: Frustrated

The Project CARS Replay Enhancer (I'd call it PCRE, [but that's taken](http://www.pcre.org/ "PCRE")) is intended to augment Project CARS replays by combining captured telemetry data with replay video. The project is currently in a rough state, being rewritten from the ground-up to be more stable, better tested, and faster.

Expand Down
31 changes: 9 additions & 22 deletions replayenhancer/RaceData.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def __init__(self, telemetry_directory, *,
self._stopped_drivers = set()

self.elapsed_time = 0.0
self._add_time = 0.0
self._last_packet = None
self._next_packet = None

Expand Down Expand Up @@ -188,14 +187,6 @@ def get_data(self, at_time=None):
self._next_packet = self._last_packet
raise

self.elapsed_time, \
self._add_time, \
self._last_packet = \
self._calc_elapsed_time(
self._next_packet,
self._add_time,
self._last_packet)

if (self._next_packet is not None
and self._last_packet is None) \
or self._next_packet.num_participants \
Expand Down Expand Up @@ -223,6 +214,7 @@ def get_data(self, at_time=None):

self.track = Track(self._next_packet.track_length)
self._add_sector_times(self._next_packet)
self._calc_elapsed_time()

if at_time is None or self.elapsed_time >= at_time:
return self._next_packet
Expand Down Expand Up @@ -284,20 +276,15 @@ def _best_sector(self, sector):
except ValueError:
return None

@staticmethod
def _calc_elapsed_time(next_packet, add_time, last_packet):
if next_packet.current_time == -1.0:
elapsed_time = 0.0
add_time = 0.0
last_packet = None
def _calc_elapsed_time(self):
if self._next_packet.current_time == -1.0:
self.elapsed_time = 0.0
self._last_packet = None
else:
if last_packet is not None and last_packet.current_time \
- next_packet.current_time > 0.5:
add_time += last_packet.current_time

elapsed_time = add_time + next_packet.current_time

return elapsed_time, add_time, last_packet
driver = next(
driver for driver in self.drivers.values()
if driver.index == self._next_packet.viewed_participant_index)
self.elapsed_time = sum(driver.lap_times) + self._next_packet.current_time

@staticmethod
def _get_drivers(telemetry_data, count):
Expand Down
2 changes: 1 addition & 1 deletion replayenhancer/replayenhancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def main():
'-v',
'--version',
action='version',
version='Version 0.5.1')
version='Version 0.5.2')

args = parser.parse_args()

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

setup(
name='replayenhancer',
version='0.5.1',
description='Replay Enhancer 0.5.1',
version='0.5.2',
description='Replay Enhancer 0.5.2',
long_description=long_description,
url='https://github.com/SenorPez/project-cars-replay-enhancer',
author='Senor Pez',
Expand Down

0 comments on commit d3ecb72

Please sign in to comment.