lexicon-python 0.5.0__py3-none-any.whl → 0.5.2__py3-none-any.whl

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.
lexicon/client.py CHANGED
@@ -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
 
@@ -1,11 +1,11 @@
1
1
  lexicon/__init__.py,sha256=Jels1Jj_rgyhe_LdiuperEIXVOl7gcDrL30xbFwJ5ng,1232
2
- lexicon/client.py,sha256=1cuJwCh0BRaEOVUpoNmtoJInU7Ivnhk4QOUNHmJ6Bn8,19425
2
+ lexicon/client.py,sha256=kddTx-YPPc5FqUBJMB2qSzAHdo-rYgQtr3tAtt71zvM,19643
3
3
  lexicon/colors.py,sha256=xbw6Z926xkwXOeHF9OSO3lW2zau0FBj3M0LQcaxGL6o,977
4
4
  lexicon/utils.py,sha256=cLMW_Dbi_fI_HPWICXOtjptiokTVI9JiB_FRbRaEfUU,428
5
5
  lexicon/resources/__init__.py,sha256=R8JvEZbzFLeDG7H_NPNAv-6OltIgT0511CO-leTx9Cw,343
6
6
  lexicon/resources/_common_types.py,sha256=2hVb6s7GWLrYuMLH8f7gfjM-ydRN6jK-AE4fF5XplgI,6653
7
7
  lexicon/resources/base.py,sha256=cjsGZFUrWUvy0FZbHjAqg-XZFsgOSApccHWMw0qPRAE,1990
8
- lexicon/resources/control_types.py,sha256=KBe1pxa-QRQsi1u6goe1OH0IucEsiujrk0pmdwnWa7g,16105
8
+ lexicon/resources/control_types.py,sha256=eoeIbwlwJUtZbbogPiMA3bPCqi_9LW7LLcnYo5BMynM,18209
9
9
  lexicon/resources/player.py,sha256=UExYP71w5WJIDFrhZ-oJWaYZ0AUVhT50HbkpbIEJvXc,3306
10
10
  lexicon/resources/player_types.py,sha256=mQfZifiBFbhsluoeM_LzuYpx3QUVDRBTyTMyWADrrfQ,1568
11
11
  lexicon/resources/playlist_tracks.py,sha256=3LKuOGcx_nd_rPJAHF0PGpYdQ7GwphEFPg1RaJfCN2U,11079
@@ -16,14 +16,14 @@ lexicon/resources/tag_categories.py,sha256=lpRfBEMkMvBtlENpgVP87dutDKYsYZK2w85_i
16
16
  lexicon/resources/tag_categories_types.py,sha256=_MVMMfbZ8um4lUNbLIMsYR_bq6S7tLxQIjK1YMaJvb4,625
17
17
  lexicon/resources/tags.py,sha256=uVDyphU2LNbGmOKPB3S7tHnONW7M_9ZEhm86uXCHy7w,8829
18
18
  lexicon/resources/tags_types.py,sha256=i5AMNukPzONzxXLeFUVnPJmLHV13p9pYC7siyWu4wmc,810
19
- lexicon/resources/tracks.py,sha256=Ex9eVVZUIG0ff6hs2nR-TY7vKIcBjTM05ETlKDK5Kbw,47572
19
+ lexicon/resources/tracks.py,sha256=OhoVbacuOFaYKSg-2p-e4EFDyvbbbusgWXGOB81gkiw,47762
20
20
  lexicon/resources/tracks_types.py,sha256=ou47AAgsdm7DHQnIZJtZ6ZkbyV0cK0J3LwGyW0oUt_0,32954
21
21
  lexicon/tools/__init__.py,sha256=jniJDnb9RFx36H6ANreGwV9bibSZB3ADQimEsaXJ2Tw,44
22
22
  lexicon/tools/playlists.py,sha256=WfrlTnQ8h5emhtVSXvnPEQBeCuKLG4MdSjZe_CXFNHY,5374
23
23
  lexicon/tools/tempo.py,sha256=D4SnNHu-NqbvP6QLEQzAifhkRy2phzos6TwGMfQLeQ0,2684
24
24
  lexicon/tools/tracks.py,sha256=ySFf9wV17NIcmoW_N3fzFgaHzSjMl69ObeDdkrfswMw,4141
25
- lexicon_python-0.5.0.dist-info/licenses/LICENSE,sha256=SnZvUu04t9ENhnrmuLMoz2E6pAYcEIX8UGBl0P4D43c,1072
26
- lexicon_python-0.5.0.dist-info/METADATA,sha256=1nCP6wJJytsRQswlovWSacurBLOLlPvuhMNF8oc6RHk,24446
27
- lexicon_python-0.5.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
28
- lexicon_python-0.5.0.dist-info/top_level.txt,sha256=Ry_712VYZowp819R6r0kTIdSPW_kSEKdC_k6MVSYvYo,8
29
- lexicon_python-0.5.0.dist-info/RECORD,,
25
+ lexicon_python-0.5.2.dist-info/licenses/LICENSE,sha256=SnZvUu04t9ENhnrmuLMoz2E6pAYcEIX8UGBl0P4D43c,1072
26
+ lexicon_python-0.5.2.dist-info/METADATA,sha256=OEJK6Ahxh63aPChhBDA4oKQngHR48Dra94EHoDSWTTA,26439
27
+ lexicon_python-0.5.2.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
28
+ lexicon_python-0.5.2.dist-info/top_level.txt,sha256=Ry_712VYZowp819R6r0kTIdSPW_kSEKdC_k6MVSYvYo,8
29
+ lexicon_python-0.5.2.dist-info/RECORD,,