Skip to content

Commit fa46419

Browse files
committed
use mediainfo with str as python<=3.8 may refuse Path objects
1 parent 351f246 commit fa46419

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

ChildProject/projects.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import os
55
import pandas as pd
66
import re
7-
import subprocess
87
from typing import Union
98
from pathlib import Path
109

@@ -510,12 +509,12 @@ def validate(self, ignore_recordings: bool = False, profile: str = None, accumul
510509

511510
if path.exists():
512511
if not profile:
513-
info = mediainfo(path)
512+
info = mediainfo(str(path))
514513
if 'sample_rate' not in info or int(info['sample_rate']) != STANDARD_SAMPLE_RATE:
515514
try:
516515
std_path = self.get_recording_path(raw_filename, STANDARD_PROFILE)
517516
if std_path.exists():
518-
std_info = mediainfo(std_path)
517+
std_info = mediainfo(str(std_path))
519518
if 'sample_rate' not in std_info:
520519
self.warnings.append(
521520
f"Could not read the sample rate of converted version of recording '{raw_filename}' at '{std_path}'. {STANDARD_SAMPLE_RATE}Hz is expected for profile {STANDARD_PROFILE}")
@@ -535,7 +534,7 @@ def validate(self, ignore_recordings: bool = False, profile: str = None, accumul
535534
else:
536535
self.warnings.append(f"Could not read the sample rate of recording '{raw_filename}' at '{path}' and no standard conversion in profile {STANDARD_PROFILE} was found. Does the standard profile exist? Does {profile_metadata} exist? you can create the standard profile with 'child-project process {self.path} {STANDARD_PROFILE} basic --format=wav --sampling={STANDARD_SAMPLE_RATE} --codec=pcm_s16le --skip-existing'")
537536
elif profile == STANDARD_PROFILE:
538-
info = mediainfo(path)
537+
info = mediainfo(str(path))
539538
if 'sample_rate' in info and int(info['sample_rate']) != STANDARD_SAMPLE_RATE:
540539
self.warnings.append(f"recording '{raw_filename}' at '{path}' has unexpected sampling rate {info['sample_rate']}Hz when {STANDARD_SAMPLE_RATE}Hz is expected for profile {STANDARD_PROFILE}")
541540

0 commit comments

Comments
 (0)