X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=m_librarian%2Fglst.py;h=a4ac27d723b4b991ea70b1d6c625f7e1b91de224;hb=d9a85ec552d93e4a009f729d09f4452e6b34dac5;hp=b94381377e35072e98817665b18042cc2ac9c55a;hpb=1129afc4d0d93b43886522af59bacea93ec3d54d;p=m_librarian.git diff --git a/m_librarian/glst.py b/m_librarian/glst.py index b943813..a4ac27d 100755 --- a/m_librarian/glst.py +++ b/m_librarian/glst.py @@ -1,16 +1,15 @@ #! /usr/bin/env python -__all__ = ['import_glst'] - import codecs import os from sqlobject import sqlhub, SQLObjectNotFound from .db import Genre +__all__ = ['import_glst'] + def parse_glst_file(glst_filename): glst_file = codecs.open(glst_filename, 'r', 'utf-8') - genre_list = [] try: for line in glst_file: line = line.strip() @@ -23,10 +22,9 @@ def parse_glst_file(glst_filename): name, title = parts[1].split(';', 1) except (IndexError, ValueError): continue - genre_list.append((name, title)) + yield name, title finally: glst_file.close() - return genre_list def import_glst_file(glst_filename):