lexicon-python 0.5.0__tar.gz → 0.5.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/PKG-INFO +46 -19
  2. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/README.md +45 -18
  3. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/pyproject.toml +2 -2
  4. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/client.py +5 -2
  5. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/resources/control_types.py +59 -3
  6. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/resources/tracks.py +5 -1
  7. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon_python.egg-info/PKG-INFO +46 -19
  8. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon_python.egg-info/SOURCES.txt +1 -1
  9. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/tests/test_client.py +38 -4
  10. lexicon_python-0.5.2/tests/test_integration_library_guard.py +403 -0
  11. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/tests/test_tracks.py +14 -0
  12. lexicon_python-0.5.0/tests/test_integration_lifecycle.py +0 -366
  13. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/LICENSE +0 -0
  14. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/setup.cfg +0 -0
  15. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/__init__.py +0 -0
  16. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/colors.py +0 -0
  17. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/resources/__init__.py +0 -0
  18. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/resources/_common_types.py +0 -0
  19. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/resources/base.py +0 -0
  20. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/resources/player.py +0 -0
  21. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/resources/player_types.py +0 -0
  22. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/resources/playlist_tracks.py +0 -0
  23. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/resources/playlist_tracks_types.py +0 -0
  24. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/resources/playlists.py +0 -0
  25. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/resources/playlists_types.py +0 -0
  26. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/resources/tag_categories.py +0 -0
  27. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/resources/tag_categories_types.py +0 -0
  28. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/resources/tags.py +0 -0
  29. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/resources/tags_types.py +0 -0
  30. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/resources/tracks_types.py +0 -0
  31. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/tools/__init__.py +0 -0
  32. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/tools/playlists.py +0 -0
  33. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/tools/tempo.py +0 -0
  34. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/tools/tracks.py +0 -0
  35. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon/utils.py +0 -0
  36. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon_python.egg-info/dependency_links.txt +0 -0
  37. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon_python.egg-info/requires.txt +0 -0
  38. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/src/lexicon_python.egg-info/top_level.txt +0 -0
  39. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/tests/test_base.py +0 -0
  40. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/tests/test_colors.py +0 -0
  41. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/tests/test_common_types.py +0 -0
  42. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/tests/test_player.py +0 -0
  43. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/tests/test_playlist_tracks.py +0 -0
  44. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/tests/test_playlists.py +0 -0
  45. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/tests/test_playlists_types.py +0 -0
  46. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/tests/test_tag_categories.py +0 -0
  47. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/tests/test_tags.py +0 -0
  48. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/tests/test_tools_playlists.py +0 -0
  49. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/tests/test_tools_tempo.py +0 -0
  50. {lexicon_python-0.5.0 → lexicon_python-0.5.2}/tests/test_tools_tracks.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lexicon-python
3
- Version: 0.5.0
3
+ Version: 0.5.2
4
4
  Summary: Python client for the Lexicon DJ API
5
5
  Author-email: Garrison Burger <burgerga123@gmail.com>
6
6
  License-Expression: MIT
@@ -399,14 +399,16 @@ queue = lex.player.queue() # the tracks after the loaded one
399
399
  lex.control("MusicPlayer_TogglePlay")
400
400
  lex.control("MusicPlayer_Load", id=123)
401
401
  lex.control("MusicPlayer_Seek", seconds=30)
