@@ -50,7 +50,7 @@ def full_path(self) -> Optional[str]:
5050 def mime_type (self ) -> Optional [str ]:
5151 return guess_media_type (os .path .basename (self .full_path ))[0 ]
5252
53- async def start (self , timeout : Optional [float ] = None , save_now : Optional [ bool ] = False ):
53+ async def setup (self , timeout : Optional [float ] = None ):
5454 try :
5555 metadata_download = self .torrent_session .add_torrent (self .identifier , self .download_directory )
5656 await asyncio .wait_for (metadata_download , timeout , loop = self .loop )
@@ -59,6 +59,9 @@ async def start(self, timeout: Optional[float] = None, save_now: Optional[bool]
5959 raise DownloadMetadataTimeoutError (self .identifier )
6060 self .download_directory = self .torrent_session .save_path (self .identifier )
6161 self ._file_name = Path (self .torrent_session .full_path (self .identifier )).name
62+
63+ async def start (self , timeout : Optional [float ] = None , save_now : Optional [bool ] = False ):
64+ await self .setup (timeout )
6265 await self .storage .add_torrent (self .identifier , self .torrent_length , self .torrent_name )
6366 self .rowid = await self .storage .save_downloaded_file (
6467 self .identifier , self .file_name , self .download_directory , 0.0 , added_on = self ._added_on
@@ -173,7 +176,7 @@ async def _load_stream(self, rowid: int, bt_infohash: str, file_name: Optional[s
173176 torrent_session = self .torrent_session
174177 )
175178 self .add (stream )
176- await stream .start ()
179+ await stream .setup ()
177180
178181 async def initialize_from_database (self ):
179182 for file in await self .storage .get_all_torrent_files ():
0 commit comments