Skip to content

Commit

Permalink
Got soundtrap working again on windows
Browse files Browse the repository at this point in the history
Fixed things using the path library more often.
  • Loading branch information
spacetimeengineer committed Dec 9, 2024
1 parent db619e1 commit 716df49
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
16 changes: 8 additions & 8 deletions pbp/job_agent/job_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,35 +146,35 @@ def synth_pbp_meta_gen(
command = "pbp-meta-gen"

# Check if recorder is not None or an empty string
if recorder and recorder != "":
if recorder not in [None, ""]:
command += f" --recorder {recorder}"

# Check if uri is not None or an empty string
if uri and uri != "":
if uri not in [None, ""]:
command += f" --uri {uri}"

# Check if output_dir is not None or an empty string
if output_dir and output_dir != "":
if output_dir not in [None, ""]:
command += f" --output-dir {output_dir}"

# Check if json_base_dir is not None or an empty string
if json_base_dir and json_base_dir != "":
if json_base_dir not in [None, ""]:
command += f" --json-base-dir {json_base_dir}"

# Check if xml_dir is not None or an empty string
if xml_dir and xml_dir != "":
if xml_dir not in [None, ""]:
command += f" --xml-dir {xml_dir}"

# Check if start is not None or an empty string
if start and start != "":
if start not in [None, ""]:
command += f" --start {start}"

# Check if end is not None or an empty string
if end and end != "":
if end not in [None, ""]:
command += f" --end {end}"

# Check if prefix is not None or an empty string
if prefix and prefix != "":
if prefix not in [None, ""]:
command += f" --prefix {prefix}"

return command
Expand Down
13 changes: 8 additions & 5 deletions pbp/meta_gen/gen_soundtrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,22 @@ def run(self):
start_dt = self.start - timedelta(days=1)
end_dt = self.end + timedelta(days=1)

if scheme == "file":
parsed_uri = urllib.parse.urlparse(self.audio_loc)

if scheme == "file" or scheme == "":
#parsed_uri = urllib.parse.urlparse(self.audio_loc)
if os.name == "nt":
wav_path = Path(parsed_uri.path[3:])
#wav_path = Path(parsed_uri.path[3:])
wav_path = Path(self.audio_loc)
else:
wav_path = Path(parsed_uri.path)
wav_path = Path(self.audio_loc)

for filename in progressbar(
sorted(wav_path.rglob("*.wav")), prefix="Searching : "
):
xml_path = os.path.join(self.xml_dir, f"{filename.stem}.log.xml"),
print("xml_path", xml_path)
wav_path = filename.parent / f"{filename.stem}.wav"
xml_path = Path(self.xml_dir + "/" + f"{filename.stem}.log.xml")
print("xml_path", xml_path)
start_dt = get_datetime(wav_path, self.prefixes)

# Must have a start date to be valid and also must have a corresponding xml file
Expand Down

0 comments on commit 716df49

Please sign in to comment.