def load_from_file(filename):
if os.path.isdir(filename):<EOL><INDENT>logger.error("<STR_LIT>", filename)<EOL>return None<EOL><DEDENT>if not os.path.isfile(filename):<EOL><INDENT>logger.error("<STR_LIT>", filename)<EOL>return None<EOL><DEDENT>try:<EOL><INDENT>with open(filename, '<STR_LIT:r>') as sourcefile:<EOL><INDENT>songs = [line.strip() for line in sourcefile]<EOL><DEDENT><DEDENT>except IOError as error:<EOL><INDENT>logger.exception(error)<EOL>return None<EOL><DEDENT>songs = set(Song.from_filename(song) for song in songs)<EOL>return songs.difference({None})<EOL>
Load a list of filenames from an external text file.