Changeset c6219ed in OpenWorkouts-current for ow/utilities.py
- Timestamp:
- Jan 22, 2019, 12:21:51 AM (5 years ago)
- Branches:
- current, feature/docs, master
- Children:
- 26220ba, 2d2eb0d
- Parents:
- 02048a6 (diff), be40b02 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ow/utilities.py
r02048a6 rc6219ed 1 1 import re 2 import os 3 import logging 4 import subprocess 2 5 from datetime import datetime 3 6 from decimal import Decimal … … 7 10 from xml.dom import minidom 8 11 from ZODB.blob import Blob 12 13 log = logging.getLogger(__name__) 9 14 10 15 … … 184 189 open_blob.write(data) 185 190 return blob 191 192 193 def save_map_screenshot(workout): 194 if workout.has_gpx: 195 current_path = os.path.abspath(os.path.dirname(__file__)) 196 tool_path = os.path.join(current_path, '../bin/screenshot_map') 197 198 screenshots_path = os.path.join( 199 current_path, 'static/maps', str(workout.owner.uid)) 200 if not os.path.exists(screenshots_path): 201 os.makedirs(screenshots_path) 202 203 screenshot_path = os.path.join( 204 screenshots_path, str(workout.workout_id)) 205 screenshot_path += '.png' 206 207 subprocess.run( 208 [tool_path, str(workout.owner.uid), str(workout.workout_id), 209 screenshot_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 210 211 return True 212 213 return False
Note: See TracChangeset
for help on using the changeset viewer.