402
+ lex.control("GhostCurator_LoadSuggestion", index=0, deckNumber=2)
402
403
  ```
403
404
 
404
405
  It returns `True` when Lexicon accepts the request. Lexicon does not wait for the action to finish and has no completion
405
406
  signal, and it accepts an action whose target is missing, such as one for the selected tracks with nothing selected.
406
- Names are checked against the `ControlAction` list; pass `validation="off"` for one that is not listed. The list covers
407
- Lexicon v1.11 and v1.12, so it holds both names of the actions v1.12 renamed: v1.12 calls the `Direct2Cdj_*` player
408
- actions `DeckConnect_*` (`DeckConnect_LoadDeck`, `DeckConnect_LoadDeck1` to `8`, `DeckConnect_LoadEmptyDeck`) and
409
- rejects the old names.
407
+ Names are checked against the `ControlAction` list; pass `validation="off"` for one that is not listed. The list follows
408
+ the newest API spec, so it can hold actions an older Lexicon does not know, such as `MusicPlayer_PreviewSelected` and
409
+ `DeckConnect_FindDeckTrack`, which the spec published with v1.12.5 added. It also keeps `Direct2Cdj_LoadDeck`,
410
+ `Direct2Cdj_LoadDeck1` to `8`, and `Direct2Cdj_LoadEmptyDeck`, the v1.11 names of the `DeckConnect_*` load actions;
411
+ v1.12 rejects them.
410
412
 
411
413
  ## Tools
412
414
 
@@ -473,7 +475,7 @@ v1.11 answers differently:
473
475
  | `playlists.update(position=)` | inserts, others shift | stores the number, positions can overlap |
474
476
  | `tags.categories.update(tags=, position=)` | yes | accepted but ignored |
475
477
  | Cue `activeLoop` | sent as `true`/`false` | not tested with booleans |
476
- | DeckConnect actions | `DeckConnect_*` | `Direct2Cdj_*` |
478
+ | DeckConnect actions | `DeckConnect_*` | `Direct2Cdj_*` for the ten load actions |
477
479
 
478
480
  ## Type Hints
479
481
 
@@ -514,19 +516,43 @@ The lockfile (`uv.lock`) is checked in to ensure reproducible installs.
514
516
  ### Running Tests
515
517
 
516
518
  ```bash
517
- # Unit tests
518
- make run-tests
519
-
520
- # Integration tests (requires Lexicon running)
521
- # Note: Integration tests enforce an empty library state to avoid destructive edits on existing libraries.
522
- # The fixture setup will back up the existing library, clear it for testing, and restore it afterward.
523
- make run-integration-tests
519
+ make run-tests # unit tests, no Lexicon needed
520
+ make run-integration-tests # integration tests, against Lexicon with an empty test library open (see below)
524
521
  ```
525
522
 
526
- The integration fixture quits Lexicon and renames `main.db` while it runs. If the Lexicon data folder is synced to
527
- another machine (Syncthing, Dropbox, iCloud), pause the sync first. On Lexicon v1.12 the first run shows an approval
528
- popup for "lexicon-python integration tests"; Lexicon remembers the answer outside the library, so later runs do not ask
529
- again.
523
+ #### Integration tests
524
+
525
+ The integration tests add, edit and delete tracks, playlists and tags in the library Lexicon has open, and several of
526
+ them delete every track in it. They run only on an empty library made for them, so they need Lexicon v1.12 or newer with
527
+ Multi Library and the Local API turned on.
528
+
529
+ CI cannot run them, because they need the Lexicon app. Run them yourself when a change touches what the client sends to
530
+ Lexicon or reads back, and after a new Lexicon release.
531
+
532
+ One-time setup:
533
+
534
+ 1. In the Lexicon settings, under `Advanced`, turn on `Multi Library` and restart Lexicon when asked.
535
+ 2. Go to `File` > `Library` > `Manage libraries`, click `Add library`, enter a `Library name` (for example
536
+ `lexicon-python tests`) and click `Create library`. Leave it empty.
537
+
538
+ Each run:
539
+
540
+ 1. Switch Lexicon to the test library in `File` > `Library`. Lexicon restarts to open it.
541
+ 2. Run `make run-integration-tests`.
542
+ 3. Switch back to your own library (`Main Library`, unless you renamed it) the same way.
543
+
544
+ The first run shows Lexicon's popup asking to allow the app "lexicon-python integration tests"; allow it. The tests wait
545
+ up to a minute for the answer. Lexicon keeps approvals outside the libraries, so later runs do not ask again.
546
+
547
+ Before the first test, the harness checks that the open library has no tracks, archived ones included. If it finds any,
548
+ cannot reach Lexicon, or cannot complete the check, it stops the run with one message that says what it found, and
549
+ nothing is written. It never switches libraries, quits or launches Lexicon, or touches Lexicon's files.
550
+
551
+ The harness deletes the playlists, tags and tag categories the tests create, found by name (playlists and tags starting
552
+ with `IntTest`, tag categories starting with `Integration`), before the first test and again after the last one. After
553
+ the last one it also deletes every track. The end cleanup runs when tests fail or the run is interrupted with Ctrl-C; if
554
+ it fails, the run ends with an error that lists what was left. A run that is killed outright can leave tracks behind,
555
+ and the next run then refuses to start: delete them in Lexicon, in the test library.
530
556
 
531
557
  ### Linting and Formatting
532
558
 
@@ -573,10 +599,11 @@ The ruff version is pinned in `.pre-commit-config.yaml`; bump it when CI bumps t
573
599
 
574
600
  GitHub Actions runs on every push to `main` and on pull requests targeting those branches. The pipeline includes:
575
601
 
576
- - **Tests** across Python 3.9, 3.10, 3.11, and 3.12
602
+ - **Unit tests** across Python 3.10, 3.11, 3.12, 3.13, and 3.14
577
603
  - **Lint and format checks** via ruff on Python 3.12
578
604
 
579
- Before opening a PR, make sure `make test` passes locally.
605
+ CI does not run the integration tests. Before opening a PR, make sure `make test` passes locally, and run the
606
+ [integration tests](#integration-tests) if the change touches what the client sends to Lexicon or reads back.
580
607
 
581
608
  ### Pull Requests
582
609
 
@@ -384,14 +384,16 @@ queue = lex.player.queue() # the tracks after the loaded one
384
384
  lex.control("MusicPlayer_TogglePlay")
385
385
  lex.control("MusicPlayer_Load", id=123)
386
386
  lex.control("MusicPlayer_Seek", seconds=30)
387
+ lex.control("GhostCurator_LoadSuggestion", index=0, deckNumber=2)
387
388
  ```
