Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

update2

  • Loading branch information...
commit 542945f8403ced352458b11e43dd2b44ed725017 1 parent 323edb0
allanozzolo authored
Showing with 40 additions and 0 deletions.
  1. +40 −0 update2.py
View
40 update2.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+'''
+inserire i vecchi valori di config.cfg nel database
+
+config.cfg --> database
+'''
+
+
+from mangareader import store, Manga, Mail, Chapter
+import re
+
+def convert_name(manga):
+ return manga.replace("'","")\
+ .replace(' - ',' ')\
+ .replace(' ','-')\
+ .replace('!','')\
+ .replace(':','')\
+ .lower()
+
+if __name__ == "__main__":
+ # Se presenti, linka i capitoli scaricati ai rispettivi manga
+ mangas = store.find(Manga)
+ for manga in mangas:
+ manga_name =unicode('%' + convert_name(manga.name) + '%')
+ try:
+ chapters = store.find(Chapter, Chapter.link.like(manga_name))
+ for chapter in chapters:
+ if not chapter.id_manga:
+ chapter.id_manga = manga.id
+ print ' set id_manga: %s (%s)' % (manga.id, manga.name)
+ except:
+ print 'problemi con %s' % manga_name
+ exit(1)
+
+ store.commit()
+ # check
+ chapters = store.find(Chapter)
+ for chapter in chapters:
+ if not chapter.id_manga:
+ print 'capitolo non associato: %s' % chapter.link
Please sign in to comment.
Something went wrong with that request. Please try again.