parent
30bd23c088
commit
d9851adf65
@ -12,6 +12,7 @@ class Config(object):
|
|||||||
CART_DIRECTORY = "/home/kae/radio/CartTracks"
|
CART_DIRECTORY = "/home/kae/radio/CartTracks"
|
||||||
CARTS_COUNT = 10
|
CARTS_COUNT = 10
|
||||||
CARTS_HIDE = True
|
CARTS_HIDE = True
|
||||||
|
COLON_IN_PATH_FIX = True
|
||||||
COLOUR_BITRATE_LOW = "#ffcdd2"
|
COLOUR_BITRATE_LOW = "#ffcdd2"
|
||||||
COLOUR_BITRATE_MEDIUM = "#ffeb6f"
|
COLOUR_BITRATE_MEDIUM = "#ffeb6f"
|
||||||
COLOUR_BITRATE_OK = "#dcedc8"
|
COLOUR_BITRATE_OK = "#dcedc8"
|
||||||
|
|||||||
@ -56,20 +56,14 @@ def fade_point(
|
|||||||
return int(trim_ms)
|
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
|
Returns True if passed path is readable, else False
|
||||||
|
|
||||||
vlc cannot read files with a colon in the path
|
vlc cannot read files with a colon in the path
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if os.access(path, os.R_OK):
|
return os.access(path, os.R_OK)
|
||||||
if check_colon:
|
|
||||||
return ':' not in path
|
|
||||||
else:
|
|
||||||
return True
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def get_audio_segment(path: str) -> Optional[AudioSegment]:
|
def get_audio_segment(path: str) -> Optional[AudioSegment]:
|
||||||
|
|||||||
@ -111,7 +111,11 @@ class Music:
|
|||||||
status = -1
|
status = -1
|
||||||
self.track_path = path
|
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:
|
if self.player:
|
||||||
self.player.audio_set_volume(self.max_volume)
|
self.player.audio_set_volume(self.max_volume)
|
||||||
self.current_track_start_time = datetime.now()
|
self.current_track_start_time = datetime.now()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user