Ejemplo n.º 1
0
 def handle(self, path, count, *args, **kwargs):
     i = 0
     count = int(count)
     for book in Book.objects.all():
         rdffile = path + '/epub/'+ str(book.book_id) + '/pg' + str(book.book_id) + '.rdf'
         try:
             book.yaml = pg_rdf_to_yaml(rdffile, repo_name=book.repo_name )
             book.save()
         except IOError:
             print "couldn't read " + rdffile
             continue
         except Exception,e:
             print "processing " + rdffile
             raise e
         i+=1
         if count and i>count:
             break
         if i%100 == 0:
             print str(i)+" files completed"
Ejemplo n.º 2
0
 def handle(self, path, count, *args, **kwargs):
     i = 0
     count = int(count)
     for book in Book.objects.all():
         rdffile = path + '/epub/' + str(book.book_id) + '/pg' + str(
             book.book_id) + '.rdf'
         try:
             book.yaml = pg_rdf_to_yaml(rdffile, repo_name=book.repo_name)
             book.save()
         except IOError:
             print "couldn't read " + rdffile
             continue
         except Exception, e:
             print "processing " + rdffile
             raise e
         i += 1
         if count and i > count:
             break
         if i % 100 == 0:
             print str(i) + " files completed"
Ejemplo n.º 3
0
 def test_conversion(self):
     yaml = pg_rdf_to_yaml(TESTDATA_PGRDFFILENAME)
     open(TESTDATA_YAMLFILENAME, "w+").write(yaml)
     pandata = Pandata(TESTDATA_YAMLFILENAME)
     self.assertEqual(pandata._edition,'book')
     self.assertTrue(pandata.subjects[0][0] in ('lcsh','lcc'))
Ejemplo n.º 4
0
 def test_conversion(self):
     yaml = pg_rdf_to_yaml(TESTDATA_PGRDFFILENAME)
     open(TESTDATA_YAMLFILENAME, "w+").write(yaml)
     pandata = Pandata(TESTDATA_YAMLFILENAME)
     self.assertEqual(pandata._edition, 'book')
     self.assertTrue(pandata.subjects[0][0] in ('lcsh', 'lcc'))