示例#1
0
文件: write.py 项目: TwinIsland/CTD
#encoding:utf-8

# https://ctd-1257758577.cos.ap-guangzhou.myqcloud.com/data/

import library
import json

with open('sj.json','r', encoding='utf-8',errors='ignore') as f:
    data = f.read()


datas = json.loads(data)
api = 'https://ctd-1257758577.cos.ap-guangzhou.myqcloud.com/data/诗经/'
library = library.library()

id = 28765

for i in range(id,id+len(datas)):
    re = [i,'诗经:' + datas[i-id]['title'],'诗经',datas[i-id]['section'],api+datas[i-id]['title'] + '.txt']
    print(re)
    library.addBook(re)
library.save_change()
示例#2
0
import library
import sqlite3

library = library.library()

conn = sqlite3.connect('ctd.db')
c = conn.cursor()

books = c.execute('''SELECT * FROM ctb''')

id = 0

for book in books:
    id += 1
    book = list(book)
    for element in range(len(book)):
        if book[element] == None:
            book[element] = 'unknown'
    print(book)

    library.addBook([id, book[0], book[1], book[2], book[3]])
library.save_change()
示例#3
0
文件: test.py 项目: keving/boostplay
               ("books_stored", c_int)]

new_book = CBook("Harry Potter", "Children", "JK Rowling", 345)

print (new_book.book_name)

lib = CLibrary(books_stored=0)

print(lib)

print("Books stored in lib = %d" % lib.books_stored)



result = c_int()
result = library.addBook(addressof(lib), "Harry Aotter", "Ahildren", "JK Rowling", 345)
result = library.addBook(addressof(lib), "Harry Botter", "Bhildren", "JK Rowling", 345)
result = library.addBook(addressof(lib), "Harry Cotter", "Children", "JK Rowling", 345)
result = library.addBook(addressof(lib), "Harry Dotter", "Dhildren", "JK Rowling", 345)
result = library.addBook(addressof(lib), "Harry Eotter", "Ehildren", "JK Rowling", 345)
result = library.addBook(addressof(lib), "Harry Fotter", "Fhildren", "JK Rowling", 345)
result = library.addBook(addressof(lib), "Harry Gotter", "Ghildren", "JK Rowling", 345)
result = library.addBook(addressof(lib), "Harry Hotter", "Hhildren", "JK Rowling", 345)

print("I am here")
result = library.addBook(addressof(lib), "Lost", "Adult", "Damian ", 111)

print(result)
print("Done")

for i in range(lib.books_stored):
示例#4
0
文件: clean.py 项目: TwinIsland/CTD
        book = i.split('\\')[-2] + '-' + book

    book = book.replace('TXT', 'txt')
    book = book.replace('黄金书屋---', '')
    addr = parent + '/' + book
    print(parent + '/' + book)
    result.append(addr)

files = result

print(len(files))

print('==================')

api = 'https://ctd-1257758577.cos.ap-guangzhou.myqcloud.com/data/201966/'
# example: 'E:\GFEC - Global Free Education Center\我的掌上书库\古典文学\易学书籍\象数\周易卦象\\周易卦象-离.txt'

library = library.library()

cid = 28007

for i in range(cid, cid + len(files)):
    book = files[i - cid]
    bookURL = api + book.split('我的掌上书库\\')[1].replace('\\', '/').replace(
        '//', '/')
    bookName = book.split('/')[-1][:-4]
    print(bookName)
    print(bookURL)
    library.addBook([i, bookName, 'unknown', 'unknown', bookURL])

library.save_change()