-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
320 additions
and
307 deletions.
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
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
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
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import os | ||
|
||
class Location: | ||
def __init__(self): | ||
self.locations = [] | ||
|
||
def add(self, timestamp=0, latitude=0, longitude=0, altitude=0): | ||
entry = { | ||
"timestamp": timestamp, | ||
"latitude": latitude, | ||
"longitude": longitude, | ||
"altitude" : altitude | ||
} | ||
self.locations.append(entry) | ||
|
||
def get_value(self, entry): | ||
try: | ||
return int(entry['timestamp']) | ||
except KeyError: | ||
return 0 | ||
|
||
def get_sorted_locations(self, reverse=False): | ||
self.locations.sort(key=self.get_value, reverse=reverse) | ||
return self.locations | ||
|
||
|
||
class Media: | ||
def __init__(self): | ||
self.media = [] | ||
|
||
def add(self, path, from_web=False): | ||
if not from_web: | ||
path = os.path.join("Contents", path) | ||
|
||
self.media.append(path) | ||
|
||
def get_media(self): | ||
return self.media | ||
|
||
class Timeline: | ||
def __init__(self): | ||
self.timeline = [] | ||
|
||
def add(self, timestamp, event, obj): | ||
entry = { | ||
"timestamp": timestamp, | ||
"event": str(event), | ||
"value": obj | ||
} | ||
self.timeline.append(entry) | ||
|
||
def get_value(self, entry): | ||
try: | ||
return int(entry['timestamp']) | ||
except KeyError: | ||
return 0 | ||
|
||
def get_sorted_timeline(self, reverse=False): | ||
self.timeline.sort(key=self.get_value, reverse=reverse) | ||
return self.timeline | ||
|
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.