388
389
 
389
390
  It returns `True` when Lexicon accepts the request. Lexicon does not wait for the action to finish and has no completion
390
391
  signal, and it accepts an action whose target is missing, such as one for the selected tracks with nothing selected.
391
- Names are checked against the `ControlAction` list; pass `validation="off"` for one that is not listed. The list covers
392
- Lexicon v1.11 and v1.12, so it holds both names of the actions v1.12 renamed: v1.12 calls the `Direct2Cdj_*` player
393
- actions `DeckConnect_*` (`DeckConnect_LoadDeck`, `DeckConnect_LoadDeck1` to `8`, `DeckConnect_LoadEmptyDeck`) and
394
- rejects the old names.
392
+ Names are checked against the `ControlAction` list; pass `validation="off"` for one that is not listed. The list follows
393
+ the newest API spec, so it can hold actions an older Lexicon does not know, such as `MusicPlayer_PreviewSelected` and
394
+ `DeckConnect_FindDeckTrack`, which the spec published with v1.12.5 added. It also keeps `Direct2Cdj_LoadDeck`,
395
+ `Direct2Cdj_LoadDeck1` to `8`, and `Direct2Cdj_LoadEmptyDeck`, the v1.11 names of the `DeckConnect_*` load actions;
396
+ v1.12 rejects them.
395
397
 
396
398
  ## Tools
397
399
 
@@ -458,7 +460,7 @@ v1.11 answers differently:
458
460
  | `playlists.update(position=)` | inserts, others shift | stores the number, positions can overlap |
459
461
  | `tags.categories.update(tags=, position=)` | yes | accepted but ignored |
460
462
  | Cue `activeLoop` | sent as `true`/`false` | not tested with booleans |
461
- | DeckConnect actions | `DeckConnect_*` | `Direct2Cdj_*` |
463
+ | DeckConnect actions | `DeckConnect_*` | `Direct2Cdj_*` for the ten load actions |
462
464
 
463
465
  ## Type Hints
464
466
 
@@ -499,19 +501,43 @@ The lockfile (`uv.lock`) is checked in to ensure reproducible installs.
499
501
  ### Running Tests
500
502
 
501
503
  ```bash
502
- # Unit tests
503
- make run-tests
504
-
505
- # Integration tests (requires Lexicon running)
506
- # Note: Integration tests enforce an empty library state to avoid destructive edits on existing libraries.
507
- # The fixture setup will back up the existing library, clear it for testing, and restore it afterward.
508
- make run-integration-tests
504
+ make run-tests # unit tests, no Lexicon needed
505
+ make run-integration-tests # integration tests, against Lexicon with an empty test library open (see below)
509
506
  ```
510
507
 
