Describe the bug
For some reason, when adding track to the database through Rekordbox, the FolderPath stored for the DjmContent is a POSIX-like path (e.g. D:/Music/Track.mp3). However, if we try to add content or get content by path, the path will always be resolved as a Windows path (e.g. D:\\Music\\Track.mp3).
To Reproduce
Steps to reproduce the behavior:
- Add a new track through Rekordbox
- Close Rekordbox
- Try to add the same track using pyrekordbox
# Using Windows path
db.add_content(path="D:\\Music\\Track.mp3")
# Using POSIX-like path
db.add_content(path="D:/Music/Track.mp3")
Current behavior
No error triggered as both path didn't match. The query inside add_content() will returns 0
Expected behavior
Expecting app_content() to raise a ValueError
Environment
- Pyrekordbox version: 0.4.4
- Rekordbox version: 6.8.6
Possible fix
Quick fix: force the path representation inside add_content() to be a POSIX-like string like this
path = Path(path)
path_string = path.as_posix()
query = self.query(tables.DjmdContent).filter_by(FolderPath=path_string)
Long term more robust fix: improve the query to search for both / and \ path representation
Describe the bug
For some reason, when adding track to the database through Rekordbox, the FolderPath stored for the DjmContent is a POSIX-like path (e.g.
D:/Music/Track.mp3). However, if we try to add content or get content by path, the path will always be resolved as a Windows path (e.g.D:\\Music\\Track.mp3).To Reproduce
Steps to reproduce the behavior:
Current behavior
No error triggered as both path didn't match. The query inside add_content() will returns 0
Expected behavior
Expecting app_content() to raise a ValueError
Environment
Possible fix
Quick fix: force the path representation inside add_content() to be a POSIX-like string like this
Long term more robust fix: improve the query to search for both
/and\path representation