Clean up strip_path and logging

This commit is contained in:
Andrea Mistrali 2021-02-23 10:40:59 +01:00
parent 48e7d2964e
commit 1a65501cee

View file

@ -53,6 +53,13 @@ class MPDClientWrapper(object):
self.music_directory = mpd_config['music_directory'].as_str() self.music_directory = mpd_config['music_directory'].as_str()
self.strip_path = mpd_config['strip_path'].as_str() self.strip_path = mpd_config['strip_path'].as_str()
# Ensure strip_path end with '/'
if not self.strip_path.endswith('/'):
self.strip_path += '/'
self._log.debug('music_directory: {0}', self.music_directory)
self._log.debug('strip_path: {0}', self.strip_path)
if sys.version_info < (3, 0): if sys.version_info < (3, 0):
# On Python 2, use_unicode will enable the utf-8 mode for # On Python 2, use_unicode will enable the utf-8 mode for
# python-mpd2 # python-mpd2
@ -132,6 +139,7 @@ class MPDClientWrapper(object):
result = os.path.join(self.music_directory, file) result = os.path.join(self.music_directory, file)
else: else:
result = entry['file'] result = entry['file']
self._log.debug('returning: {0}', result)
return result, entry.get('id') return result, entry.get('id')
def status(self): def status(self):