Closed JOJ0 closed 1 year ago
Hi, thank you, that's a very good point! It's not supported yet, and I don't really have a way to test the config on a Mac, but i will try to add that feature soon:)
I can offer to test from the PR branch once you open it :-)
I think the issue was an error when parsing the version number. Could you check if the fixes in the new branch rb_versions
work for you?
Hi, sorry for the late response and thanks for the effort in fixing it.
I can report the following:
Installed as pip install git+https://github.com/dylanljones/pyrekordbox.git@rb_versions
pip list | grep pyrek
pyrekordbox 0.1.6.dev7+g5e1be6c
Did a testrun of my program that's using pyrekordbox which worked fine,
then renamed /Applications/rekordbox 6/rekordbox.app
to /Applications/rekordbox 6/rekordbox 6.7.3.app
and it failed like this:
Traceback (most recent call last):
File "/Users/jojo/.pyenv/versions/jteezer310/bin/jteezer", line 8, in <module>
sys.exit(root())
File "/Users/jojo/.pyenv/versions/3.10.5/envs/jteezer310/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/Users/jojo/.pyenv/versions/3.10.5/envs/jteezer310/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Users/jojo/.pyenv/versions/3.10.5/envs/jteezer310/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/jojo/.pyenv/versions/3.10.5/envs/jteezer310/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/jojo/.pyenv/versions/3.10.5/envs/jteezer310/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Users/jojo/.pyenv/versions/3.10.5/envs/jteezer310/lib/python3.10/site-packages/click/decorators.py", line 38, in new_func
return f(get_current_context().obj, *args, **kwargs)
File "/Users/jojo/git/jteezer/jteezer/jteezer.py", line 597, in rekordbox_cmd
db = Rekordbox6Database(key=db_key)
File "/Users/jojo/.pyenv/versions/3.10.5/envs/jteezer310/lib/python3.10/site-packages/pyrekordbox/db6/database.py", line 165, in __init__
raise FileNotFoundError(f"No Rekordbox v6 directory found in '{pdir}'")
FileNotFoundError: No Rekordbox v6 directory found in '/Applications'
Is it supposed to find any .app directory that might be the latest rekordbox or do I have to configure it / tell it?
The error message on the other hand is telling that it didn't even find the rekordbox 6 directory (which is default on my system, did not rename it afaik)
Hope that helps so far, throw new commits at me, I'll try to test as soon as I find a minute this time! :-)
Hey @JOJ0 , no worries!
ah I see, didn't think far enough in the first fix:D Could you maybe run the following for the default and renamed Rekordbox app and post the output here?
from pyrekordbox import show_config
show_config()
Don't forget to remove any personal info;)
It is a bit tricky without having the option to look at the file system, but I think that should be enough to figure it out.
Just to be clear, /Applications/rekordbox 6/rekordbox 6.7.3.app
is a directory, right?
I want to re-implement the configuration anyway, it is a bit messy. This is a good chance to do so, but it could take a little.
Yes, .app files on macs surprisingly enough are always directories, at least as far as I know :-)
I am a little confused about the installation directories you posted. I took a closer look at how the directory is found for default installations, and it seems like the location should only be /Applications
, not /Applications/rekordbox 6
. In the last example, did you also supplied the locations via
from pyrekordbox.config import update_config
pioneer_install_dir = "/Applications/rekordbox 6"
pioneer_app_dir = "/Users/jojo/Library/Application Support/Pioneer/rekordbox6"
update_config(pioneer_install_dir, pioneer_app_dir)
I think the easiest solution is to let the user also pass the actual directory name, so rekordbox 6.7.3.app
in your case. Will commit the changes shortly, let me know if it works.
I created a new branch config
, since i cleaned up the configuration. Could you try the following?
from pyrekordbox import update_config, show_config
pioneer_install_dir = "/Applications/rekordbox 6"
pioneer_app_dir = "/Users/jojo/Library/Application Support/Pioneer/rekordbox6"
dirname = "rekordbox 6.7.3.app"
update_config(pioneer_install_dir, pioneer_app_dir, rb6_install_dirname=dirname)
show_config()
I am still a little confused about the pioneer_app_dir
, did you move that too? If not, omit that argument:
update_config(pioneer_install_dir, rb6_install_dirname=dirname)
If it doesn't work, you might have to look on your machine. The directory should contain at least two directories, rekordbox6
and rekordboxAgent
. So the pioneer_app_dir
path should not contain rekordbox6
.
This is still not the cleanest solution, but i hope it works!
Hey @JOJ0, any updates if this fixes the issue?
Try to give an update in the next days/weeks. Soonish! Holiday right now :-)
ah sorry, enjoy your vacation:-)
I tested different versions on Windows, if this is still an issue on Macs please reopen.
Hi, sorry for the massive delay with testing. Please clarify where update_config
and show_config
should be imported from?pyrekordbox.config
or pyrekordbox
?
You stated this above:
from pyrekordbox import update_config, show_config
Correct?
With 0.2.1 I'm getting:
from pyrekordbox import update_config
ImportError: cannot import name 'update_config' from 'pyrekordbox' (/Users/jojo/.pyenv/versions/3.10.5/envs/jteezer310/lib/python3.10/site-packages/pyrekordbox/__init__.py)
rb6_install_dirname
:$ pip list | grep pyrekordbox
pyrekordbox 0.2.1
my code snippet:
from pyrekordbox import show_config
from pyrekordbox.config import update_config
from pyrekordbox import Rekordbox6Database
from pyrekordbox.db6 import DjmdPlaylist
pioneer_install_dir = "/Applications/rekordbox 6"
rb_app = 'rekordbox 6.7.6.app'
update_config(pioneer_install_dir, rb6_install_dirname=rb_app)
leads to
...
update_config(pioneer_install_dir, rb6_install_dirname=rb_app)
TypeError: update_config() got an unexpected keyword argument 'rb6_install_dirname'
I am still a little confused about the
pioneer_app_dir
, did you move that too? If not, omit that argument:update_config(pioneer_install_dir, rb6_install_dirname=dirname)
No I did not move it. I was just unsure whether it's a mandatory argument or not. I just stated it to make sure, also IIRC as it was documented back then. Leaving it out from now on. Thanks for the hint.
If it doesn't work, you might have to look on your machine. The directory should contain at least two directories,
rekordbox6
andrekordboxAgent
. So thepioneer_app_dir
path should not containrekordbox6
.This is still not the cleanest solution, but i hope it works!
I created a new branch
config
, since i cleaned up the configuration. Could you try the following?
BTW this branch is not existing anymore, thus as noted above I tested with a released version 0.2.1. git history tells me that the fix should be in there.
Do you want to see testruns from current git master? Can provide them shortly (this time for real! ;-) if you think it helps. :-)
Hey, no worries:D
The config changes aren't in the latest release yet, please install the latest version from GitHub, then update_config
should accept the keyword argument. And yes, my bad, that was a typo, you should import
from pyrekordbox.config import update_config
I will change that later, would be better if you could just import that from the top-level import. I merged the branch into master recently, since (at least for me on Windows) the fix worked. Please just use the master branch from now on.
Do you want to see testruns from current git master?
That would be great:) But please test on your system, the unit tests for config are kind of hacked together. They just test if config finds the latest installed version. And the directory names on your machine might vary. I will make the import change mentioned above when i am home later today!
Thanks for the help!
Should be importable either way now!
Hi, from current master - as of writing:
This is with
pioneer_app_dir = "/Users/jojo/Library/Application Support/Pioneer/"
passed to update_config
:
[07:59:49] pyrekordbox.config:WARNING - Could not extract password: [Errno 2] No such file or directory: '/Applications/rekordbox 6/rekordbox.app/Contents/MacOS/rekordboxAgent.app/Contents/Resources/app.asar'
[07:59:50] pyrekordbox.config:WARNING - Could not extract password: [Errno 2] No such file or directory: '/Applications/rekordbox 6/rekordbox 6.7.6.app/rekordbox.app/Contents/MacOS/rekordboxAgent.app/Contents/Resources/app.asar'
Traceback (most recent call last):
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context
self.dialect.do_execute(
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute
cursor.execute(statement, parameters)
sqlite3.DatabaseError: file is not a database
and this is without passing pioneer_app_dir
:
to be specific, this is the snippet:
from pyrekordbox import show_config, update_config
from pyrekordbox import Rekordbox6Database
from pyrekordbox.db6 import DjmdPlaylist
pioneer_install_dir = "/Applications/rekordbox 6"
# pioneer_app_dir = "/Users/jojo/Library/Application Support/Pioneer/"
rb_app = 'rekordbox 6.7.6.app'
update_config(
pioneer_install_dir, rb6_install_dirname=rb_app)
and this the output:
[08:10:42] pyrekordbox.config:WARNING - Could not extract password: [Errno 2] No such file or directory: '/Applications/rekordbox 6/rekordbox.app/Contents/MacOS/rekordboxAgent.app/Contents/Resources/app.asar'
[08:10:42] pyrekordbox.config:WARNING - Could not extract password: [Errno 2] No such file or directory: '/Applications/rekordbox 6/rekordbox 6.7.6.app/rekordbox.app/Contents/MacOS/rekordboxAgent.app/Contents/Resources/app.asar'
Traceback (most recent call last):
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context
self.dialect.do_execute(
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute
cursor.execute(statement, parameters)
sqlite3.DatabaseError: file is not a database
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/jojo/.pyenv/versions/beets310/bin/jteezer", line 8, in <module>
sys.exit(root())
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/click/decorators.py", line 38, in new_func
return f(get_current_context().obj, *args, **kwargs)
File "/Users/jojo/git/jteezer/jteezer/jteezer.py", line 731, in rekordbox_cmd
for playlist in playlists.order_by(order_by):
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 2833, in __iter__
result = self._iter()
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 2847, in _iter
result: Union[ScalarResult[_T], Result[_T]] = self.session.execute(
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2306, in execute
return self._execute_internal(
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2188, in _execute_internal
result: Result[Any] = compile_state_cls.orm_execute_statement(
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/sqlalchemy/orm/context.py", line 293, in orm_execute_statement
result = conn.execute(
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1416, in execute
return meth(
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 516, in _execute_on_connection
return connection._execute_clauseelement(
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1639, in _execute_clauseelement
ret = self._execute_context(
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1848, in _execute_context
return self._exec_single_context(
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1988, in _exec_single_context
self._handle_dbapi_exception(
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2343, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context
self.dialect.do_execute(
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.DatabaseError: (sqlite3.DatabaseError) file is not a database
[SQL: SELECT "djmdPlaylist"."ID" AS "djmdPlaylist_ID", "djmdPlaylist"."Seq" AS "djmdPlaylist_Seq", "djmdPlaylist"."Name" AS "djmdPlaylist_Name", "djmdPlaylist"."ImagePath" AS "djmdPlaylist_ImagePath", "djmdPlaylist"."Attribute" AS "djmdPlaylist_Attribute", "djmdPlaylist"."ParentID" AS "djmdPlaylist_ParentID", "djmdPlaylist"."SmartList" AS "djmdPlaylist_SmartList", "djmdPlaylist"."UUID" AS "djmdPlaylist_UUID", "djmdPlaylist".rb_data_status AS "djmdPlaylist_rb_data_status", "djmdPlaylist".rb_local_data_status AS "djmdPlaylist_rb_local_data_status", "djmdPlaylist".rb_local_deleted AS "djmdPlaylist_rb_local_deleted", "djmdPlaylist".rb_local_synced AS "djmdPlaylist_rb_local_synced", "djmdPlaylist".usn AS "djmdPlaylist_usn", "djmdPlaylist".rb_local_usn AS "djmdPlaylist_rb_local_usn", "djmdPlaylist".created_at AS "djmdPlaylist_created_at", "djmdPlaylist".updated_at AS "djmdPlaylist_updated_at"
FROM "djmdPlaylist" ORDER BY "djmdPlaylist"."Seq"]
(Background on this error at: https://sqlalche.me/e/20/4xp6)
HTH :-)
Since you mentioned that earlier,
If it doesn't work, you might have to look on your machine. The directory should contain at least two directories,
rekordbox6
andrekordboxAgent
. So thepioneer_app_dir
path should not containrekordbox6
.
I double checked how this directory looks on my machine exactly:
And now another final test with this snippet:
from pyrekordbox import show_config, update_config
from pyrekordbox import Rekordbox6Database
from pyrekordbox.db6 import DjmdPlaylist
pioneer_install_dir = "/Applications/rekordbox 6"
# pioneer_app_dir = "/Users/jojo/Library/Application Support/Pioneer/"
# rb_app = 'rekordbox 6.7.6.app'
rb_app = 'rekordbox.app'
update_config(
pioneer_install_dir, rb6_install_dirname=rb_app)
and I also renamed back rekordbox 6.7.6.app
to just rekordbox.app
on the filesystem:
WARNING:root:Incompatible rekordbox 6 database: Could not retrieve db-key.
Traceback (most recent call last):
File "/Users/jojo/.pyenv/versions/beets310/bin/jteezer", line 8, in <module>
sys.exit(root())
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Users/jojo/.pyenv/versions/beets310/lib/python3.10/site-packages/click/decorators.py", line 38, in new_func
return f(get_current_context().obj, *args, **kwargs)
File "/Users/jojo/git/jteezer/jteezer/jteezer.py", line 696, in rekordbox_cmd
update_config(
File "/Users/jojo/git/pyrekordbox/pyrekordbox/config.py", line 586, in update_config
conf = _get_rb6_config(
File "/Users/jojo/git/pyrekordbox/pyrekordbox/config.py", line 411, in _get_rb6_config
conf = _get_rb_config(pioneer_prog_dir, pioneer_app_dir, major_version, dirname)
File "/Users/jojo/git/pyrekordbox/pyrekordbox/config.py", line 278, in _get_rb_config
raise ValueError(
ValueError: Major version is 6, but the supplied application dirname is 'rekordbox.app'
Your first comment suggests to me that the config actually worked this time. The error you are getting is probably because pyrekordbox
falls back to importing sqlite3
if sqlcipher3
cannot be imported.
Since the migration to SqlAlchemy 2.0 in version 0.2.1
the old SqlCipher library (pysqlcipher3) is not longer supported since it is incompatible. Have you installed sqlcipher3? Also check (the end) of this issue if you are having problems installing it.
Otherwise it looks to me that the configuration was successful, otherwise you would have gotten an error earlier:) Also thanks for the screenshot of your installation directory!
Concerning you last comment: Those are some additional checks that raised the error. It should work with the default name (so no need to passrb6_install_dirname
in that case), but i will try to remove that error later. I agree that just passing the original directory name should also work!
By the way, if you also want to have a look, the part of the code we are discussing is actually not that long:
I will apply the fix later today, if that still doesn't resolve your issue maybe you can help fixing it? If a directory name is passed only the first part of the if
statement is used, so not that complicated:D
I will apply the fix later today, if that still doesn't resolve your issue maybe you can help fixing it? If a directory name is passed only the first part of the
if
statement is used, so not that complicated:D
on it! What's unclear to me in the code:
This error seems to be useful and from my humble understanding right now sufficient to catch when something's wrong:
pyrekordbox.config.InvalidApplicationDirname: The supplied application dirname 'rekordbox.app' does not exist in '/Applications/rekordbox 6'
but why do we need that one:
File "/Users/jojo/git/pyrekordbox/pyrekordbox/config.py", line 279, in _get_rb_config
raise ValueError(
ValueError: Major version is 6, but the supplied application dirname is 'rekordbox.app'
I think we could remove that entirely. Or is there any reason why a version number should be in the rekordbox.app directory? It could be an arbitrary name. No matter if it's called rekordbox6.app or rekordbox 6.1.app or whatever.
I'll open a PR just removing that part. What do you think?
By the way, did installing sqlcipher3 resolve the first error?
Didnt go down the sqlcipher install rabbithole yet. It reads scary, homebrew and symlinking of libs involved. I'm using an old macOS version (10.15 Catalina) unsupported by homebrew already. All that points to possible PITA... 😆😅
Will do when I feel brave enough again. Thanks for the hints in any case!👌
Ah I see, at least you won't run into the issues on M1 Mac's:D If you don't feel like installing SQLCipher you can always just build against the amalgamation files, no need for Homebrew there;)
https://pyrekordbox.readthedocs.io/en/latest/installation.html#id1
You can also use the CLI for the steps described in the docs:
python3 -m pyrekordbox install-sqlcipher
Only works on MacOS since the last commit though, so use the latest version from GitHub. Hope that helps;)
python3 -m pyrekordbox install-sqlcipher
Oh yeah, that worked! Thanks so much for that hint! Awesome, that was way too easy now! :-)))
I rename my rekordbox app packages with additional version numbers, thus I can revert to previous versions if something gets unstable with an update (yes it happens to Pioneer software as well ;-)
eg.
/Applications/rekordbox 6/rekordbox 6.7.3.app
I'm not sure if this is supported yet, I'm getting:
while doing