diff --git a/app/config.py b/app/config.py index 1b21e0e..ac8d4e4 100644 --- a/app/config.py +++ b/app/config.py @@ -12,6 +12,7 @@ class Config(object): CART_DIRECTORY = "/home/kae/radio/CartTracks" CARTS_COUNT = 10 CARTS_HIDE = True + COLON_IN_PATH_FIX = True COLOUR_BITRATE_LOW = "#ffcdd2" COLOUR_BITRATE_MEDIUM = "#ffeb6f" COLOUR_BITRATE_OK = "#dcedc8" diff --git a/app/helpers.py b/app/helpers.py index 69c7b97..b59a4db 100644 --- a/app/helpers.py +++ b/app/helpers.py @@ -56,20 +56,14 @@ def fade_point( return int(trim_ms) -def file_is_readable(path: str, check_colon: bool = True) -> bool: +def file_is_readable(path: str) -> bool: """ Returns True if passed path is readable, else False vlc cannot read files with a colon in the path """ - if os.access(path, os.R_OK): - if check_colon: - return ':' not in path - else: - return True - - return False + return os.access(path, os.R_OK) def get_audio_segment(path: str) -> Optional[AudioSegment]: diff --git a/app/music.py b/app/music.py index 5ee5842..2a0f77c 100644 --- a/app/music.py +++ b/app/music.py @@ -111,7 +111,11 @@ class Music: status = -1 self.track_path = path - self.player = self.VLC.media_player_new(path) + if Config.COLON_IN_PATH_FIX: + media = self.VLC.media_new_path(path) + self.player = media.player_new_from_media() + else: + self.player = self.VLC.media_player_new(path) if self.player: self.player.audio_set_volume(self.max_volume) self.current_track_start_time = datetime.now()