Skip to content

Commit

Permalink
Fix Subsonic relative path
Browse files Browse the repository at this point in the history
The path of the track should be the relative path.

See ampache/ampache#1213 (comment)
  • Loading branch information
DocMarty84 committed Sep 29, 2018
1 parent fb5bd60 commit 172ee3a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion controllers/subsonic/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def make_Child_track(self, track, tag_name='child'):
transcodedSuffix='mp3',
duration=str(track.duration),
bitRate=str(track.bitrate),
path=os.path.basename(track.path),
path=track.path.replace(track.root_folder_id.path + os.sep, ''),
)

if track.name:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_sub_browsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_05_getIndexes(self):
'f1_last': folders[2].last_modification*1000,
't1_id': tracks[4].id,
't1_parent': tracks[4].folder_id.id,
't1_path': os.path.basename(tracks[4].path),
't1_path': tracks[4].path.replace(tracks[4].root_folder_id.path + os.sep, ''),
't1_album': tracks[4].album_id.name,
't1_artist': tracks[4].artist_id.name,
't1_num': tracks[4].track_number,
Expand All @@ -90,7 +90,7 @@ def test_05_getIndexes(self):
't1_artist_id': tracks[4].artist_id.id,
't2_id': tracks[5].id,
't2_parent': tracks[5].folder_id.id,
't2_path': os.path.basename(tracks[5].path),
't2_path': tracks[5].path.replace(tracks[5].root_folder_id.path + os.sep, ''),
't2_album': tracks[5].album_id.name,
't2_artist': tracks[5].artist_id.name,
't2_num': tracks[5].track_number,
Expand Down Expand Up @@ -167,7 +167,7 @@ def test_10_getMusicDirectory(self):
'f1_parent': folders[1].id,
't1_id': tracks[4].id,
't1_parent': tracks[4].folder_id.id,
't1_path': os.path.basename(tracks[4].path),
't1_path': tracks[4].path.replace(tracks[4].root_folder_id.path + os.sep, ''),
't1_name': tracks[4].name,
't1_album': tracks[4].album_id.name,
't1_artist': tracks[4].artist_id.name,
Expand All @@ -179,7 +179,7 @@ def test_10_getMusicDirectory(self):
't1_artist_id': tracks[4].artist_id.id,
't2_id': tracks[5].id,
't2_parent': tracks[5].folder_id.id,
't2_path': os.path.basename(tracks[5].path),
't2_path': tracks[5].path.replace(tracks[5].root_folder_id.path + os.sep, ''),
't2_name': tracks[5].name,
't2_album': tracks[5].album_id.name,
't2_artist': tracks[5].artist_id.name,
Expand Down

0 comments on commit 172ee3a

Please sign in to comment.