Skip to content

Windows path does not match Rekordbox Database path #194

Description

@tonarec

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:

  1. Add a new track through Rekordbox
  2. Close Rekordbox
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions