Fix normalised files being incorrectly named.
This commit is contained in:
parent
e696e2237a
commit
b1d9ad8c93
2 changed files with 7 additions and 4 deletions
|
@ -83,6 +83,7 @@ class FileManager:
|
||||||
self.logger.log.warning("Failed to remove, skipping. Likely file is still in use.")
|
self.logger.log.warning("Failed to remove, skipping. Likely file is still in use.")
|
||||||
continue
|
continue
|
||||||
self.channel_received[channel] = True
|
self.channel_received[channel] = True
|
||||||
|
self.known_channels_preloaded = [False]*self.channel_count
|
||||||
|
|
||||||
# If we receive a new status message, let's check for files which have not been pre-loaded.
|
# If we receive a new status message, let's check for files which have not been pre-loaded.
|
||||||
if command == "STATUS":
|
if command == "STATUS":
|
||||||
|
@ -112,7 +113,7 @@ class FileManager:
|
||||||
|
|
||||||
if (not preloaded and not normalised):
|
if (not preloaded and not normalised):
|
||||||
# We didn't do any hard work, let's sleep.
|
# We didn't do any hard work, let's sleep.
|
||||||
sleep(0.5)
|
sleep(0.2)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.log.exception(
|
self.logger.log.exception(
|
||||||
|
@ -181,8 +182,10 @@ class FileManager:
|
||||||
if not filename:
|
if not filename:
|
||||||
self.logger.log.exception("Somehow got empty filename when all channels are preloaded.")
|
self.logger.log.exception("Somehow got empty filename when all channels are preloaded.")
|
||||||
continue # Try next song.
|
continue # Try next song.
|
||||||
|
elif (not os.path.isfile(filename)):
|
||||||
if "normalised" in filename:
|
self.logger.log.exception("Filename for normalisation does not exist. This is bad.")
|
||||||
|
continue
|
||||||
|
elif "normalised" in filename:
|
||||||
continue
|
continue
|
||||||
# Sweet, we now need to try generating a normalised version.
|
# Sweet, we now need to try generating a normalised version.
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -16,7 +16,7 @@ def generate_normalised_file(filename: str):
|
||||||
if filename.endswith("-normalised.mp3"):
|
if filename.endswith("-normalised.mp3"):
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
normalised_filename = "{}-normalised.mp3".format(filename.rstrip(".mp3"))
|
normalised_filename = "{}-normalised.mp3".format(filename.rsplit(".",1)[0])
|
||||||
|
|
||||||
# The file already exists, short circuit.
|
# The file already exists, short circuit.
|
||||||
if (os.path.exists(normalised_filename)):
|
if (os.path.exists(normalised_filename)):
|
||||||
|
|
Loading…
Reference in a new issue