pyrekordbox 0.3.2__py3-none-any.whl → 0.4.0__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.
Files changed (83) hide show
  1. pyrekordbox/__init__.py +8 -8
  2. pyrekordbox/__main__.py +3 -2
  3. pyrekordbox/_version.py +2 -2
  4. pyrekordbox/anlz/__init__.py +3 -2
  5. pyrekordbox/anlz/file.py +4 -2
  6. pyrekordbox/anlz/tags.py +3 -1
  7. pyrekordbox/config.py +79 -23
  8. pyrekordbox/db6/__init__.py +2 -2
  9. pyrekordbox/db6/aux_files.py +3 -2
  10. pyrekordbox/db6/database.py +101 -111
  11. pyrekordbox/db6/registry.py +1 -0
  12. pyrekordbox/db6/smartlist.py +7 -6
  13. pyrekordbox/db6/tables.py +44 -16
  14. pyrekordbox/logger.py +0 -1
  15. pyrekordbox/mysettings/__init__.py +5 -4
  16. pyrekordbox/mysettings/file.py +3 -1
  17. pyrekordbox/rbxml.py +5 -3
  18. pyrekordbox/utils.py +4 -3
  19. {pyrekordbox-0.3.2.dist-info → pyrekordbox-0.4.0.dist-info}/METADATA +21 -41
  20. pyrekordbox-0.4.0.dist-info/RECORD +25 -0
  21. {pyrekordbox-0.3.2.dist-info → pyrekordbox-0.4.0.dist-info}/WHEEL +1 -1
  22. {pyrekordbox-0.3.2.dist-info → pyrekordbox-0.4.0.dist-info}/top_level.txt +0 -2
  23. docs/Makefile +0 -20
  24. docs/make.bat +0 -35
  25. docs/source/_static/images/anlz_beat.svg +0 -53
  26. docs/source/_static/images/anlz_file.svg +0 -204
  27. docs/source/_static/images/anlz_pco2.svg +0 -138
  28. docs/source/_static/images/anlz_pcob.svg +0 -148
  29. docs/source/_static/images/anlz_pcp2.svg +0 -398
  30. docs/source/_static/images/anlz_pcpt.svg +0 -263
  31. docs/source/_static/images/anlz_ppth.svg +0 -123
  32. docs/source/_static/images/anlz_pqt2.svg +0 -324
  33. docs/source/_static/images/anlz_pqt2_2.svg +0 -253
  34. docs/source/_static/images/anlz_pqtz.svg +0 -140
  35. docs/source/_static/images/anlz_pssi.svg +0 -192
  36. docs/source/_static/images/anlz_pssi_entry.svg +0 -191
  37. docs/source/_static/images/anlz_pvbr.svg +0 -125
  38. docs/source/_static/images/anlz_pwav.svg +0 -130
  39. docs/source/_static/images/anlz_pwv3.svg +0 -139
  40. docs/source/_static/images/anlz_pwv4.svg +0 -139
  41. docs/source/_static/images/anlz_pwv5.svg +0 -139
  42. docs/source/_static/images/anlz_pwv5_entry.svg +0 -100
  43. docs/source/_static/images/anlz_pwv6.svg +0 -130
  44. docs/source/_static/images/anlz_pwv7.svg +0 -139
  45. docs/source/_static/images/anlz_pwvc.svg +0 -125
  46. docs/source/_static/images/anlz_tag.svg +0 -110
  47. docs/source/_static/images/x64dbg_rb_key.png +0 -0
  48. docs/source/_static/logos/dark/logo_primary.svg +0 -75
  49. docs/source/_static/logos/light/logo_primary.svg +0 -75
  50. docs/source/_static/logos/mid/logo_primary.svg +0 -75
  51. docs/source/_templates/apidoc/module.rst_t +0 -8
  52. docs/source/_templates/apidoc/package.rst_t +0 -57
  53. docs/source/_templates/apidoc/toc.rst_t +0 -7
  54. docs/source/_templates/autosummary/class.rst +0 -32
  55. docs/source/_templates/autosummary/module.rst +0 -55
  56. docs/source/api.md +0 -18
  57. docs/source/conf.py +0 -178
  58. docs/source/development/changes.md +0 -3
  59. docs/source/development/contributing.md +0 -3
  60. docs/source/formats/anlz.md +0 -634
  61. docs/source/formats/db6.md +0 -1233
  62. docs/source/formats/mysetting.md +0 -392
  63. docs/source/formats/xml.md +0 -376
  64. docs/source/index.md +0 -103
  65. docs/source/installation.md +0 -271
  66. docs/source/key.md +0 -103
  67. docs/source/quickstart.md +0 -189
  68. docs/source/requirements.txt +0 -7
  69. docs/source/tutorial/anlz.md +0 -7
  70. docs/source/tutorial/configuration.md +0 -66
  71. docs/source/tutorial/db6.md +0 -178
  72. docs/source/tutorial/index.md +0 -20
  73. docs/source/tutorial/mysetting.md +0 -124
  74. docs/source/tutorial/xml.md +0 -140
  75. pyrekordbox/xml.py +0 -8
  76. pyrekordbox-0.3.2.dist-info/RECORD +0 -84
  77. tests/__init__.py +0 -3
  78. tests/test_anlz.py +0 -206
  79. tests/test_config.py +0 -175
  80. tests/test_db6.py +0 -1193
  81. tests/test_mysetting.py +0 -203
  82. tests/test_xml.py +0 -629
  83. {pyrekordbox-0.3.2.dist-info → pyrekordbox-0.4.0.dist-info}/LICENSE +0 -0
