@@ -28,15 +28,40 @@ async def login(self):
2828 raise NotImplementedError
2929
3030 @abstractmethod
31- async def get_metadata (self , item : str , media_type ):
31+ async def get_metadata (self , item_id : str , media_type : str ):
32+ """Get metadata for the specified item.
33+
34+ Args:
35+ item_id: The ID of the item to get metadata for
36+ media_type: The type of the item (e.g., "track", "album", etc.)
37+ """
3238 raise NotImplementedError
3339
3440 @abstractmethod
3541 async def search (self , media_type : str , query : str , limit : int = 500 ) -> list [dict ]:
42+ """Search for items of the specified type.
43+
44+ Args:
45+ media_type: The type of item to search for
46+ query: The search query
47+ limit: Maximum number of results to return
48+
49+ Returns:
50+ A list of dictionaries containing search results
51+ """
3652 raise NotImplementedError
3753
3854 @abstractmethod
39- async def get_downloadable (self , item : str , quality : int ) -> Downloadable :
55+ async def get_downloadable (self , item_id : str , quality : int ) -> Downloadable :
56+ """Get a downloadable object for the specified item.
57+
58+ Args:
59+ item_id: The ID of the item to download
60+ quality: The quality level to download
61+
62+ Returns:
63+ A Downloadable object for the item
64+ """
4065 raise NotImplementedError
4166
4267 @staticmethod
@@ -58,9 +83,23 @@ async def get_session(
5883
5984 # Get connector kwargs based on SSL verification setting
6085 connector_kwargs = get_aiohttp_connector_kwargs (verify_ssl = verify_ssl )
61- connector = aiohttp .TCPConnector (** connector_kwargs )
86+
87+ # Create a merged dictionary with headers
88+ all_headers = {"User-Agent" : DEFAULT_USER_AGENT }
89+ all_headers .update (headers )
6290
91+ # Create the connector with appropriate SSL settings
92+ if "ssl" in connector_kwargs :
93+ # When using a custom SSL context
94+ ssl_context = connector_kwargs ["ssl" ]
95+ connector = aiohttp .TCPConnector (ssl = ssl_context )
96+ else :
97+ # When using verify_ssl boolean flag
98+ verify_ssl_flag = bool (connector_kwargs ["verify_ssl" ])
99+ connector = aiohttp .TCPConnector (verify_ssl = verify_ssl_flag )
100+
101+ # Create and return the session
63102 return aiohttp .ClientSession (
64- headers = { "User-Agent" : DEFAULT_USER_AGENT } | headers ,
103+ headers = all_headers ,
65104 connector = connector ,
66105 )
0 commit comments