Compare commits
3 Commits
5d5526835c
...
6645c4443b
| Author | SHA1 | Date | |
|---|---|---|---|
| 6645c4443b | |||
| bb18717ec2 | |||
| 3ea30116e6 |
@@ -65,7 +65,7 @@ class BTreeDB(IPlaylistDB):
|
||||
|
||||
@staticmethod
|
||||
def _keyPlaylistEntry(tag, pos):
|
||||
return b''.join([tag, b'/playlist/', "{:05}".format(pos).encode()])
|
||||
return b''.join([tag, b'/playlist/', '{:05}'.format(pos).encode()])
|
||||
|
||||
@staticmethod
|
||||
def _keyPlaylistStart(tag):
|
||||
@@ -159,6 +159,7 @@ class BTreeDB(IPlaylistDB):
|
||||
result = True
|
||||
last_tag = None
|
||||
last_pos = None
|
||||
index_width = None
|
||||
for k in self.db.keys():
|
||||
fields = k.split(b'/')
|
||||
if len(fields) <= 1:
|
||||
@@ -180,11 +181,15 @@ class BTreeDB(IPlaylistDB):
|
||||
print(f'Malformed playlist entry: {k!r}')
|
||||
result = False
|
||||
continue
|
||||
if index_width is not None and len(fields[2]) != index_width:
|
||||
print(f'Inconsistent index width for {last_tag} at {idx}')
|
||||
result = False
|
||||
if (last_pos is not None and last_pos + 1 != idx) or \
|
||||
(last_pos is None and idx != 0):
|
||||
print(f'Bad playlist entry sequence for {last_tag} at {idx}')
|
||||
result = False
|
||||
last_pos = idx
|
||||
index_width = len(fields[2])
|
||||
if dump:
|
||||
print(f'\tTrack {idx}: {self.db[k]!r}')
|
||||
elif fields[1] == b'playlistpos':
|
||||
|
||||
Reference in New Issue
Block a user