Changeset d1c4782 in OpenWorkouts-current for ow/utilities.py
- Timestamp:
- Jan 21, 2019, 10:43:20 AM (5 years ago)
- Branches:
- current, feature/docs, master
- Children:
- be40b02
- Parents:
- ceae158
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ow/utilities.py
rceae158 rd1c4782 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.