tests/test_xml.py DELETED
@@ -1,629 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # Author: Dylan Jones
3
- # Date: 2022-05-07
4
-
5
- import os
6
- import pytest
7
- from pyrekordbox import RekordboxXml
8
- from pyrekordbox.rbxml import Tempo, PositionMark, XmlDuplicateError
9
-
10
- TEST_ROOT = os.path.join(os.path.dirname(os.path.dirname(__file__)), ".testdata")
11
- XML5 = os.path.join(TEST_ROOT, "rekordbox 5", "database.xml")
12
- XML6 = os.path.join(TEST_ROOT, "rekordbox 6", "database.xml")
13
-
14
-
15
- V5_TRACK_INFOS = [
16
- {
17
- "TrackID": 1,
18
- "Name": "NOISE",
19
- "Artist": "",
20
- "Composer": "",
21
- "Album": "",
22
- "Grouping": "",
23
- "Genre": "",
24
- "Kind": "WAV File",
25
- "Size": 1382226,
26
- "TotalTime": 5,
27
- "DiscNumber": 0,
28
- "TrackNumber": 0,
29
- "Year": 0,
30
- "AverageBpm": 0.0,
31
- "DateAdded": "2022-04-04",
32
- "BitRate": 2116,
33
- "SampleRate": 44100.0,
34
- "Comments": "",
35
- "PlayCount": 0,
36
- "Rating": 0,
37
- "Location": "C:/Music/PioneerDJ/Sampler/OSC_SAMPLER/PRESET ONESHOT/NOISE.wav",
38
- "Remixer": "",
39
- "Tonality": "",
40
- "Label": "",
41
- "Mix": "",
42
- },
43
- {
44
- "TrackID": 2,
45
- "Name": "SINEWAVE",
46
- "Artist": "",
47
- "Composer": "",
48
- "Album": "",
49
- "Grouping": "",
50
- "Genre": "",
51
- "Kind": "WAV File",
52
- "Size": 1515258,
53
- "TotalTime": 5,
54
- "DiscNumber": 0,
55
- "TrackNumber": 0,
56
- "Year": 0,
57
- "AverageBpm": 0.0,
58
- "DateAdded": "2022-04-04",
59
- "BitRate": 2116,
60
- "SampleRate": 44100.0,
61
- "Comments": "",
62
- "PlayCount": 0,
63
- "Rating": 0,
64
- "Location": "C:/Music/PioneerDJ/Sampler/OSC_SAMPLER/PRESET ONESHOT/SINEWAVE.wav", # noqa: E501
65
- "Remixer": "",
66
- "Tonality": "",
67
- "Label": "",
68
- "Mix": "",
69
- },
70
- {
71
- "TrackID": 3,
72
- "Name": "SIREN",
73
- "Artist": "",
74
- "Composer": "",
75
- "Album": "",
76
- "Grouping": "",
77
- "Genre": "",
78
- "Kind": "WAV File",
79
- "Size": 1941204,
80
- "TotalTime": 7,
81
- "DiscNumber": 0,
82
- "TrackNumber": 0,
83
- "Year": 0,
84
- "AverageBpm": 0.0,
85
- "DateAdded": "2022-04-04",
86
- "BitRate": 2116,
87
- "SampleRate": 44100.0,
88
- "Comments": "",
89
- "PlayCount": 0,
90
- "Rating": 0,
91
- "Location": "C:/Music/PioneerDJ/Sampler/OSC_SAMPLER/PRESET ONESHOT/SIREN.wav",
92
- "Remixer": "",
93
- "Tonality": "",
94
- "Label": "",
95
- "Mix": "",
96
- },
97
- {
98
- "TrackID": 4,
99
- "Name": "HORN",
100
- "Artist": "",
101
- "Composer": "",
102
- "Album": "",
103
- "Grouping": "",
104
- "Genre": "",
105
- "Kind": "WAV File",
106
- "Size": 2010816,
107
- "TotalTime": 7,
108
- "DiscNumber": 0,
109
- "TrackNumber": 0,
110
- "Year": 0,
111
- "AverageBpm": 0.0,
112
- "DateAdded": "2022-04-04",
113
- "BitRate": 2116,
114
- "SampleRate": 44100.0,
115
- "Comments": "",
116
- "PlayCount": 0,
117
- "Rating": 0,
118
- "Location": "C:/Music/PioneerDJ/Sampler/OSC_SAMPLER/PRESET ONESHOT/HORN.wav",
119
- "Remixer": "",
120
- "Tonality": "",
121
- "Label": "",
122
- "Mix": "",
123
- },
124
- {
125
- "TrackID": 5,
126
- "Name": "Demo Track 1",
127
- "Artist": "Loopmasters",
128
- "Composer": "",
129
- "Album": "",
130
- "Grouping": "",
131
- "Genre": "",
132
- "Kind": "MP3 File",
133
- "Size": 6899624,
134
- "TotalTime": 172,
135
- "DiscNumber": 0,
136
- "TrackNumber": 0,
137
- "Year": 0,
138
- "AverageBpm": 128.0,
139
- "DateAdded": "2022-04-04",
140
- "BitRate": 320,
141
- "SampleRate": 44100.0,
142
- "Comments": "Tracks by www.loopmasters.com",
143
- "PlayCount": 0,
144
- "Rating": 0,
145
- "Location": "C:/Music/PioneerDJ/Demo Tracks/Demo Track 1.mp3",
146
- "Remixer": "",
147
- "Tonality": "",
148
- "Label": "Loopmasters",
149
- "Mix": "",
150
- },
151
- {
152
- "TrackID": 6,
153
- "Name": "Demo Track 2",
154
- "Artist": "Loopmasters",
155
- "Composer": "",
156
- "Album": "",
157
- "Grouping": "",
158
- "Genre": "",
159
- "Kind": "MP3 File",
160
- "Size": 5124342,
161
- "TotalTime": 128,
162
- "DiscNumber": 0,
163
- "TrackNumber": 0,
164
- "Year": 0,
165
- "AverageBpm": 120.0,
166
- "DateAdded": "2022-04-04",
167
- "BitRate": 320,
168
- "SampleRate": 44100.0,
169
- "Comments": "Tracks by www.loopmasters.com",
170
- "PlayCount": 0,
171
- "Rating": 0,
172
- "Location": "C:/Music/PioneerDJ/Demo Tracks/Demo Track 2.mp3",
173
- "Remixer": "",
174
- "Tonality": "",
175
- "Label": "Loopmasters",
176
- "Mix": "",
177
- },
178
- ]
179
-
180
- V6_TRACK_INFOS = [
181
- {
182
- "TrackID": 253529738,
183
- "Name": "Demo Track 1",
184
- "Artist": "Loopmasters",
185
- "Composer": "",
186
- "Album": "",
187
- "Grouping": "",
188
- "Genre": "",
189
- "Kind": "Mp3-Datei ",
190
- "Size": 6899624,
191
- "TotalTime": 172,
192
- "DiscNumber": 0,
193
- "TrackNumber": 0,
194
- "Year": 0,
195
- "AverageBpm": 128.0,
196
- "DateAdded": "2022-04-09",
197
- "BitRate": 320,
198
- "SampleRate": 44100.0,
199
- "Comments": "Tracks by www.loopmasters.com",
200
- "PlayCount": 0,
201
- "Rating": 0,
202
- "Location": "C:/Music/PioneerDJ/Demo Tracks/Demo Track 1.mp3",
203
- "Remixer": "",
204
- "Tonality": "Fm",
205
- "Label": "Loopmasters",
206
- "Mix": "",
207
- },
208
- {
209
- "TrackID": 17109519,
210
- "Name": "Demo Track 2",
211
- "Artist": "Loopmasters",
212
- "Composer": "",
213
- "Album": "",
214
- "Grouping": "",
215
- "Genre": "",
216
- "Kind": "Mp3-Datei ",
217
- "Size": 5124342,
218
- "TotalTime": 128,
219
- "DiscNumber": 0,
220
- "TrackNumber": 0,
221
- "Year": 0,
222
- "AverageBpm": 120.0,
223
- "DateAdded": "2022-04-09",
224
- "BitRate": 320,
225
- "SampleRate": 44100.0,
226
- "Comments": "Tracks by www.loopmasters.com",
227
- "PlayCount": 0,
228
- "Rating": 0,
229
- "Location": "C:/Music/PioneerDJ/Demo Tracks/Demo Track 2.mp3",
230
- "Remixer": "",
231
- "Tonality": "Fm",
232
- "Label": "Loopmasters",
233
- "Mix": "",
234
- },
235
- {
236
- "TrackID": 49557014,
237
- "Name": "HORN",
238
- "Artist": "",
239
- "Composer": "",
240
- "Album": "",
241
- "Grouping": "",
242
- "Genre": "",
243
- "Kind": "Wav-Datei ",
244
- "Size": 2010816,
245
- "TotalTime": 7,
246
- "DiscNumber": 0,
247
- "TrackNumber": 0,
248
- "Year": 0,
249
- "AverageBpm": 0.0,
250
- "DateAdded": "2022-04-09",
251
- "BitRate": 2116,
252
- "SampleRate": 44100.0,
253
- "Comments": "",
254
- "PlayCount": 0,
255
- "Rating": 0,
256
- "Location": "C:/Music/PioneerDJ/Sampler/OSC_SAMPLER/PRESET ONESHOT/HORN.wav",
257
- "Remixer": "",
258
- "Tonality": "",
259
- "Label": "",
260
- "Mix": "",
261
- },
262
- {
263
- "TrackID": 209873516,
264
- "Name": "NOISE",
265
- "Artist": "",
266
- "Composer": "",
267
- "Album": "",
268
- "Grouping": "",
269
- "Genre": "",
270
- "Kind": "Wav-Datei ",
271
- "Size": 1382226,
272
- "TotalTime": 5,
273
- "DiscNumber": 0,
274
- "TrackNumber": 0,
275
- "Year": 0,
276
- "AverageBpm": 0.0,
277
- "DateAdded": "2022-04-09",
278
- "BitRate": 2116,
279
- "SampleRate": 44100.0,
280
- "Comments": "",
281
- "PlayCount": 0,
282
- "Rating": 0,
283
- "Location": "C:/Music/PioneerDJ/Sampler/OSC_SAMPLER/PRESET ONESHOT/NOISE.wav",
284
- "Remixer": "",
285
- "Tonality": "",
286
- "Label": "",
287
- "Mix": "",
288
- },
289
- {
290
- "TrackID": 55231398,
291
- "Name": "SINEWAVE",
292
- "Artist": "",
293
- "Composer": "",
294
- "Album": "",
295
- "Grouping": "",
296
- "Genre": "",
297
- "Kind": "Wav-Datei ",
298
- "Size": 1515258,
299
- "TotalTime": 5,
300
- "DiscNumber": 0,
301
- "TrackNumber": 0,
302
- "Year": 0,
303
- "AverageBpm": 0.0,
304
- "DateAdded": "2022-04-09",
305
- "BitRate": 2116,
306
- "SampleRate": 44100.0,
307
- "Comments": "",
308
- "PlayCount": 0,
309
- "Rating": 0,
310
- "Location": "C:/Music/PioneerDJ/Sampler/OSC_SAMPLER/PRESET ONESHOT/SINEWAVE.wav", # noqa: E501
311
- "Remixer": "",
312
- "Tonality": "",
313
- "Label": "",
314
- "Mix": "",
315
- },
316
- {
317
- "TrackID": 92396897,
318
- "Name": "SIREN",
319
- "Artist": "",
320
- "Composer": "",
321
- "Album": "",
322
- "Grouping": "",
323
- "Genre": "",
324
- "Kind": "Wav-Datei ",
325
- "Size": 1941204,
326
- "TotalTime": 7,
327
- "DiscNumber": 0,
328
- "TrackNumber": 0,
329
- "Year": 0,
330
- "AverageBpm": 0.0,
331
- "DateAdded": "2022-04-09",
332
- "BitRate": 2116,
333
- "SampleRate": 44100.0,
334
- "Comments": "",
335
- "PlayCount": 0,
336
- "Rating": 0,
337
- "Location": "C:/Music/PioneerDJ/Sampler/OSC_SAMPLER/PRESET ONESHOT/SIREN.wav",
338
- "Remixer": "",
339
- "Tonality": "",
340
- "Label": "",
341
- "Mix": "",
342
- },
343
- ]
344
-
345
- TEMPOS = [
346
- [{"Inizio": 0.025, "Bpm": 128.0, "Metro": "4/4", "Battito": 1}],
347
- [
348
- {"Inizio": 0.025, "Bpm": 120.0, "Metro": "4/4", "Battito": 1},
349
- {"Inizio": 48.026, "Bpm": 120.0, "Metro": "4/4", "Battito": 1},
350
- {"Inizio": 48.525, "Bpm": 120.0, "Metro": "4/4", "Battito": 2},
351
- {"Inizio": 49.026, "Bpm": 120.0, "Metro": "4/4", "Battito": 3},
352
- {"Inizio": 49.525, "Bpm": 120.0, "Metro": "4/4", "Battito": 4},
353
- {"Inizio": 50.026, "Bpm": 120.0, "Metro": "4/4", "Battito": 1},
354
- {"Inizio": 50.525, "Bpm": 120.0, "Metro": "4/4", "Battito": 2},
355
- {"Inizio": 51.026, "Bpm": 120.0, "Metro": "4/4", "Battito": 3},
356
- {"Inizio": 51.525, "Bpm": 120.0, "Metro": "4/4", "Battito": 4},
357
- {"Inizio": 52.026, "Bpm": 120.0, "Metro": "4/4", "Battito": 1},
358
- ],
359
- ]
360
-
361
- POSITION_MARKS = [
362
- [
363
- {"Name": "", "Type": "cue", "Start": 0.025, "Num": -1},
364
- {"Name": "", "Type": "cue", "Start": 15.025, "Num": -1},
365
- {"Name": "", "Type": "cue", "Start": 30.025, "Num": -1},
366
- {"Name": "", "Type": "cue", "Start": 45.025, "Num": -1},
367
- ],
368
- [
369
- {"Name": "", "Type": "cue", "Start": 0.025, "Num": -1},
370
- {"Name": "", "Type": "cue", "Start": 16.025, "Num": -1},
371
- {"Name": "", "Type": "cue", "Start": 32.025, "Num": -1},
372
- {"Name": "", "Type": "cue", "Start": 48.026, "Num": -1},
373
- ],
374
- ]
375
-
376
-
377
- def test_track_attribs_v5():
378
- xml = RekordboxXml(XML5)
379
-
380
- for i, track in enumerate(xml.get_tracks()):
381
- for attr in track.ATTRIBS:
382
- info = V5_TRACK_INFOS[i]
383
- value = track[attr]
384
- if attr == "Location":
385
- assert os.path.normpath(value) == os.path.normpath(info[attr])
386
- elif attr in info:
387
- assert value == info[attr]
388
- else:
389
- assert value is None
390
-
391
-
392
- def test_track_attribs_v6():
393
- xml = RekordboxXml(XML6)
394
-
395
- for i, track in enumerate(xml.get_tracks()):
396
- for attr in track.ATTRIBS:
397
- info = V6_TRACK_INFOS[i]
398
- value = track[attr]
399
- if attr == "Location":
400
- assert os.path.normpath(value) == os.path.normpath(info[attr])
401
- elif attr in info:
402
- assert value == info[attr]
403
- else:
404
- assert value is None
405
-
406
-
407
- def test_tempos_v5():
408
- xml = RekordboxXml(XML5)
409
-
410
- for i in range(3):
411
- track = xml.get_track(i)
412
- assert len(track.tempos) == 0
413
-
414
- track = xml.get_track(4)
415
- tempos = TEMPOS[0]
416
- for info, tempo in zip(tempos, track.tempos):
417
- for attr in Tempo.ATTRIBS:
418
- value = tempo[attr]
419
- if attr in info:
420
- assert value == info[attr]
421
- else:
422
- assert value is None
423
-
424
- track = xml.get_track(5)
425
- tempos = TEMPOS[1]
426
- for info, tempo in zip(tempos, track.tempos):
427
- for attr in Tempo.ATTRIBS:
428
- value = tempo[attr]
429
- if attr in info:
430
- assert value == info[attr]
431
- else:
432
- assert value is None
433
-
434
-
435
- def test_marks_v5():
436
- xml = RekordboxXml(XML5)
437
-
438
- for i in range(3):
439
- track = xml.get_track(i)
440
- assert len(track.tempos) == 0
441
-
442
- track = xml.get_track(4)
443
- tempos = POSITION_MARKS[0]
444
- for info, posmark in zip(tempos, track.marks):
445
- for attr in PositionMark.ATTRIBS:
446
- value = posmark[attr]
447
- if attr in info:
448
- assert value == info[attr]
449
- else:
450
- assert value is None
451
-
452
- track = xml.get_track(5)
453
- tempos = POSITION_MARKS[1]
454
- for info, posmark in zip(tempos, track.marks):
455
- for attr in PositionMark.ATTRIBS:
456
- value = posmark[attr]
457
- if attr in info:
458
- assert value == info[attr]
459
- else:
460
- assert value is None
461
-
462
-
463
- def test_add_track():
464
- xml = RekordboxXml()
465
- track1 = xml.add_track("C:/path/to/file1.wav")
466
-
467
- raw_location = os.path.normpath(track1._element.attrib["Location"])
468
- assert track1.TrackID == 1
469
- assert raw_location == os.path.normpath("file:/localhost/C:/path/to/file1.wav")
470
- assert track1.Location == os.path.normpath("C:/path/to/file1.wav")
471
-
472
- # test auto-increment of TrackID
473
- track2 = xml.add_track("C:/path/to/file2.wav")
474
- assert track2.TrackID == 2
475
-
476
- # test manual TrackID
477
- track3 = xml.add_track("C:/path/to/file3.wav", TrackID=10)
478
- assert track3.TrackID == 10
479
-
480
- # test auto-increment after manual TrackID
481
- track4 = xml.add_track("C:/path/to/file4.wav")
482
- assert track4.TrackID == 11
483
-
484
- # Location exists
485
- with pytest.raises(XmlDuplicateError):
486
- xml.add_track("C:/path/to/file1.wav")
487
-
488
- # TrackID exists
489
- with pytest.raises(XmlDuplicateError):
490
- xml.add_track("C:/path/to/file_new.wav", TrackID=track1.TrackID)
491
-
492
-
493
- def test_update_track_count():
494
- xml = RekordboxXml()
495
- track1 = xml.add_track("C:/path/to/file1.wav")
496
- assert xml.num_tracks == 1
497
-
498
- track2 = xml.add_track("C:/path/to/file2.wav")
499
- assert xml.num_tracks == 2
500
-
501
- xml.remove_track(track1)
502
- assert xml.num_tracks == 1
503
-
504
- xml.remove_track(track2)
505
- assert xml.num_tracks == 0
506
-
507
-
508
- def test_add_tempo():
509
- xml = RekordboxXml()
510
- track = xml.add_track("C:/path/to/file1.wav")
511
- assert len(track.tempos) == 0
512
-
513
- inizio = 0.0
514
- bpm = 100.0
515
- metro = "4/4"
516
- battito = 1
517
- track.add_tempo(inizio, bpm, metro, battito)
518
-
519
- assert len(track.tempos) == 1
520
- tempo = track.tempos[0]
521
- assert tempo.Inizio == inizio
522
- assert tempo.Bpm == bpm
523
- assert tempo.Metro == metro
524
- assert tempo.Battito == battito
525
-
526
-
527
- def test_add_position_mark():
528
- xml = RekordboxXml()
529
- track = xml.add_track("C:/path/to/file1.wav")
530
- assert len(track.marks) == 0
531
-
532
- name = "cue point"
533
- mark_type = "cue"
534
- start = 0.0
535
- end = None
536
- num = -1
537
- track.add_mark(name, mark_type, start, end, num)
538
-
539
- assert len(track.marks) == 1
540
-
541
- mark = track.marks[0]
542
- assert mark.Name == name
543
- assert mark.Type == mark_type
544
- assert mark.Start == start
545
- assert mark.End == end
546
- assert mark.Num == num
547
-
548
-
549
- def test_get_playlist():
550
- xml = RekordboxXml(XML5)
551
-
552
- playlist = xml.get_playlist("Playlist1")
553
- assert playlist.is_playlist
554
- assert not playlist.is_folder
555
-
556
- folder = xml.get_playlist("Folder")
557
- assert folder.is_folder
558
- assert not folder.is_playlist
559
-
560
- sub_playlist = xml.get_playlist("Folder", "Sub Playlist")
561
- assert sub_playlist.is_playlist
562
- assert not sub_playlist.is_folder
563
-
564
- assert folder.get_playlist("Sub Playlist").name == sub_playlist.name
565
-
566
-
567
- def test_playlist_entries():
568
- xml = RekordboxXml(XML5)
569
-
570
- playlist = xml.get_playlist("Playlist1")
571
- key_type = playlist.key_type
572
- for key in playlist.get_tracks():
573
- kwargs = {key_type: key}
574
- xml.get_track(**kwargs)
575
-
576
-
577
- def test_add_playlist():
578
- xml = RekordboxXml()
579
- playlist = xml.add_playlist("Playlist")
580
-
581
- assert playlist.is_playlist
582
- assert not playlist.is_folder
583
-
584
- with pytest.raises(ValueError):
585
- playlist.add_playlist("Sub Playlist")
586
-
587
-
588
- def test_add_playlist_folder():
589
- xml = RekordboxXml()
590
- folder = xml.add_playlist_folder("Folder")
591
-
592
- assert not folder.is_playlist
593
- assert folder.is_folder
594
-
595
- folder.add_playlist("Sub Playlist")
596
-
597
-
598
- def test_update_folder_count():
599
- xml = RekordboxXml()
600
- folder = xml.add_playlist_folder("Folder")
601
-
602
- folder.add_playlist("P1")
603
- assert folder.count == 1
604
-
605
- folder.add_playlist_folder("F1")
606
- assert folder.count == 2
607
-
608
- folder.remove_playlist("P1")
609
- assert folder.count == 1
610
-
611
- folder.remove_playlist("F1")
612
- assert folder.count == 0
613
-
614
-
615
- def test_update_playlist_entries():
616
- xml = RekordboxXml()
617
- playlist = xml.add_playlist("Playlist")
618
-
619
- playlist.add_track(0)
620
- assert playlist.entries == 1
621
-
622
- playlist.add_track(1)
623
- assert playlist.entries == 2
624
-
625
- playlist.remove_track(1)
626
- assert playlist.entries == 1
627
-
628
- playlist.remove_track(0)
629
- assert playlist.entries == 0