from processor.emblem_processor import EmblemProcessor
from processor.songci_dao import MongoDAO
from writer.songci_writer import SongciWriter


def main():
    mongo_dao = MongoDAO()
    processor = EmblemProcessor(mongo_dao)

    mongo_dao.save_emblems_field(processor.gen_freq_rate(), 'freq_rate')
    mongo_dao.save_emblems_field(processor.gen_finals(), 'finals')

    songci_writer = SongciWriter(tune_name='huanxisha', rhyme='an',
                                 data_source_dao=mongo_dao)
    title, content = songci_writer.write_new()
    print('new_songci: \n《%s》\n\n%s' % (title, content))


if __name__ == '__main__':
    main()

@@ -1,20 +1,36 @@
+import logging%0A%0A
 from processor.emble
@@ -411,16 +411,25 @@
 iWriter(
+%0A        
 tune_nam
@@ -458,41 +458,8 @@
 an',
-%0A                                
  dat
@@ -482,16 +482,43 @@
 go_dao)%0A
+    for i in range(5):%0A    
     titl
@@ -556,16 +556,20 @@
 e_new()%0A
+    
     prin
@@ -575,20 +575,8 @@
 nt('
-new_songci: 
 %5Cn%E3%80%8A%25
@@ -583,16 +583,20 @@
 s%E3%80%8B%5Cn%5Cn%25s
+%5Cn%5Cn
 ' %25 (tit

format run.main demo