pyrekordbox 0.4.1__py3-none-any.whl → 0.4.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.
pyrekordbox/__main__.py CHANGED
@@ -9,7 +9,7 @@ import sys
9
9
  import urllib.request
10
10
  from pathlib import Path
11
11
 
12
- from pyrekordbox.config import _cache_file, write_db6_key_cache
12
+ from pyrekordbox.config import get_cache_file, write_db6_key_cache
13
13
 
14
14
  KEY_SOURCES = [
15
15
  {
@@ -144,7 +144,8 @@ def download_db6_key():
144
144
  dp = match.group("dp")
145
145
  break
146
146
  if dp:
147
- print(f"Found key, updating cache file {_cache_file}")
147
+ cache_file = get_cache_file()
148
+ print(f"Found key, updating cache file {cache_file}")
148
149
  write_db6_key_cache(dp)
149
150
  else:
150
151
  print("No key found in the online sources.")
pyrekordbox/_version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.4.1'
21
- __version_tuple__ = version_tuple = (0, 4, 1)
20
+ __version__ = version = '0.4.2'
21
+ __version_tuple__ = version_tuple = (0, 4, 2)
pyrekordbox/config.py CHANGED
@@ -67,6 +67,10 @@ def get_appdata_dir() -> Path:
67
67
  return app_data
68
68
 
69
69
 
70
+ def get_cache_file() -> Path:
71
+ return get_appdata_dir() / "pyrekordbox" / _cache_file_name
72
+
73
+
70
74
  def get_pioneer_install_dir(path: Union[str, Path] = None) -> Path: # pragma: no cover
71
75
  """Returns the path of the Pioneer program installation directory.
72
76
 
@@ -477,7 +481,7 @@ def write_db6_key_cache(key: str) -> None: # pragma: no cover
477
481
  lines.append("dp: " + key)
478
482
  text = "\n".join(lines)
479
483
 
480
- cache_file = get_appdata_dir() / "pyrekordbox" / _cache_file_name
484
+ cache_file = get_cache_file()
481
485
  if not cache_file.parent.exists():
482
486
  cache_file.parent.mkdir()
483
487
 
@@ -494,7 +498,7 @@ def _update_sqlite_key(opts, conf):
494
498
  cache_version = 0
495
499
  pw, dp = "", ""
496
500
 
497
- cache_file = get_appdata_dir() / "pyrekordbox" / _cache_file_name
501
+ cache_file = get_cache_file()
498
502
 
499
503
  if cache_file.exists(): # pragma: no cover
500
504
  logger.debug("Found cache file %s", cache_file)
@@ -27,7 +27,7 @@ try:
27
27
  from sqlcipher3 import dbapi2 as sqlite3 # noqa
28
28
 
29
29
  _sqlcipher_available = True
30
- except ImportError:
30
+ except ImportError: # pragma: no cover
31
31
  import sqlite3
32
32
 
33
33
  _sqlcipher_available = False
@@ -125,9 +125,9 @@ class Rekordbox6Database:
125
125
  raise FileNotFoundError(f"File '{path}' does not exist!")
126
126
  # Open database
127
127
  if unlock:
128
- if not _sqlcipher_available:
128
+ if not _sqlcipher_available: # pragma: no cover
129
129
  raise ImportError("Could not unlock database: 'sqlcipher3' package not found")
130
- if not key:
130
+ if not key: # pragma: no cover
131
131
  try:
132
132
  key = rb_config["dp"]
133
133
  except KeyError:
pyrekordbox/db6/tables.py CHANGED
@@ -207,14 +207,14 @@ class Base(DeclarativeBase):
207
207
  return [column.key for column in inspect(cls).relationships] # noqa
208
208
 
209
209
  @classmethod
210
- def __get_keys__(cls):
210
+ def __get_keys__(cls): # pragma: no cover
211
211
  """Get all attributes of the table."""
212
212
  items = cls.__dict__.items()
213
213
  keys = [k for k, v in items if not callable(v) and not k.startswith("_")]
214
214
  return keys
215
215
 
216
216
  @classmethod
217
- def keys(cls):
217
+ def keys(cls): # pragma: no cover
218
218
  """Returns a list of all column names including the relationships."""
219
219
  if not cls.__keys__: # Cache the keys
220
220
  cls.__keys__ = cls.__get_keys__()
@@ -248,7 +248,7 @@ class Base(DeclarativeBase):
248
248
  """Returns a dictionary of all column names and values."""
249
249
  return {key: self.__getitem__(key) for key in self.columns()}
250
250
 
251
- def pformat(self, indent=" "):
251
+ def pformat(self, indent=" "): # pragma: no cover
252
252
  lines = [f"{self.__tablename__}"]
253
253
  columns = self.columns()
254
254
  w = max(len(col) for col in columns)
pyrekordbox/rbxml.py CHANGED
@@ -1042,13 +1042,14 @@ class RekordboxXml:
1042
1042
  >>> track = file.get_track(TrackID=1)
1043
1043
 
1044
1044
  """
1045
- if index is None and TrackID is None:
1046
- raise ValueError("Either index or TrackID has to be specified!")
1045
+ if index is None and TrackID is None and Location is None:
1046
+ raise ValueError("Either index, TrackID or Location has to be specified!")
1047
1047
 
1048
1048
  if TrackID is not None:
1049
1049
  el = self._collection.find(f'.//{Track.TAG}[@TrackID="{TrackID}"]')
1050
1050
  elif Location is not None:
1051
- el = self._collection.find(f'.//{Track.TAG}[@Location="{Location}"]')
1051
+ encoded = encode_path(Location)
1052
+ el = self._collection.find(f'.//{Track.TAG}[@Location="{encoded}"]')
1052
1053
  else:
1053
1054
  el = self._collection.find(f".//{Track.TAG}[{index + 1}]")
1054
1055
  return Track(element=el)
@@ -1091,10 +1092,10 @@ class RekordboxXml:
1091
1092
  node = node.get_playlist(name)
1092
1093
  return node
1093
1094
 
1094
- def _update_track_count(self):
1095
- """Updates the track count element."""
1096
- num_tracks = len(self._collection.findall(f".//{Track.TAG}"))
1097
- self._collection.attrib["Entries"] = str(num_tracks)
1095
+ # def _update_track_count(self):
1096
+ # """Updates the track count element."""
1097
+ # num_tracks = len(self._collection.findall(f".//{Track.TAG}"))
1098
+ # self._collection.attrib["Entries"] = str(num_tracks)
1098
1099
 
1099
1100
  def _increment_track_count(self):
1100
1101
  """Increment the track count element."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyrekordbox
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: Inofficial Python package for interacting with the library of Pioneers Rekordbox DJ software.
5
5
  Author-email: Dylan Jones <dylanljones94@gmail.com>
6
6
  License: MIT License
@@ -1,9 +1,9 @@
1
1
  pyrekordbox/__init__.py,sha256=hvg2dB7qhgGB6SmcRg8AION6mTGdlsThdHhsDZ9WYfs,622
2
- pyrekordbox/__main__.py,sha256=BtyDwVSGyoURY9Cy004vRL5Tgkwt4F7eXX_GD_vVYNQ,5976
3
- pyrekordbox/_version.py,sha256=yF2DwGUoQKNnLhAbpZX8kCQKjw77EZzhRk7_OTftets,511
4
- pyrekordbox/config.py,sha256=TTrL2bOo9DDKSW2yys8axaLB2GHhhD8VL7vq4dJxi1A,28309
2
+ pyrekordbox/__main__.py,sha256=ogn1wEOue1RUjGA0BxmgVIphcSCkoM1jZKRND0cAVLA,6016
3
+ pyrekordbox/_version.py,sha256=_F8vLxUxrAtC2alXNPGVa9l3P6_vLpQAzemS6QlnPGQ,511
4
+ pyrekordbox/config.py,sha256=yKRE0N_YU68kek-7bz0vouTgoQOVMXGKLZA21ydePd0,28333
5
5
  pyrekordbox/logger.py,sha256=dq1BtXBGavuAjuc45mvjF6mOWaeZqZFzo2aBOJdJ0Ik,483
6
- pyrekordbox/rbxml.py,sha256=UqATygpuOVGlSYj0nzcHSmDjTeQ9EL5AVLhAxS523F4,38340
6
+ pyrekordbox/rbxml.py,sha256=4qx7YX2UegsYQ2ETfqR-Qyus-8jQ89mer1YjEvq1WtQ,38422
7
7
  pyrekordbox/utils.py,sha256=hkYIgG5U4rzl2tjN9ESzLnf8OysEFybRQgmr6J7xq-k,4363
8
8
  pyrekordbox/anlz/__init__.py,sha256=SEVY0oPX9ohCVViUbsoOLTrBrFewTh-61qJxwXgAJKg,3155
9
9
  pyrekordbox/anlz/file.py,sha256=F6axHmprnp0j3pZkqmmp5iiJBUpqtWiAhSzlAJp2H6Y,6951
@@ -11,15 +11,15 @@ pyrekordbox/anlz/structs.py,sha256=Lt4fkb3SAE8w146eWeWGnpgRoP6jhLMWrSMoMwPjG04,7
11
11
  pyrekordbox/anlz/tags.py,sha256=nlPBKyRB8Z9J69bX2K8ZPQk_g1tMazKeVf2ViAqMX-c,13947
12
12
  pyrekordbox/db6/__init__.py,sha256=TZX_BPGZIkc4zSTULIc8yd_bf91MAezGtZevKNh3kZ0,856
13
13
  pyrekordbox/db6/aux_files.py,sha256=MehdQSc4iryiHvH8RfE9_9xMnD5qjRRDhTo0o0KRLw0,7592
14
- pyrekordbox/db6/database.py,sha256=2FTwVZOx8pSLLRr9ZV_95TUUtCfPo3CSLKYyudBN8-o,80678
14
+ pyrekordbox/db6/database.py,sha256=IHEEg8X3BiQF2MMfvYg36BvL6yqYY_jpCO-ysP8tU3Q,80738
15
15
  pyrekordbox/db6/registry.py,sha256=zYq_B7INM97de7vUTxqmA4N_P53loDkBkYdzdoeSnvY,9725
16
16
  pyrekordbox/db6/smartlist.py,sha256=GG6jE0BHMtx0RHgiVRpWYuL-Ex5edTNSLSDQNiCGzK0,12170
17
- pyrekordbox/db6/tables.py,sha256=EST6wvsJjlwmVB8JWBLMKbW3Mskk5qAo-xBqB09Q-Hg,68479
17
+ pyrekordbox/db6/tables.py,sha256=rQZ1qtJBtxiSrvmqGQEG61um5sf6UL5GeppFKO2p_zo,68539
18
18
  pyrekordbox/mysettings/__init__.py,sha256=6iLTQ1KIjuoq8Zt3thmkjqJSxrRVIi7BrQpxNcsQK04,706
19
19
  pyrekordbox/mysettings/file.py,sha256=JBfVe3jsmah_mGJjyC20_EqJZyJ7ftcOcCkRDKcWgv0,12671
20
20
  pyrekordbox/mysettings/structs.py,sha256=5Y1F3qTmsP1fRB39_BEHpQVxKx2DO9BytEuJUG_RNcY,8472
21
- pyrekordbox-0.4.1.dist-info/licenses/LICENSE,sha256=VwG9ZgC2UZnI0gTezGz1qkcAZ7sknBUQ1M62Z2nht54,1074
22
- pyrekordbox-0.4.1.dist-info/METADATA,sha256=q8KLPyfFte6I8cpdZai6LN8Kck8LI1E4rNZs947nnSY,15480
23
- pyrekordbox-0.4.1.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
24
- pyrekordbox-0.4.1.dist-info/top_level.txt,sha256=bUHkyxIHZDgSB6zhYnF1o4Yf1EQlTGGIkVRq9uEtsa4,12
25
- pyrekordbox-0.4.1.dist-info/RECORD,,
21
+ pyrekordbox-0.4.2.dist-info/licenses/LICENSE,sha256=VwG9ZgC2UZnI0gTezGz1qkcAZ7sknBUQ1M62Z2nht54,1074
22
+ pyrekordbox-0.4.2.dist-info/METADATA,sha256=XhI0TjehrWsupNOK1AEQcomb29sE2ydlb2wuU9WEXQ0,15480
23
+ pyrekordbox-0.4.2.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
24
+ pyrekordbox-0.4.2.dist-info/top_level.txt,sha256=bUHkyxIHZDgSB6zhYnF1o4Yf1EQlTGGIkVRq9uEtsa4,12
25
+ pyrekordbox-0.4.2.dist-info/RECORD,,