diff --git a/abletonosc/song.py b/abletonosc/song.py index 58d5f72..f0e2acd 100644 --- a/abletonosc/song.py +++ b/abletonosc/song.py @@ -245,6 +245,26 @@ def song_jump_to_cue_point(song, params: Tuple[Any] = ()): cue_point = song.cue_points[cue_point_index] cue_point.jump() self.osc_server.add_handler("/live/song/cue_point/jump", partial(song_jump_to_cue_point, self.song)) + + #-------------------------------------------------------------------------------- + # Callbacks for Song: File, Project, and Set Name + #-------------------------------------------------------------------------------- + def get_live_set_details(song, _): + """ + Handler function to return File, Project, and Set names as a tuple of length 3 when requested via OSC. + + Returns: + tuple: A tuple containing the full file path, parent folder name and + song file name of the current Live Set. + """ + song_file_path = song.file_path + folder_name = os.path.basename(os.path.dirname(song_file_path)) + song_file_name = os.path.basename(song_file_path) + + return (song_file_path, folder_name, song_file_name) + + # Register the handler function to be triggered when "/live/song/get/live_set" is received via OSC + self.osc_server.add_handler("/live/song/get/live_set", partial(get_live_set_details, self.song)) #-------------------------------------------------------------------------------- # Listener for /live/song/get/beat