Parcourir la source

cmus: support cace version \x0d

Fabian Peter Hammerle il y a 5 ans
Parent
commit
fc9903b7dc
1 fichiers modifiés avec 3 ajouts et 3 suppressions
  1. 3 3
      symuid/library/cmus.py

+ 3 - 3
symuid/library/cmus.py

@@ -22,7 +22,7 @@ class Track:
             int64_t mtime;
             int32_t duration;
             int32_t bitrate;
-            int32_t bpm;
+            int32_t bpm; // CACHE_VERSION 0x0d (commit 976c10d0e42c9ecd7389b28dd7c5b560a1702821)
             uint8_t _reserved[CACHE_ENTRY_RESERVED_SIZE];
             // filename, codec, codec_profile and N * (key, val)
             char strings[];
@@ -51,7 +51,7 @@ class Cache:
 
     FILE_PREFIX = b'CTC'
     VERSION_LENGTH = 1
-    SUPPORTED_VERSION = b'\x0c'
+    SUPPORTED_VERSIONS = [b'\x0c', b'\x0d']
     # always big endian, see cache_init()
     FLAGS_BYTEORDER = 'big'
     FLAGS_LENGTH = 4
@@ -65,7 +65,7 @@ class Cache:
             # see cache.c cache_init()
             assert stream.read(len(self.FILE_PREFIX)) == self.FILE_PREFIX
             cache_version = stream.read(self.VERSION_LENGTH)
-            assert cache_version == self.SUPPORTED_VERSION, cache_version
+            assert cache_version in self.SUPPORTED_VERSIONS, cache_version
             flags = int.from_bytes(
                 stream.read(self.FLAGS_LENGTH),
                 byteorder=self.FLAGS_BYTEORDER,  # persistent