@@ -56,20 +56,6 @@ def insert_book_to_notion(books, index, bookId):
5656 readInfo .update (readInfo .get ("readDetail" , {}))
5757 readInfo .update (readInfo .get ("bookInfo" , {}))
5858 book .update (readInfo )
59- cover = book .get ("cover" )
60- if cover .startswith ("http" ):
61- if not cover .endswith (".jpg" ):
62- cover = utils .upload_cover (cover )
63- else :
64- cover = cover .replace ("/s_" , "/t7_" )
65- else :
66- cover = BOOK_ICON_URL
67- isbn = book .get ("isbn" )
68- if isbn and isbn .strip ():
69- douban_url = get_douban_url (isbn )
70- if douban_url :
71- book ["douban_url" ] = douban_url
72- book ["封面" ] = cover
7359 book ["阅读进度" ] = (
7460 100 if (book .get ("markedStatus" ) == 4 ) else book .get ("readingProgress" , 0 )
7561 ) / 100
@@ -98,6 +84,20 @@ def insert_book_to_notion(books, index, bookId):
9884 book ["开始阅读时间" ] = book .get ("beginReadingDate" )
9985 book ["最后阅读时间" ] = book .get ("lastReadingDate" )
10086 if bookId not in notion_books :
87+ cover = book .get ("cover" )
88+ if cover .startswith ("http" ):
89+ if not cover .endswith (".jpg" ):
90+ cover = utils .upload_cover (cover )
91+ else :
92+ cover = cover .replace ("/s_" , "/t7_" )
93+ else :
94+ cover = BOOK_ICON_URL
95+ book ["封面" ] = cover
96+ isbn = book .get ("isbn" )
97+ if isbn and isbn .strip ():
98+ douban_url = get_douban_url (isbn )
99+ if douban_url :
100+ book ["douban_url" ] = douban_url
101101 book ["书名" ] = book .get ("title" )
102102 book ["BookId" ] = book .get ("bookId" )
103103 book ["ISBN" ] = book .get ("isbn" )
@@ -129,8 +129,7 @@ def insert_book_to_notion(books, index, bookId):
129129 if bookId in notion_books :
130130 result = notion_helper .update_page (
131131 page_id = notion_books .get (bookId ).get ("pageId" ),
132- properties = properties ,
133- icon = utils .get_icon (book .get ("封面" )),
132+ properties = properties
134133 )
135134 else :
136135 result = notion_helper .create_page (
0 commit comments