55Software license: "MIT software license". See http://opensource.org/licenses/MIT
66"""
77
8- __version__ = "1.55 "
8+ __version__ = "1.56 "
99
1010
1111import abc
@@ -1130,8 +1130,8 @@ def __exit__(self, exc_type, exc_val, exc_tb) -> None:
11301130class IceCastClient (StreamableSource ):
11311131 """
11321132 A simple client for IceCast audio streams as miniaudio streamable source.
1133- If the stream has Icy Meta Data , the stream_title attribute will be updated
1134- with the actual title taken from the meta data .
1133+ If the stream has Icy MetaData , the stream_title attribute will be updated
1134+ with the actual title taken from the metadata .
11351135 You can also provide a callback to be called when a new stream title is available.
11361136 The downloading of the data from the internet is done in a background thread
11371137 and it tries to keep a (small) buffer filled with available data to read.
@@ -1140,7 +1140,8 @@ class IceCastClient(StreamableSource):
11401140 BLOCK_SIZE = 8 * 1024
11411141 BUFFER_SIZE = 64 * 1024
11421142
1143- def __init__ (self , url : str , update_stream_title : Callable [['IceCastClient' , str ], None ] = None ) -> None :
1143+ def __init__ (self , url : str , update_stream_title : Callable [['IceCastClient' , str ], None ] = None ,
1144+ ssl_context : "ssl.SSLContext" = None ) -> None :
11441145 self .url = url
11451146 self .stream_title = "???"
11461147 self .station_genre = "???"
@@ -1152,7 +1153,7 @@ def __init__(self, url: str, update_stream_title: Callable[['IceCastClient', str
11521153 self ._buffer_lock = threading .Lock ()
11531154 self ._update_title = update_stream_title
11541155 req = urllib .request .Request (url , headers = {"icy-metadata" : "1" })
1155- with urllib .request .urlopen (req ) as result :
1156+ with urllib .request .urlopen (req , context = ssl_context ) as result :
11561157 self .station_genre = result .headers ["icy-genre" ]
11571158 self .station_name = result .headers ["icy-name" ]
11581159 stream_format = result .headers ["Content-Type" ]
0 commit comments