@@ -56,20 +56,6 @@ def insert_book_to_notion(books, index, bookId):
56
56
readInfo .update (readInfo .get ("readDetail" , {}))
57
57
readInfo .update (readInfo .get ("bookInfo" , {}))
58
58
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
73
59
book ["阅读进度" ] = (
74
60
100 if (book .get ("markedStatus" ) == 4 ) else book .get ("readingProgress" , 0 )
75
61
) / 100
@@ -98,6 +84,20 @@ def insert_book_to_notion(books, index, bookId):
98
84
book ["开始阅读时间" ] = book .get ("beginReadingDate" )
99
85
book ["最后阅读时间" ] = book .get ("lastReadingDate" )
100
86
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
101
101
book ["书名" ] = book .get ("title" )
102
102
book ["BookId" ] = book .get ("bookId" )
103
103
book ["ISBN" ] = book .get ("isbn" )
@@ -129,8 +129,7 @@ def insert_book_to_notion(books, index, bookId):
129
129
if bookId in notion_books :
130
130
result = notion_helper .update_page (
131
131
page_id = notion_books .get (bookId ).get ("pageId" ),
132
- properties = properties ,
133
- icon = utils .get_icon (book .get ("封面" )),
132
+ properties = properties
134
133
)
135
134
else :
136
135
result = notion_helper .create_page (
0 commit comments