def load_tracking_file(self, trackingFilePath: str) -> None: ''' `str` `trackingFilePath` : path to a .spotdlTrackingFile RETURNS `~` reads songsObj's from disk and prepares to track their download ''' # Attempt to read .spotdlTrackingFile, raise exception if file can't be read try: file = open(trackingFilePath, 'rb') songDataDumps = eval(file.read().decode()) file.close() except FileNotFoundError: raise Exception('no such tracking file found: %s' % trackingFilePath) # Save path to .spotdlTrackingFile self.saveFile = trackingFilePath # convert song data dumps to songObj's #! see, songObj.get_data_dump and songObj.from_dump for more details for dump in songDataDumps: self.songObjList.append(SongObj.from_dump(dump))
def load_tracking_file(self, trackingFilePath: str) -> None: """ `str` `trackingFilePath` : path to a .spotdlTrackingFile RETURNS `~` reads songsObj's from disk and prepares to track their download """ # Attempt to read .spotdlTrackingFile, raise exception if file can't be read trackingFile = Path(trackingFilePath) if not trackingFile.is_file(): raise FileNotFoundError( f"no such tracking file found: {trackingFilePath}") with trackingFile.open("rb") as file_handle: songDataDumps = eval(file_handle.read().decode()) # Save path to .spotdlTrackingFile self.saveFile = trackingFile # convert song data dumps to songObj's # ! see, songObj.get_data_dump and songObj.from_dump for more details for dump in songDataDumps: self.songObjList.append(SongObj.from_dump(dump))