Skip to content

Commit

Permalink
Do not load video into memory to check its size, just use disk stats l…
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Bach committed Apr 7, 2017
1 parent 9f7175c commit 7533c59
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/installguide/release_notes.rst
Expand Up @@ -18,6 +18,7 @@ Bug fixes
* Touch devices: Scroll events drop through to underlying page rather than scrolling long sidebar lists :url-issue:`5407` :url-issue:`5410`
* Respect selected date range on tabular coach report :url-issue:`5022`
* Correct summary of total exercise attempts on coach reports :url-issue:`5020`
* Do not load video into memory to check its size, just use disk stats :url-issue:`2909`

Known issues
^^^^^^^^^^^^
Expand Down
4 changes: 2 additions & 2 deletions kalite/packages/bundled/fle_utils/videos.py
Expand Up @@ -42,14 +42,14 @@ def download_video(youtube_id, download_path="../content/", download_url=OUTSIDE
if (
not os.path.isfile(filepath) or
"content-length" not in response.headers or
not len(open(filepath, "rb").read()) == int(response.headers['content-length'])):
not os.path.getsize(filepath) == int(response.headers['content-length'])):
raise URLNotFound("Video was not found, tried: {}".format(url))

response = download_file(thumb_url, thumb_filepath, callback_percent_proxy(callback, start_percent=95, end_percent=100))
if (
not os.path.isfile(thumb_filepath) or
"content-length" not in response.headers or
not len(open(thumb_filepath, "rb").read()) == int(response.headers['content-length'])):
not os.path.getsize(thumb_filepath) == int(response.headers['content-length'])):
raise URLNotFound("Thumbnail was not found, tried: {}".format(thumb_url))

except DownloadCancelled:
Expand Down

0 comments on commit 7533c59

Please sign in to comment.