#!/usr/bin/env python
# coding=utf-8
#
# Author: Archer Reilly
# Date: 23/Dec/2015
# File: StaticMongo.py
# Desc: find which books isnt in the mongo
#
# Produced By BR
from Utility import loadMatrixFromFile, appendMatrixToFileUtf
from IsbnCheckIn import IsbnCheckIn

filename = '/home/archer/Downloads/data.csv'
mat = loadMatrixFromFile(filename)
i = IsbnCheckIn('192.168.100.2', 27017)
Res = [] # store not ins

for row in mat:
    if not i.isIn(row[1]):
        print row[1], "not in database"
        Res.append(row)

appendMatrixToFileUtf('NotFound.csv', Res)
#!/usr/bin/env python
# coding=utf-8
# Author: Archer Reilly
# File: GetBookInfos.py
# Desc: get books information from the static html files, esp kaijuan
# Date: 23/Dec/2015
#
# Produced By BR
from Utility import appendMatrixToFileUtf
from StaticHtmlParser import StaticHtmlParser

for i in range(1, 485):
    print "Processing: ", i
    s = StaticHtmlParser('/home/archer/Downloads/htmls/' + str(i) + '.html')
    mat = s.getBookInfos()

    #print mat
    appendMatrixToFileUtf('./data.csv', mat)