pyrekordbox 0.2.1__py3-none-any.whl → 0.2.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.
- docs/source/formats/anlz.md +178 -7
- docs/source/formats/db6.md +1 -1
- docs/source/index.md +2 -6
- docs/source/quickstart.md +68 -45
- docs/source/tutorial/index.md +1 -1
- pyrekordbox/__init__.py +1 -1
- pyrekordbox/_version.py +2 -2
- pyrekordbox/anlz/file.py +39 -0
- pyrekordbox/anlz/structs.py +3 -5
- pyrekordbox/config.py +71 -27
- pyrekordbox/db6/database.py +260 -33
- pyrekordbox/db6/registry.py +22 -0
- pyrekordbox/db6/tables.py +3 -4
- {pyrekordbox-0.2.1.dist-info → pyrekordbox-0.2.2.dist-info}/METADATA +12 -11
- pyrekordbox-0.2.2.dist-info/RECORD +80 -0
- {pyrekordbox-0.2.1.dist-info → pyrekordbox-0.2.2.dist-info}/top_level.txt +0 -2
- tests/test_config.py +175 -0
- tests/test_db6.py +78 -0
- build/lib/build/lib/docs/source/conf.py +0 -178
- build/lib/build/lib/pyrekordbox/__init__.py +0 -22
- build/lib/build/lib/pyrekordbox/__main__.py +0 -204
- build/lib/build/lib/pyrekordbox/_version.py +0 -16
- build/lib/build/lib/pyrekordbox/anlz/__init__.py +0 -127
- build/lib/build/lib/pyrekordbox/anlz/file.py +0 -186
- build/lib/build/lib/pyrekordbox/anlz/structs.py +0 -299
- build/lib/build/lib/pyrekordbox/anlz/tags.py +0 -508
- build/lib/build/lib/pyrekordbox/config.py +0 -596
- build/lib/build/lib/pyrekordbox/db6/__init__.py +0 -45
- build/lib/build/lib/pyrekordbox/db6/aux_files.py +0 -213
- build/lib/build/lib/pyrekordbox/db6/database.py +0 -1808
- build/lib/build/lib/pyrekordbox/db6/registry.py +0 -304
- build/lib/build/lib/pyrekordbox/db6/tables.py +0 -1618
- build/lib/build/lib/pyrekordbox/logger.py +0 -23
- build/lib/build/lib/pyrekordbox/mysettings/__init__.py +0 -32
- build/lib/build/lib/pyrekordbox/mysettings/file.py +0 -369
- build/lib/build/lib/pyrekordbox/mysettings/structs.py +0 -282
- build/lib/build/lib/pyrekordbox/utils.py +0 -162
- build/lib/build/lib/pyrekordbox/xml.py +0 -1294
- build/lib/build/lib/tests/__init__.py +0 -3
- build/lib/build/lib/tests/test_anlz.py +0 -206
- build/lib/build/lib/tests/test_db6.py +0 -1039
- build/lib/build/lib/tests/test_mysetting.py +0 -203
- build/lib/build/lib/tests/test_xml.py +0 -629
- build/lib/docs/source/conf.py +0 -178
- build/lib/pyrekordbox/__init__.py +0 -22
- build/lib/pyrekordbox/__main__.py +0 -204
- build/lib/pyrekordbox/_version.py +0 -16
- build/lib/pyrekordbox/anlz/__init__.py +0 -127
- build/lib/pyrekordbox/anlz/file.py +0 -186
- build/lib/pyrekordbox/anlz/structs.py +0 -299
- build/lib/pyrekordbox/anlz/tags.py +0 -508
- build/lib/pyrekordbox/config.py +0 -596
- build/lib/pyrekordbox/db6/__init__.py +0 -45
- build/lib/pyrekordbox/db6/aux_files.py +0 -213
- build/lib/pyrekordbox/db6/database.py +0 -1808
- build/lib/pyrekordbox/db6/registry.py +0 -304
- build/lib/pyrekordbox/db6/tables.py +0 -1618
- build/lib/pyrekordbox/logger.py +0 -23
- build/lib/pyrekordbox/mysettings/__init__.py +0 -32
- build/lib/pyrekordbox/mysettings/file.py +0 -369
- build/lib/pyrekordbox/mysettings/structs.py +0 -282
- build/lib/pyrekordbox/utils.py +0 -162
- build/lib/pyrekordbox/xml.py +0 -1294
- build/lib/tests/__init__.py +0 -3
- build/lib/tests/test_anlz.py +0 -206
- build/lib/tests/test_db6.py +0 -1039
- build/lib/tests/test_mysetting.py +0 -203
- build/lib/tests/test_xml.py +0 -629
- pyrekordbox-0.2.1.dist-info/RECORD +0 -129
- {pyrekordbox-0.2.1.dist-info → pyrekordbox-0.2.2.dist-info}/LICENSE +0 -0
- {pyrekordbox-0.2.1.dist-info → pyrekordbox-0.2.2.dist-info}/WHEEL +0 -0
@@ -1,206 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
# Author: Dylan Jones
|
3
|
-
# Date: 2023-02-01
|
4
|
-
|
5
|
-
import os
|
6
|
-
import pytest
|
7
|
-
import numpy as np
|
8
|
-
from numpy.testing import assert_equal
|
9
|
-
from pyrekordbox import anlz
|
10
|
-
|
11
|
-
TEST_ROOT = os.path.join(os.path.dirname(os.path.dirname(__file__)), ".testdata")
|
12
|
-
ANLZ_ROOT = os.path.join(TEST_ROOT, "export", "PIONEER", "USBANLZ")
|
13
|
-
ANLZ_DIRS = list(anlz.walk_anlz_paths(ANLZ_ROOT))
|
14
|
-
ANLZ_FILES = [paths for _, paths in ANLZ_DIRS]
|
15
|
-
|
16
|
-
|
17
|
-
def test_parse():
|
18
|
-
for root, files in ANLZ_DIRS:
|
19
|
-
for path in files.values():
|
20
|
-
anlz.AnlzFile.parse_file(path)
|
21
|
-
|
22
|
-
|
23
|
-
def test_rebuild():
|
24
|
-
for root, files in ANLZ_DIRS:
|
25
|
-
for path in files.values():
|
26
|
-
file = anlz.AnlzFile.parse_file(path)
|
27
|
-
data = file.build()
|
28
|
-
assert len(data) == file.file_header.len_file
|
29
|
-
_ = anlz.AnlzFile.parse(data)
|
30
|
-
|
31
|
-
|
32
|
-
def test_read_anlz_files():
|
33
|
-
for root, files in ANLZ_DIRS:
|
34
|
-
anlz_files = anlz.read_anlz_files(root)
|
35
|
-
assert len(files) == len(anlz_files)
|
36
|
-
|
37
|
-
|
38
|
-
# -- Tags ------------------------------------------------------------------------------
|
39
|
-
|
40
|
-
|
41
|
-
@pytest.mark.parametrize("paths", ANLZ_FILES)
|
42
|
-
def test_pqtz_tag_getters(paths):
|
43
|
-
file = anlz.AnlzFile.parse_file(paths["DAT"])
|
44
|
-
tag = file.get_tag("PQTZ")
|
45
|
-
beats, bpms, times = tag.get()
|
46
|
-
nbeats = len(beats)
|
47
|
-
# Check that shape of arrays are equal
|
48
|
-
assert nbeats == len(bpms)
|
49
|
-
assert nbeats == len(times)
|
50
|
-
# Check that the beats array only contains the values 1-4
|
51
|
-
if nbeats:
|
52
|
-
assert_equal(np.sort(np.unique(beats)), [1, 2, 3, 4])
|
53
|
-
|
54
|
-
# Check other getters
|
55
|
-
assert_equal(beats, tag.get_beats())
|
56
|
-
assert_equal(bpms, tag.get_bpms())
|
57
|
-
assert_equal(times, tag.get_times())
|
58
|
-
|
59
|
-
|
60
|
-
def test_pqtz_tag_set_beats():
|
61
|
-
paths = ANLZ_FILES[0]
|
62
|
-
file = anlz.AnlzFile.parse_file(paths["DAT"])
|
63
|
-
tag = file.get_tag("PQTZ")
|
64
|
-
|
65
|
-
beats = np.ones(tag.count)
|
66
|
-
tag.set_beats(beats)
|
67
|
-
assert_equal(tag.get_beats(), beats)
|
68
|
-
|
69
|
-
|
70
|
-
def test_pqtz_tag_set_bpms():
|
71
|
-
paths = ANLZ_FILES[0]
|
72
|
-
file = anlz.AnlzFile.parse_file(paths["DAT"])
|
73
|
-
tag = file.get_tag("PQTZ")
|
74
|
-
|
75
|
-
bpms = 100 * np.ones(tag.count, dtype=np.float64)
|
76
|
-
tag.set_bpms(bpms)
|
77
|
-
assert_equal(tag.get_bpms(), bpms)
|
78
|
-
|
79
|
-
|
80
|
-
def test_pqtz_tag_set_times():
|
81
|
-
paths = ANLZ_FILES[0]
|
82
|
-
file = anlz.AnlzFile.parse_file(paths["DAT"])
|
83
|
-
tag = file.get_tag("PQTZ")
|
84
|
-
|
85
|
-
times = 0.5 * np.arange(tag.count)
|
86
|
-
tag.set_times(times)
|
87
|
-
assert_equal(tag.get_times(), times)
|
88
|
-
|
89
|
-
|
90
|
-
def test_pqtz_tag_set():
|
91
|
-
paths = ANLZ_FILES[0]
|
92
|
-
file = anlz.AnlzFile.parse_file(paths["DAT"])
|
93
|
-
tag = file.get_tag("PQTZ")
|
94
|
-
|
95
|
-
beats = np.ones(tag.count)
|
96
|
-
bpms = 100 * np.ones(tag.count, dtype=np.float64)
|
97
|
-
times = 0.5 * np.arange(tag.count)
|
98
|
-
tag.set(beats, bpms, times)
|
99
|
-
assert_equal(tag.get_bpms(), bpms)
|
100
|
-
assert_equal(tag.get_bpms(), bpms)
|
101
|
-
assert_equal(tag.get_times(), times)
|
102
|
-
|
103
|
-
|
104
|
-
@pytest.mark.parametrize("paths", ANLZ_FILES)
|
105
|
-
def test_ppth_tag_getters(paths):
|
106
|
-
tmp = ""
|
107
|
-
for path in paths.values():
|
108
|
-
file = anlz.AnlzFile.parse_file(path)
|
109
|
-
tag = file.get_tag("PPTH")
|
110
|
-
p = tag.get()
|
111
|
-
if not tmp:
|
112
|
-
tmp = p
|
113
|
-
else:
|
114
|
-
assert tmp == p
|
115
|
-
|
116
|
-
|
117
|
-
def test_ppth_tag_setters():
|
118
|
-
paths = ANLZ_FILES[0]
|
119
|
-
extected = r"C:/new/path/to/file.mp3"
|
120
|
-
for path in paths.values():
|
121
|
-
file = anlz.AnlzFile.parse_file(path)
|
122
|
-
tag = file.get_tag("PPTH")
|
123
|
-
tag.set(r"C:\new\path\to\file.mp3")
|
124
|
-
assert tag.get() == extected
|
125
|
-
|
126
|
-
|
127
|
-
@pytest.mark.parametrize("paths", ANLZ_FILES)
|
128
|
-
def test_pwav_tag_getters(paths):
|
129
|
-
file = anlz.AnlzFile.parse_file(paths["DAT"])
|
130
|
-
tag = file.get_tag("PWAV")
|
131
|
-
|
132
|
-
heights, color = tag.get()
|
133
|
-
assert len(heights) == len(color)
|
134
|
-
assert np.all(np.logical_and(0 <= heights, heights <= 31))
|
135
|
-
assert np.all(np.logical_and(0 <= color, color <= 7))
|
136
|
-
|
137
|
-
|
138
|
-
@pytest.mark.parametrize("paths", ANLZ_FILES)
|
139
|
-
def test_pwv2_tag_getters(paths):
|
140
|
-
file = anlz.AnlzFile.parse_file(paths["DAT"])
|
141
|
-
tag = file.get_tag("PWV2")
|
142
|
-
|
143
|
-
heights, color = tag.get()
|
144
|
-
assert len(heights) == len(color)
|
145
|
-
assert np.all(np.logical_and(0 <= heights, heights <= 31))
|
146
|
-
assert np.all(np.logical_and(0 <= color, color <= 7))
|
147
|
-
|
148
|
-
|
149
|
-
@pytest.mark.parametrize("paths", ANLZ_FILES)
|
150
|
-
def test_pwv3_tag_getters(paths):
|
151
|
-
file = anlz.AnlzFile.parse_file(paths["EXT"])
|
152
|
-
tag = file.get_tag("PWV3")
|
153
|
-
|
154
|
-
heights, color = tag.get()
|
155
|
-
assert len(heights) == len(color)
|
156
|
-
assert np.all(np.logical_and(0 <= heights, heights <= 31))
|
157
|
-
assert np.all(np.logical_and(0 <= color, color <= 7))
|
158
|
-
|
159
|
-
|
160
|
-
@pytest.mark.parametrize("paths", ANLZ_FILES)
|
161
|
-
def test_pwv4_tag_getters(paths):
|
162
|
-
file = anlz.AnlzFile.parse_file(paths["EXT"])
|
163
|
-
tag = file.get_tag("PWV4")
|
164
|
-
|
165
|
-
heights, colors, blues = tag.get()
|
166
|
-
assert len(heights) == len(colors)
|
167
|
-
assert len(heights) == len(blues)
|
168
|
-
|
169
|
-
|
170
|
-
@pytest.mark.parametrize("paths", ANLZ_FILES)
|
171
|
-
def test_pwv5_tag_getters(paths):
|
172
|
-
file = anlz.AnlzFile.parse_file(paths["EXT"])
|
173
|
-
tag = file.get_tag("PWV5")
|
174
|
-
|
175
|
-
heights, colors = tag.get()
|
176
|
-
assert len(heights) == colors.shape[0]
|
177
|
-
|
178
|
-
|
179
|
-
# -- File ------------------------------------------------------------------------------
|
180
|
-
|
181
|
-
|
182
|
-
def test_anlzfile_getall_tags():
|
183
|
-
paths = ANLZ_FILES[0]
|
184
|
-
file = anlz.AnlzFile.parse_file(paths["DAT"])
|
185
|
-
key = "PPTH"
|
186
|
-
tags = file.getall_tags(key)
|
187
|
-
assert len(tags) == 1
|
188
|
-
assert tags[0].get() == file.get(key)
|
189
|
-
|
190
|
-
|
191
|
-
def test_anlzfile_get():
|
192
|
-
paths = ANLZ_FILES[0]
|
193
|
-
file = anlz.AnlzFile.parse_file(paths["DAT"])
|
194
|
-
key = "PPTH"
|
195
|
-
tag = file.get_tag(key)
|
196
|
-
assert file.get(key) == tag.get()
|
197
|
-
|
198
|
-
|
199
|
-
def test_anlzfile_getall():
|
200
|
-
paths = ANLZ_FILES[0]
|
201
|
-
file = anlz.AnlzFile.parse_file(paths["DAT"])
|
202
|
-
key = "PPTH"
|
203
|
-
tag = file.get_tag(key)
|
204
|
-
values = file.getall(key)
|
205
|
-
assert len(values) == 1
|
206
|
-
assert values[0] == tag.get()
|