Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new tracks to the Rekordbox 6 database #121

Merged
merged 8 commits into from
Feb 22, 2024

Conversation

cvdub
Copy link
Contributor

@cvdub cvdub commented Feb 7, 2024

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
Copy link

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 ⚠️

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

Additional details and impacted files
@@            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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cvdub cvdub marked this pull request as ready for review February 7, 2024 05:34
@cvdub cvdub marked this pull request as draft February 7, 2024 05:35
@cvdub cvdub marked this pull request as ready for review February 7, 2024 05:35
@dylanljones
Copy link
Owner

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:

  • The FileType is always set to 1 (MP3). I haven't checked the value for all supported audio formats, but we should try to cover all.
  • You can actually remove the created_at and updated_at fields, the table declaration handles this automatically.
  • For what is DeliveryControl used? Is it really always 'on'?
  • I switched to pathlib.Path for the file path stuff, maybe replace the os.path parts for consistency. But this is only preference (and one less import).

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
Copy link
Contributor Author

cvdub commented Feb 12, 2024

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

@cvdub
Copy link
Contributor Author

cvdub commented Feb 21, 2024

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 dylanljones merged commit a9d6a46 into dylanljones:master Feb 22, 2024
@dylanljones
Copy link
Owner

Very nice, thanks again for your effort!:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants