Hotfix: 1

This commit is contained in:
Advik 2023-10-24 16:04:39 +05:30
parent e551ce526b
commit 17a4f4626b
No known key found for this signature in database
1 changed files with 25 additions and 15 deletions

View File

@ -7,7 +7,8 @@ from librespot.cache import CacheManager
from librespot.crypto import Packet
from librespot.metadata import EpisodeId, PlayableId, TrackId
from librespot.proto import Metadata_pb2 as Metadata, StorageResolve_pb2 as StorageResolve
from librespot.structure import AudioDecrypt, AudioQualityPicker, Closeable, FeederException, GeneralAudioStream, GeneralWritableStream, HaltListener, NoopAudioDecrypt, PacketsReceiver
from librespot.structure import AudioDecrypt, AudioQualityPicker, Closeable, FeederException, GeneralAudioStream, \
GeneralWritableStream, HaltListener, NoopAudioDecrypt, PacketsReceiver
import concurrent.futures
import io
import logging
@ -19,6 +20,11 @@ import threading
import time
import typing
import urllib.parse
import re
import urllib3
# Suppress InsecureRequestWarning, we don't care about SSL verification
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
if typing.TYPE_CHECKING:
from librespot.core import Session
@ -546,7 +552,10 @@ class CdnManager:
f"Couldn't extract expiration, invalid parameter in CDN url: {url}"
)
return
try:
self.__expiration = int(token_url.query[:i]) * 1000
except:
self.__expiration = int(re.search(r'\d{10}', token_url.query[:i]).group(0)) * 1000
else:
self.__expiration = -1
@ -622,7 +631,8 @@ class CdnManager:
response = self.request(index)
self.write_chunk(response.buffer, index, False)
def request(self, chunk: int = None, range_start: int = None, range_end: int = None) -> CdnManager.InternalResponse:
def request(self, chunk: int = None, range_start: int = None,
range_end: int = None) -> CdnManager.InternalResponse:
if chunk is None and range_start is None and range_end is None:
raise TypeError()
if chunk is not None: