Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore video_file_sizes.json - system location is unwritable #4546

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions kalite/updates/management/commands/languagepackdownload.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def handle(self, *args, **options):
raise

def cb(self, percent):
self.update_stage(stage_percent=percent/100.)
self.update_stage(stage_percent=percent / 100.)

def get_language_pack(lang_code, software_version, callback):
"""Download language pack for specified language"""
Expand All @@ -122,7 +122,7 @@ def unpack_language(lang_code, zip_filepath=None, zip_fp=None, zip_data=None):
logging.info("Unpacking new translations")
ensure_dir(get_po_filepath(lang_code=lang_code))

## Unpack into temp dir
# # Unpack into temp dir
z = zipfile.ZipFile(zip_fp or (zip_data and StringIO(zip_data)) or open(zip_filepath, "rb"))
z.extractall(os.path.join(settings.USER_WRITABLE_LOCALE_DIR, lang_code))

Expand All @@ -144,17 +144,11 @@ def move_dubbed_video_map(lang_code):
logging.error("Error removing dubbed video directory (%s): %s" % (dubbed_video_dir, e))

def move_video_sizes_file(lang_code):
lang_pack_location = os.path.join(settings.USER_WRITABLE_LOCALE_DIR, lang_code)
filename = os.path.basename(REMOTE_VIDEO_SIZE_FILEPATH)
src_path = os.path.join(lang_pack_location, filename)
dest_path = REMOTE_VIDEO_SIZE_FILEPATH

# replace the old remote_video_size json
if not os.path.exists(src_path):
logging.error("Could not find videos sizes file (%s)" % src_path)
else:
logging.debug('Moving %s to %s' % (src_path, dest_path))
shutil.move(src_path, dest_path)
"""
This is no longer needed. See:
https://github.com/learningequality/ka-lite/issues/4538#issuecomment-144560505
"""
return

def move_exercises(lang_code):
lang_pack_location = os.path.join(settings.USER_WRITABLE_LOCALE_DIR, lang_code)
Expand Down
3 changes: 3 additions & 0 deletions kalite/updates/videos.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

from fle_utils import videos # keep access to all functions
from fle_utils.general import softload_json

# I will have nightmares from this :)
# Fixing all this in 0.16
from fle_utils.videos import * # get all into the current namespace, override some.

from kalite.topic_tools import settings as topic_tools_settings
Expand Down