libmdr-cli 0.1.0__tar.gz → 0.1.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.
@@ -0,0 +1,49 @@
1
+ Metadata-Version: 2.4
2
+ Name: libmdr-cli
3
+ Version: 0.1.2
4
+ Summary: libmdr CLI Frontend
5
+ License-Expression: MIT
6
+ Project-URL: Source, https://github.com/mos9527/libmdr-py
7
+ Requires-Python: >=3.10
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: libmdr==0.1.2
11
+ Requires-Dist: libmdr-bt==0.1.2
12
+ Dynamic: license-file
13
+
14
+ # libmdr-cli
15
+
16
+ `mdr`, a command line tool for Sony headphones, built on [`libmdr`](https://pypi.org/project/libmdr/).
17
+
18
+ ## Installation
19
+
20
+ ```
21
+ pip install libmdr-cli # or: pip install libmdr[cli]
22
+ ```
23
+
24
+ See [`libmdr-bt`](https://pypi.org/project/libmdr-bt/) for the supported platforms
25
+ and the system libraries needed on Linux.
26
+
27
+ ## Usage
28
+
29
+ ```
30
+ mdr [option=value ...] <context> [show]
31
+ mdr [option=value ...] <context> [set] key=value [key=value ...]
32
+ mdr [option=value ...] <context> <action>
33
+ mdr <context> help
34
+ ```
35
+
36
+ For example:
37
+
38
+ ```
39
+ mdr anc set mode=amb level=15 voice=on
40
+ mdr device=XM6 eq preset=bright clearbass=3
41
+ mdr playback volume+=2
42
+ mdr json=on battery
43
+ ```
44
+
45
+ Run `mdr help` for everything else, including fuzzy matching of names.
46
+
47
+ ## Links
48
+
49
+ - [Source and documentation](https://github.com/mos9527/libmdr-py)
@@ -0,0 +1,36 @@
1
+ # libmdr-cli
2
+
3
+ `mdr`, a command line tool for Sony headphones, built on [`libmdr`](https://pypi.org/project/libmdr/).
4
+
5
+ ## Installation
6
+
7
+ ```
8
+ pip install libmdr-cli # or: pip install libmdr[cli]
9
+ ```
10
+
11
+ See [`libmdr-bt`](https://pypi.org/project/libmdr-bt/) for the supported platforms
12
+ and the system libraries needed on Linux.
13
+
14
+ ## Usage
15
+
16
+ ```
17
+ mdr [option=value ...] <context> [show]
18
+ mdr [option=value ...] <context> [set] key=value [key=value ...]
19
+ mdr [option=value ...] <context> <action>
20
+ mdr <context> help
21
+ ```
22
+
23
+ For example:
24
+
25
+ ```
26
+ mdr anc set mode=amb level=15 voice=on
27
+ mdr device=XM6 eq preset=bright clearbass=3
28
+ mdr playback volume+=2
29
+ mdr json=on battery
30
+ ```
31
+
32
+ Run `mdr help` for everything else, including fuzzy matching of names.
33
+
34
+ ## Links
35
+
36
+ - [Source and documentation](https://github.com/mos9527/libmdr-py)
@@ -4,13 +4,13 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "libmdr-cli"
7
- version = "0.1.0"
7
+ version = "0.1.2"
8
8
  description = "libmdr CLI Frontend"
9
- readme = { text = "libmdr CLI Frontend. Provides the `mdr` command, see `mdr help`.", content-type = "text/plain" }
9
+ readme = "README.md"
10
10
  requires-python = ">=3.10"
11
11
  license = "MIT"
12
12
  license-files = ["LICENSE"]
13
- dependencies = ["libmdr", "libmdr-bt"]
13
+ dependencies = ["libmdr==0.1.2", "libmdr-bt==0.1.2"]
14
14
 
15
15
  [project.urls]
16
16
  Source = "https://github.com/mos9527/libmdr-py"
@@ -0,0 +1,49 @@
1
+ Metadata-Version: 2.4
2
+ Name: libmdr-cli
3
+ Version: 0.1.2
4
+ Summary: libmdr CLI Frontend
5
+ License-Expression: MIT
6
+ Project-URL: Source, https://github.com/mos9527/libmdr-py
7
+ Requires-Python: >=3.10
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: libmdr==0.1.2
11
+ Requires-Dist: libmdr-bt==0.1.2
12
+ Dynamic: license-file
13
+
14
+ # libmdr-cli
15
+
16
+ `mdr`, a command line tool for Sony headphones, built on [`libmdr`](https://pypi.org/project/libmdr/).
17
+
18
+ ## Installation
19
+
20
+ ```
21
+ pip install libmdr-cli # or: pip install libmdr[cli]
22
+ ```
23
+
24
+ See [`libmdr-bt`](https://pypi.org/project/libmdr-bt/) for the supported platforms
25
+ and the system libraries needed on Linux.
26
+
27
+ ## Usage
28
+
29
+ ```
30
+ mdr [option=value ...] <context> [show]
31
+ mdr [option=value ...] <context> [set] key=value [key=value ...]
32
+ mdr [option=value ...] <context> <action>
33
+ mdr <context> help
34
+ ```
35
+
36
+ For example:
37
+
38
+ ```
39
+ mdr anc set mode=amb level=15 voice=on
40
+ mdr device=XM6 eq preset=bright clearbass=3
41
+ mdr playback volume+=2
42
+ mdr json=on battery
43
+ ```
44
+
45
+ Run `mdr help` for everything else, including fuzzy matching of names.
46
+
47
+ ## Links
48
+
49
+ - [Source and documentation](https://github.com/mos9527/libmdr-py)
@@ -1,4 +1,5 @@
1
1
  LICENSE
2
+ README.md
2
3
  pyproject.toml
3
4
  src/libmdr_cli.egg-info/PKG-INFO
4
5
  src/libmdr_cli.egg-info/SOURCES.txt
@@ -0,0 +1,2 @@
1
+ libmdr==0.1.2
2
+ libmdr-bt==0.1.2
@@ -116,7 +116,7 @@ class Battery:
116
116
 
117
117
  @dataclass
118
118
  class NoiseControl:
119
- mode: Literal["off", "nc", "amb"]
119
+ mode: Literal["off", "nc", "amb", "wind"]
120
120
  level: Annotated[int, "ambient level 0..20"]
121
121
  voice: Annotated[bool, "focus on voice"]
122
122
  adaptive: Annotated[bool, "adaptive ambient sound"]
@@ -143,6 +143,7 @@ class Playback:
143
143
  title: Annotated[str, RO] = ""
144
144
  artist: Annotated[str, RO] = ""
145
145
  album: Annotated[str, RO] = ""
146
+ genre: Annotated[str, RO] = ""
146
147
 
147
148
 
148
149
  @dataclass
@@ -402,23 +403,25 @@ def read_battery(hp: Headphones, proto: int, view: int) -> Battery:
402
403
  out = Battery()
403
404
  for b in hp.get_batteries():
404
405
  part = C.BATTERY_PART_NAMES.get(b.part)
405
- if b.present and part:
406
+ if part:
406
407
  setattr(out, part, int(b.level_percent))
407
408
  if b.charging == C.CHARGING_YES:
408
409
  out.charging.append(part)
409
410
  return out
410
411
 
411
412
 
413
+ NOISE_MODES = {
414
+ "off": C.NOISE_MODE_OFF,
415
+ "nc": C.NOISE_MODE_CANCELLING,
416
+ "amb": C.NOISE_MODE_AMBIENT,
417
+ "wind": C.NOISE_MODE_WIND_NOISE_REDUCTION,
418
+ }
419
+
420
+
412
421
  def read_anc(hp: Headphones, proto: int, view: int) -> NoiseControl:
413
422
  nc = hp.get_noise_control(view)
414
- level = int(nc.ambient_level)
415
- if nc.mode == C.NOISE_MODE_OFF:
416
- mode = "off"
417
- elif proto == C.PROTOCOL_V1:
418
- mode = "nc" if level == C.NOISE_AMBIENT_LEVEL_V1_NOISE_CANCELLING else "amb"
419
- else:
420
- mode = "nc" if nc.mode == C.NOISE_MODE_CANCELLING else "amb"
421
- return NoiseControl(mode, min(level, 20), bool(nc.focus_on_voice), bool(nc.adaptive_ambient))
423
+ mode = next((name for name, ident in NOISE_MODES.items() if ident == nc.mode), "unknown")
424
+ return NoiseControl(mode, int(nc.ambient_level), bool(nc.focus_on_voice), bool(nc.adaptive_ambient))
422
425
 
423
426
 
424
427
  def write_anc(hp: Headphones, proto: int, old: NoiseControl, new: NoiseControl) -> None:
@@ -426,17 +429,13 @@ def write_anc(hp: Headphones, proto: int, old: NoiseControl, new: NoiseControl)
426
429
  require(hp, C.FEATURE_NOISE_CANCELLING)
427
430
  if new.mode == "amb":
428
431
  require(hp, C.FEATURE_AMBIENT_SOUND)
432
+ if new.mode == "wind":
433
+ require(hp, C.FEATURE_WIND_NOISE_REDUCTION)
429
434
  if new.adaptive != old.adaptive:
430
435
  require(hp, C.FEATURE_ADAPTIVE_AMBIENT_SOUND)
431
- v1 = proto == C.PROTOCOL_V1
432
436
  nc = hp.get_noise_control(DESIRED)
433
- if new.mode == "off":
434
- nc.mode = C.NOISE_MODE_OFF
435
- elif v1:
436
- nc.mode = C.NOISE_MODE_V1_ON
437
- else:
438
- nc.mode = C.NOISE_MODE_CANCELLING if new.mode == "nc" else C.NOISE_MODE_AMBIENT
439
- nc.ambient_level = C.NOISE_AMBIENT_LEVEL_V1_NOISE_CANCELLING if v1 and new.mode == "nc" else new.level
437
+ nc.mode = NOISE_MODES[new.mode]
438
+ nc.ambient_level = new.level
440
439
  nc.focus_on_voice = flag(new.voice)
441
440
  nc.adaptive_ambient = flag(new.adaptive)
442
441
  nc.changing_asm_level = C.FALSE
@@ -502,6 +501,7 @@ def read_playback(hp: Headphones, proto: int, view: int) -> Playback:
502
501
  title=hp.get_text(C.TEXT_TRACK_TITLE),
503
502
  artist=hp.get_text(C.TEXT_TRACK_ARTIST),
504
503
  album=hp.get_text(C.TEXT_TRACK_ALBUM),
504
+ genre=hp.get_text(C.TEXT_TRACK_GENRE),
505
505
  )
506
506
 
507
507
 
libmdr_cli-0.1.0/PKG-INFO DELETED
@@ -1,14 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: libmdr-cli
3
- Version: 0.1.0
4
- Summary: libmdr CLI Frontend
5
- License-Expression: MIT
6
- Project-URL: Source, https://github.com/mos9527/libmdr-py
7
- Requires-Python: >=3.10
8
- Description-Content-Type: text/plain
9
- License-File: LICENSE
10
- Requires-Dist: libmdr
11
- Requires-Dist: libmdr-bt
12
- Dynamic: license-file
13
-
14
- libmdr CLI Frontend. Provides the `mdr` command, see `mdr help`.
@@ -1,14 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: libmdr-cli
3
- Version: 0.1.0
4
- Summary: libmdr CLI Frontend
5
- License-Expression: MIT
6
- Project-URL: Source, https://github.com/mos9527/libmdr-py
7
- Requires-Python: >=3.10
8
- Description-Content-Type: text/plain
9
- License-File: LICENSE
10
- Requires-Dist: libmdr
11
- Requires-Dist: libmdr-bt
12
- Dynamic: license-file
13
-
14
- libmdr CLI Frontend. Provides the `mdr` command, see `mdr help`.
@@ -1,2 +0,0 @@
1
- libmdr
2
- libmdr-bt
File without changes
File without changes