Closed ggalan87 closed 4 years ago
Something like this seems to work
def getPlaylistNameFromPath(playlistPath):
name_split = basename(playlistPath).split('.')
name_split.pop()
return ' '.join(name_split)
Something like this seems to work
def getPlaylistNameFromPath(playlistPath): name_split = basename(playlistPath).split('.') name_split.pop() return ' '.join(name_split)
Last line should probably be "return '.'.join(name_split)". Please follow the suggestion of the above stackoverflow link, combine with basename function and submit a pull request.
The implementation below is wrong as filenames may include dots.
https://github.com/UoC-Radio/flow-dashboard/blob/43048e3500c4f9b31925cc52e3ae7401a8bfd286/helpers.py#L49-L50
Need to implement it as suggested in https://stackoverflow.com/questions/678236/how-to-get-the-filename-without-the-extension-from-a-path-in-python