Skip to content

Commit adf4072

Browse files
committed
Get rid of some debug logging
1 parent 3c11fab commit adf4072

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

learning_resources/etl/utils.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -467,16 +467,13 @@ def get_url_from_module_id(
467467
else run.run_id
468468
)
469469
if module_id.startswith("asset"):
470-
log.debug("Getting URL for asset %s", module_id)
471470
asset_meta = (
472471
assets_metadata.get(Path(olx_path).parts[-1], {}) if assets_metadata else {}
473472
)
474473
video_meta = video_srt_metadata.get(module_id, {}) if video_srt_metadata else {}
475474
if video_meta:
476-
log.debug("Found video metadata for %s", module_id)
475+
# Link to the parent video
477476
return f"{root_url}/courses/{run_id}/jump_to/{video_meta.split('@')[-1]}"
478-
elif module_id.endswith(".srt"):
479-
log.debug("No video metadata for %s", module_id)
480477
middle_path = asset_meta.get("custom_md5", "")
481478
return f"{root_url}/{(middle_path + '/') if middle_path else ''}{module_id}"
482479
elif module_id.startswith("block") and is_valid_uuid(module_id.split("@")[-1]):
@@ -531,17 +528,15 @@ def parse_video_transcripts_xml(
531528

532529
def get_video_metadata(olx_path: str, run: LearningResourceRun) -> dict:
533530
"""
534-
Get metadata for video SRT files in an OLX path
531+
Get metadata for video SRT/VTT files in an OLX path
535532
"""
536533
video_transcript_mapping = {}
537534
video_path = Path(olx_path, "video")
538535
if not video_path.exists():
539536
log.warning("No video directory found in OLX path: %s", olx_path)
540537
return video_transcript_mapping
541538
for root, _, files in os.walk(str(Path(olx_path, "video"))):
542-
path = "/".join(root.split("/")[3:])
543539
for filename in files:
544-
log.debug("Processing video file %s in %s", filename, path)
545540
extension_lower = Path(filename).suffix.lower()
546541
if extension_lower == ".xml":
547542
with Path.open(Path(root, filename), "rb") as f:

learning_resources/etl/utils_test.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -711,17 +711,13 @@ def test_get_video_metadata(mocker, tmp_path, video_dir_exists):
711711
"learning_resources.etl.utils.parse_video_transcripts_xml",
712712
return_value=expected_mapping,
713713
)
714-
715714
result = utils.get_video_metadata(str(olx_path), run)
716715

717716
assert result == expected_mapping
718-
# The function passes a file object to parse_video_transcripts_xml, not a Path
719717
assert mock_parse.call_count == 1
720718
call_args = mock_parse.call_args[0]
721719
assert call_args[0] == run
722720
assert call_args[1] == video_xml
723-
# The third argument is a file object, so we can't easily check its exact value
724-
mock_log.debug.assert_called()
725721
else:
726722
# No video directory
727723
result = utils.get_video_metadata(str(olx_path), run)

0 commit comments

Comments
 (0)