511
- The integration fixture quits Lexicon and renames `main.db` while it runs. If the Lexicon data folder is synced to
512
- another machine (Syncthing, Dropbox, iCloud), pause the sync first. On Lexicon v1.12 the first run shows an approval
513
- popup for "lexicon-python integration tests"; Lexicon remembers the answer outside the library, so later runs do not ask
514
- again.
508
+ #### Integration tests
509
+
510
+ The integration tests add, edit and delete tracks, playlists and tags in the library Lexicon has open, and several of
511
+ them delete every track in it. They run only on an empty library made for them, so they need Lexicon v1.12 or newer with
512
+ Multi Library and the Local API turned on.
513
+
514
+ CI cannot run them, because they need the Lexicon app. Run them yourself when a change touches what the client sends to
515
+ Lexicon or reads back, and after a new Lexicon release.
516
+
517
+ One-time setup:
518
+
519
+ 1. In the Lexicon settings, under `Advanced`, turn on `Multi Library` and restart Lexicon when asked.
520
+ 2. Go to `File` > `Library` > `Manage libraries`, click `Add library`, enter a `Library name` (for example
521
+ `lexicon-python tests`) and click `Create library`. Leave it empty.
522
+
523
+ Each run:
524
+
525
+ 1. Switch Lexicon to the test library in `File` > `Library`. Lexicon restarts to open it.
526
+ 2. Run `make run-integration-tests`.
527
+ 3. Switch back to your own library (`Main Library`, unless you renamed it) the same way.
528
+
529
+ The first run shows Lexicon's popup asking to allow the app "lexicon-python integration tests"; allow it. The tests wait
530
+ up to a minute for the answer. Lexicon keeps approvals outside the libraries, so later runs do not ask again.
531
+
532
+ Before the first test, the harness checks that the open library has no tracks, archived ones included. If it finds any,
533
+ cannot reach Lexicon, or cannot complete the check, it stops the run with one message that says what it found, and
534
+ nothing is written. It never switches libraries, quits or launches Lexicon, or touches Lexicon's files.
535
+
536
+ The harness deletes the playlists, tags and tag categories the tests create, found by name (playlists and tags starting
537
+ with `IntTest`, tag categories starting with `Integration`), before the first test and again after the last one. After
538
+ the last one it also deletes every track. The end cleanup runs when tests fail or the run is interrupted with Ctrl-C; if
539
+ it fails, the run ends with an error that lists what was left. A run that is killed outright can leave tracks behind,
540
+ and the next run then refuses to start: delete them in Lexicon, in the test library.
515
541
 
516
542
  ### Linting and Formatting
517
543
 
@@ -558,10 +584,11 @@ The ruff version is pinned in `.pre-commit-config.yaml`; bump it when CI bumps t
558
584
 
559
585
  GitHub Actions runs on every push to `main` and on pull requests targeting those branches. The pipeline includes:
560
586
 
561
- - **Tests** across Python 3.9, 3.10, 3.11, and 3.12
587
+ - **Unit tests** across Python 3.10, 3.11, 3.12, 3.13, and 3.14
562
588
  - **Lint and format checks** via ruff on Python 3.12
563
589
 
