dylanljones / pyrekordbox

Inofficial Python package for interacting with the database and other files (XML, ANLZ, MySettings) of Pioneers Rekordbox DJ software
https://pyrekordbox.readthedocs.io/en/latest/
MIT License
176 stars 22 forks source link

Add new tracks to the Rekordbox 6 database #121

Closed cvdub closed 6 months ago

cvdub commented 7 months ago

This PR adds a method for adding new tracks to the Rekordbox 6 database. It seems to be working on MacOS, but I haven't testetd it on Windows.

The new method doesn't set any of the track metadata information. The new track just shows up in Rekordbox with blank values for Title, Artist, Album, etc. However, Rekordbox is able to pull in all that information (including creating any related data like DjmdArtist) if you right click on the track in rb and select "Reload Tag."

Would you be apposed to adding mutagen as a dependency so we can populate the track metadata when it's created by pyrekordbox?

I'm also still not 100% sure about the ContentLink value. It seems to be a reference to the rb_local_usn from the TRACK DjmdMenuItem. That value matches for new tracks that I add manually to Rekordbox, but there are older tracks in my library with a ContentLink value that doesn't seem to point to anything.

Once this functionality is finalized and approved I'll update the relevant documentation.

codecov-commenter commented 7 months ago

Codecov Report

Attention: 16 lines in your changes are missing coverage. Please review.

Comparison is base (897a48b) 87.92% compared to head (4b5e00d) 87.47%. Report is 4 commits behind head on master.

Files Patch % Lines
pyrekordbox/db6/database.py 27.27% 16 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #121 +/- ## ========================================== - Coverage 87.92% 87.47% -0.46% ========================================== Files 17 17 Lines 2998 3017 +19 ========================================== + Hits 2636 2639 +3 - Misses 362 378 +16 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

dylanljones commented 7 months ago

Hey @cvdub ,

sorry for the late response, had a lot of stuff going on. Thank you a lot for your effort, this looks really good! I did not want to add this feature, since you need to analyse/reload the tags anyway in Rekordbox, but actually this seems quite useful:) I would not mind adding metadata support via mutagen, but for now we can just add **kwargs to the method and pass those to the table creation method. I have a mutagen wrapper somewhere, i can add that to the library. I have no idea what the ContentLink value should be, i checked my collection and for me it does not match the rb_local_usn. For me it points to nothing for all tracks. I will look into this, haven't spent much time on the DjmdMenuItem table anyways, so I'm not sure what this table is used for.

There are a few things i have noticed in your PR that should be resolved:

Other than that i think this can be merged, thanks again for taking the time to add this feature!

PS: Also thank you for updating the docs and using the correct commit message style;)

cvdub commented 7 months ago

Thanks for the detailed feeback! I should hopefully have time this week to work updating the PR per your comments.

cvdub commented 7 months ago

Updated the PR per your feedback. Some notes below:

I have no idea what the ContentLink value should be, i checked my collection and for me it does not match the rb_local_usn. For me it points to nothing for all tracks.

ContentLink also doesn't seem to match anything for older tracks in my library, but, when I add a new track manually via the rekordbox interface, the ContentLink value for those new tracks does always match the rb_local_usn from the TRACK DjmdMenuItem. This could just be a coincidence.

For what is DeliveryControl used? Is it really always 'on'

DeliveryControl is always "on" for new tracks that I add manually, but it's not "on" for any of my older tracks. I removed this default and everything still seems to be working for new tracks when DeliveryControl is empty.

dylanljones commented 6 months ago

Very nice, thanks again for your effort!:)