564
- Before opening a PR, make sure `make test` passes locally.
590
+ CI does not run the integration tests. Before opening a PR, make sure `make test` passes locally, and run the
591
+ [integration tests](#integration-tests) if the change touches what the client sends to Lexicon or reads back.
565
592
 
566
593
  ### Pull Requests
567
594
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "lexicon-python"
7
- version = "0.5.0"
7
+ version = "0.5.2"
8
8
  description = "Python client for the Lexicon DJ API"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -40,7 +40,7 @@ package-dir = {"" = "src"}
40
40
  [tool.pytest.ini_options]
41
41
  testpaths = ["tests"]
42
42
  markers = [
43
- "integration: integration tests requiring a running Lexicon instance",
43
+ "integration: integration tests; need Lexicon v1.12+ running with an empty test library open (see README)",
44
44
  ]
45
45
  addopts = "-m 'not integration'"
46
46
 
@@ -388,8 +388,11 @@ class Lexicon:
388
388
  target is missing, such as a hotkey for the selected tracks with nothing
389
389
  selected, or ``MusicPlayer_Load`` without ``id``.
390
390
 
391
- ``ControlAction`` follows the newest spec, so it can name actions that the
392
- running Lexicon rejects. See ``docs/api-issues.md``.
391
+ ``ControlAction`` follows the newest spec, plus the Lexicon 1.11
392
+ ``Direct2Cdj_*`` names of the ten ``DeckConnect_*`` load actions, so it
393
+ can name actions that the running Lexicon rejects: 1.12 rejects the
394
+ ``Direct2Cdj_*`` names, and an older release does not know actions the
395
+ spec added later. See ``docs/api-issues.md``.
393
396
  """
394
397
  if validation != "off" and action not in CONTROL_ACTIONS:
395
398
  if validation == "strict":
@@ -5,9 +5,9 @@ from __future__ import annotations
5
5
  from typing import Literal, get_args
6
6
 
7
7
  # Generated from the Control Actions enum in docs/lexicon-api-docs.yaml by
8
- # scripts/update_control_actions.py, plus the DeckConnect_* names Lexicon 1.12 uses for the
9
- # spec's Direct2Cdj_* actions. Do not edit by hand. The list covers several Lexicon versions,
10
- # so a name here can be one the running Lexicon rejects; see docs/api-issues.md.
8
+ # scripts/update_control_actions.py, plus the Direct2Cdj_* names Lexicon 1.11 uses for ten of
9
+ # the spec's DeckConnect_* actions. Do not edit by hand. The list covers several Lexicon
10
+ # versions, so a name here can be one the running Lexicon rejects; see docs/api-issues.md.
11
11
  ControlAction = Literal[
12
12
  "Appearance_ToggleTheme",
13
13
  "Appearance_ToggleCuey",
@@ -157,6 +157,8 @@ ControlAction = Literal[
157
157
  "MusicPlayer_Previous",
158
158
  "MusicPlayer_TogglePlay",
159
159
  "MusicPlayer_Eject",
160
+ "MusicPlayer_PreviewSelected",
161
+ "MusicPlayer_StopPreview",
160
162
  "MusicPlayer_ToggleQuantize",
161
163
  "MusicPlayer_ToggleActiveLoops",
162
164
  "MusicPlayer_Cue",
@@ -315,6 +317,23 @@ ControlAction = Literal[
315
317
  "MusicPlayer_AddAndApplyCueTemplate14",
316
318
  "MusicPlayer_AddAndApplyCueTemplate15",
317
319
  "MusicPlayer_AddAndApplyCueTemplate16",
320
+ "MusicPlayer_ResetCueWithCueTemplate",
321
+ "MusicPlayer_ResetCueWithCueTemplate1",
322
+ "MusicPlayer_ResetCueWithCueTemplate2",
323
+ "MusicPlayer_ResetCueWithCueTemplate3",
324
+ "MusicPlayer_ResetCueWithCueTemplate4",
325
+ "MusicPlayer_ResetCueWithCueTemplate5",
326
+ "MusicPlayer_ResetCueWithCueTemplate6",
327
+ "MusicPlayer_ResetCueWithCueTemplate7",
328
+ "MusicPlayer_ResetCueWithCueTemplate8",
329
+ "MusicPlayer_ResetCueWithCueTemplate9",
330
+ "MusicPlayer_ResetCueWithCueTemplate10",
331
+ "MusicPlayer_ResetCueWithCueTemplate11",
332
+ "MusicPlayer_ResetCueWithCueTemplate12",
333
+ "MusicPlayer_ResetCueWithCueTemplate13",
334
+ "MusicPlayer_ResetCueWithCueTemplate14",
335
+ "MusicPlayer_ResetCueWithCueTemplate15",
336
+ "MusicPlayer_ResetCueWithCueTemplate16",
318
337
  "MusicPlayer_LoopDouble",
319
338
  "MusicPlayer_LoopHalve",
320
339
  "MusicPlayer_LoopCreate",
@@ -350,6 +369,34 @@ ControlAction = Literal[
350
369
  "TrackBrowser_TagLookup",
351
370
  "TrackBrowser_TagWriter",
352
371
  "TrackBrowser_MixableTracks",
372
+ "GhostCurator_ToggleFollow",
373
+ "GhostCurator_ToggleOverlay",
374
+ "GhostCurator_UseSuggestion1",
375
+ "GhostCurator_UseSuggestion2",
376
+ "GhostCurator_UseSuggestion3",
377
+ "GhostCurator_RollDice",
378
+ "GhostCurator_SelectDeck",
379
+ "GhostCurator_SelectDeck1",
380
+ "GhostCurator_SelectDeck2",
381
+ "GhostCurator_SelectDeck3",
382
+ "GhostCurator_SelectDeck4",
383
+ "GhostCurator_NextDeck",
384
+ "GhostCurator_PreviousDeck",
385
+ "GhostCurator_SetEnergyDirection",
386
+ "GhostCurator_SetEnergyDirection_Up",
387
+ "GhostCurator_SetEnergyDirection_Flat",
388
+ "GhostCurator_SetEnergyDirection_Down",
389
+ "GhostCurator_SetEnergyDirection_Any",
390
+ "GhostCurator_SetMinRating",
391
+ "GhostCurator_SetMinRating0",
392
+ "GhostCurator_SetMinRating1",
393
+ "GhostCurator_SetMinRating2",
394
+ "GhostCurator_SetMinRating3",
395
+ "GhostCurator_SetMinRating4",
396
+ "GhostCurator_SetMinRating5",
397
+ "GhostCurator_SwitchMode",
398
+ "GhostCurator_ToggleQuickTag",
399
+ "GhostCurator_LoadSuggestion",
353
400
  "TrackBrowser_Relocate",
354
401
  "TrackBrowser_OpenFolder",
355
402
  "TrackBrowser_SendToNewPlaylist",
@@ -444,6 +491,15 @@ ControlAction = Literal[
444
491
  "DeckConnect_LoadDeck7",
445
492
  "Direct2Cdj_LoadDeck8",
446
493
  "DeckConnect_LoadDeck8",
494
+ "DeckConnect_FindDeckTrack",
495
+ "DeckConnect_FindDeckTrack1",
496
+ "DeckConnect_FindDeckTrack2",
497
+ "DeckConnect_FindDeckTrack3",
498
+ "DeckConnect_FindDeckTrack4",
499
+ "DeckConnect_FindDeckTrack5",
500
+ "DeckConnect_FindDeckTrack6",
501
+ "DeckConnect_FindDeckTrack7",
502
+ "DeckConnect_FindDeckTrack8",
447
503
  "AudioAnalyzer_Analyze",
448
504
  "PluginRunActionByName",
449
505
  ]
@@ -7,6 +7,7 @@ from typing import Optional, Sequence, Literal, Mapping, cast
7
7
 
8
8
  from .base import Resource
9
9
  from .tracks_types import (
10
+ TRACK_FIELDS,
10
11
  TRACK_SOURCES,
11
12
  FilterField,
12
13
  SortInput,
@@ -431,8 +432,11 @@ class Tracks(Resource):
431
432
  self._logger.warning("Skipping search: no valid filters remain.")
432
433
  return None
433
434
 
435
+ # Return the filtered fields too, except filter-only ones such as fileType,
436
+ # which Lexicon rejects in `fields`.
434
437
  filter_fields = cast(
435
- list[TrackField], [field for field in filter_payload.keys()]
438
+ list[TrackField],
439
+ [field for field in filter_payload if field in TRACK_FIELDS],
436
440
  )
437
441
  payload["filter"] = filter_payload
438
442
  id_filter = filter_payload.get("id")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lexicon-python
3
- Version: 0.5.0
3
+ Version: 0.5.2
4
4
  Summary: Python client for the Lexicon DJ API
5
5
  Author-email: Garrison Burger <burgerga123@gmail.com>
6
6
  License-Expression: MIT
@@ -399,14 +399,16 @@ queue = lex.player.queue() # the tracks after the loaded one
399
399
  lex.control("MusicPlayer_TogglePlay")
400
400
  lex.control("MusicPlayer_Load", id=123)
401
401
  lex.control("MusicPlayer_Seek", seconds=30)
402
+ lex.control("GhostCurator_LoadSuggestion", index=0, deckNumber=2)
402
403
  ```
403
404
 
404
405
  It returns `True` when Lexicon accepts the request. Lexicon does not wait for the action to finish and has no completion
405
406
  signal, and it accepts an action whose target is missing, such as one for the selected tracks with nothing selected.
406
- Names are checked against the `ControlAction` list; pass `validation="off"` for one that is not listed. The list covers
407
- Lexicon v1.11 and v1.12, so it holds both names of the actions v1.12 renamed: v1.12 calls the `Direct2Cdj_*` player
408
- actions `DeckConnect_*` (`DeckConnect_LoadDeck`, `DeckConnect_LoadDeck1` to `8`, `DeckConnect_LoadEmptyDeck`) and
409
- rejects the old names.
407
+ Names are checked against the `ControlAction` list; pass `validation="off"` for one that is not listed. The list follows
408
+ the newest API spec, so it can hold actions an older Lexicon does not know, such as `MusicPlayer_PreviewSelected` and
409
+ `DeckConnect_FindDeckTrack`, which the spec published with v1.12.5 added. It also keeps `Direct2Cdj_LoadDeck`,
410
+ `Direct2Cdj_LoadDeck1` to `8`, and `Direct2Cdj_LoadEmptyDeck`, the v1.11 names of the `DeckConnect_*` load actions;
411
+ v1.12 rejects them.
410
412
 
411
413
  ## Tools
412
414
 
@@ -473,7 +475,7 @@ v1.11 answers differently:
473
475
  | `playlists.update(position=)` | inserts, others shift | stores the number, positions can overlap |
474
476
  | `tags.categories.update(tags=, position=)` | yes | accepted but ignored |
475
477
  | Cue `activeLoop` | sent as `true`/`false` | not tested with booleans |
476
- | DeckConnect actions | `DeckConnect_*` | `Direct2Cdj_*` |
478
+ | DeckConnect actions | `DeckConnect_*` | `Direct2Cdj_*` for the ten load actions |
477
479
 
478
480
  ## Type Hints
479
481
 
@@ -514,19 +516,43 @@ The lockfile (`uv.lock`) is checked in to ensure reproducible installs.
514
516
  ### Running Tests
515
517
 
516
518
  ```bash
517
- # Unit tests
518
- make run-tests
519
-
520
- # Integration tests (requires Lexicon running)
521
- # Note: Integration tests enforce an empty library state to avoid destructive edits on existing libraries.
522
- # The fixture setup will back up the existing library, clear it for testing, and restore it afterward.
523
- make run-integration-tests
519
+ make run-tests # unit tests, no Lexicon needed
520
+ make run-integration-tests # integration tests, against Lexicon with an empty test library open (see below)
524
521
  ```
525
522
 
526
- The integration fixture quits Lexicon and renames `main.db` while it runs. If the Lexicon data folder is synced to
527
- another machine (Syncthing, Dropbox, iCloud), pause the sync first. On Lexicon v1.12 the first run shows an approval
528
- popup for "lexicon-python integration tests"; Lexicon remembers the answer outside the library, so later runs do not ask
529
- again.
523
+ #### Integration tests
524
+
525
+ The integration tests add, edit and delete tracks, playlists and tags in the library Lexicon has open, and several of
526
+ them delete every track in it. They run only on an empty library made for them, so they need Lexicon v1.12 or newer with
527
+ Multi Library and the Local API turned on.
528
+
529
+ CI cannot run them, because they need the Lexicon app. Run them yourself when a change touches what the client sends to
530
+ Lexicon or reads back, and after a new Lexicon release.
531
+
532
+ One-time setup:
533
+
534
+ 1. In the Lexicon settings, under `Advanced`, turn on `Multi Library` and restart Lexicon when asked.
535
+ 2. Go to `File` > `Library` > `Manage libraries`, click `Add library`, enter a `Library name` (for example
536
+ `lexicon-python tests`) and click `Create library`. Leave it empty.
537
+
538
+ Each run:
539
+
540
+ 1. Switch Lexicon to the test library in `File` > `Library`. Lexicon restarts to open it.
541
+ 2. Run `make run-integration-tests`.
542
+ 3. Switch back to your own library (`Main Library`, unless you renamed it) the same way.
543
+
544
+ The first run shows Lexicon's popup asking to allow the app "lexicon-python integration tests"; allow it. The tests wait
545
+ up to a minute for the answer. Lexicon keeps approvals outside the libraries, so later runs do not ask again.
546
+
547
+ Before the first test, the harness checks that the open library has no tracks, archived ones included. If it finds any,
548
+ cannot reach Lexicon, or cannot complete the check, it stops the run with one message that says what it found, and
549
+ nothing is written. It never switches libraries, quits or launches Lexicon, or touches Lexicon's files.
550
+
551
+ The harness deletes the playlists, tags and tag categories the tests create, found by name (playlists and tags starting
552
+ with `IntTest`, tag categories starting with `Integration`), before the first test and again after the last one. After
553
+ the last one it also deletes every track. The end cleanup runs when tests fail or the run is interrupted with Ctrl-C; if
554
+ it fails, the run ends with an error that lists what was left. A run that is killed outright can leave tracks behind,
555
+ and the next run then refuses to start: delete them in Lexicon, in the test library.
530
556
 
531
557
  ### Linting and Formatting
532
558
 
@@ -573,10 +599,11 @@ The ruff version is pinned in `.pre-commit-config.yaml`; bump it when CI bumps t
573
599
 
574
600
  GitHub Actions runs on every push to `main` and on pull requests targeting those branches. The pipeline includes:
575
601
 
576
- - **Tests** across Python 3.9, 3.10, 3.11, and 3.12
602
+ - **Unit tests** across Python 3.10, 3.11, 3.12, 3.13, and 3.14
577
603
  - **Lint and format checks** via ruff on Python 3.12
578
604
 
579
- Before opening a PR, make sure `make test` passes locally.
605
+ CI does not run the integration tests. Before opening a PR, make sure `make test` passes locally, and run the
606
+ [integration tests](#integration-tests) if the change touches what the client sends to Lexicon or reads back.
580
607
 
581
608
  ### Pull Requests
582
609
 
@@ -34,7 +34,7 @@ tests/test_base.py
34
34
  tests/test_client.py
35
35
  tests/test_colors.py
36
36
  tests/test_common_types.py
37
- tests/test_integration_lifecycle.py
37
+ tests/test_integration_library_guard.py
38
38
  tests/test_player.py
39
39
  tests/test_playlist_tracks.py
40
40
  tests/test_playlists.py
@@ -100,6 +100,19 @@ class ControlTests(unittest.TestCase):
100
100
  {"action": "MusicPlayer_Load", "parameters": {"id": 123}},
101
101
  )
102
102
 
103
+ def test_sends_several_parameters(self):
104
+ client, session = make_client(FakeResponse(json_payload={}))
105
+
106
+ client.control("GhostCurator_LoadSuggestion", index=0, deckNumber=2)
107
+
108
+ self.assertEqual(
109
+ session.calls[0][3],
110
+ {
111
+ "action": "GhostCurator_LoadSuggestion",
112
+ "parameters": {"index": 0, "deckNumber": 2},
113
+ },
114
+ )
115
+
103
116
  def test_keeps_a_null_parameter(self):
104
117
  # Application_SetColor uses a null color to remove the color.
105
118
  client, session = make_client(FakeResponse(json_payload={}))
@@ -448,12 +461,33 @@ class AuthTests(unittest.TestCase):
448
461
  client.pair()
449
462
 
450
463
  def test_deckconnect_names_are_control_actions(self):
451
- # Lexicon 1.12 renamed the Direct2Cdj_* actions; both stay valid names.
452
- self.assertIn("DeckConnect_LoadDeck", CONTROL_ACTIONS)
453
- self.assertIn("DeckConnect_LoadDeck8", CONTROL_ACTIONS)
454
- self.assertIn("Direct2Cdj_LoadDeck", CONTROL_ACTIONS)
464
+ # Lexicon 1.12 renamed the Direct2Cdj_* actions to DeckConnect_*. The spec lists
465
+ # only the new names; the ten 1.11 names stay valid, each before its new name.
466
+ suffixes = ["LoadDeck", "LoadEmptyDeck", *(f"LoadDeck{n}" for n in range(1, 9))]
467
+ for suffix in suffixes:
468
+ with self.subTest(suffix=suffix):
469
+ legacy = CONTROL_ACTIONS.index(f"Direct2Cdj_{suffix}")
470
+ self.assertEqual(CONTROL_ACTIONS[legacy + 1], f"DeckConnect_{suffix}")
471
+ direct2cdj = [a for a in CONTROL_ACTIONS if a.startswith("Direct2Cdj_")]
472
+ self.assertEqual(len(direct2cdj), 10)
473
+ # DeckConnect_FindDeckTrack is newer than the rename and has no 1.11 name.
474
+ self.assertIn("DeckConnect_FindDeckTrack", CONTROL_ACTIONS)
475
+ self.assertIn("DeckConnect_FindDeckTrack8", CONTROL_ACTIONS)
455
476
  self.assertEqual(len(CONTROL_ACTIONS), len(set(CONTROL_ACTIONS)))
456
477
 
478
+ def test_actions_from_the_1_12_5_spec_are_control_actions(self):
479
+ for action in [
480
+ "MusicPlayer_PreviewSelected",
481
+ "MusicPlayer_StopPreview",
482
+ "MusicPlayer_ResetCueWithCueTemplate",
483
+ "MusicPlayer_ResetCueWithCueTemplate16",
484
+ "GhostCurator_ToggleFollow",
485
+ "GhostCurator_SetEnergyDirection_Any",
486
+ "GhostCurator_LoadSuggestion",
487
+ ]:
488
+ with self.subTest(action=action):
489
+ self.assertIn(action, CONTROL_ACTIONS)
490
+
457
491
 
458
492
  if __name__ == "__main__":
459
493
  unittest.main()