Skip to content

Commit 6d41a3b

Browse files
committed
Merge
2 parents eaa82bc + b76d3e8 commit 6d41a3b

File tree

8 files changed

+112
-109
lines changed

8 files changed

+112
-109
lines changed

game-programmer-zh-cn.dot

Lines changed: 95 additions & 95 deletions
Large diffs are not rendered by default.

images-zh-cn/csapp3.jpg

623 KB
Loading
-12.3 KB
Loading

images-zh-cn/math3dcpcg3.jpg

71.3 KB
Loading
10.2 KB
Loading

images-zh-cn/unityinaction.jpg

152 KB
Loading

isbn.csv

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ learntoprogramwithminecraft,9781593276706, 未找到中文, None
99
adventuresinminecraft,9781118946916, 零基础学Minecraft编程,9787115398970
1010
3dgpforkids,9781937785444, 未找到中文, None
1111
sicp2,9780262011532, 计算机程序的构造和解释,9787111135104
12-
csapp3,9780134092669, 深入理解计算机系统<br/>(原书第2版),9787111321330
12+
csapp3,9780134092669,深入理解计算机系统<br/>(原书第3版),9787111544937
1313
caaqa5,9780123838728, 计算机体系结构,9787115297655
1414
mos4,9780133591620, 现代操作系统(第3版),9787111255444
1515
clrs3,9780262033848, 算法导论(原书第3版),9787111407010
@@ -56,7 +56,7 @@ umldistilled3,9780321193681, UML精粹,9787121170492
5656
umluserguide2,9780321267979, UML用户指南,9787115148339
5757
ooadwa3,9780201895513, 面向对象分析与设计,9787121173899
5858
foundationsgedmath,9780985811747, 未找到中文, None
59-
math3dcpcg3,9781568817231, 3D数学基础,9787302109464
59+
math3dcpcg3,9781568817231,3D游戏与计算机图形学<br/>中的数学方法(第3版),9787302406228
6060
3dmathprimer2,9781435458864, 未找到中文, None
6161
essentialmaths3,9781482250923, 未找到中文, None
6262
geometricalgebra,9780123694652, 未找到中文, None
@@ -65,9 +65,9 @@ computationalgeometry,9783540779735, 计算几何,9787302199380
6565
visualizingquaternions,9780120884001, 未找到中文, None
6666
divgradcurl4,9780393925166, 散度、旋度、梯度释义,9787111501718
6767
windowsgp2,9780672323690, Windows游戏编程大师技巧,9787115292483
68-
gamecodingcomplete4,9781133776574, 游戏编程全接触,9787115132192
68+
gamecodingcomplete4,9781133776574,游戏编程权威指南,9787115410344
6969
introtogdprodev,9780321933164, 未找到中文, None
70-
unityinaction,9781617292323, 未找到中文, None
70+
unityinaction,9781617292323,Unity5实战,9787302436744
7171
learninguegd,1784398152, 未找到中文, None
7272
blueprintsvisualscripting,1785286013, 未找到中文, None
7373
cocos2dxbyexample2,9781785288852, 未找到中文, None
@@ -169,7 +169,7 @@ gameik,1484922328, 未找到中文, None
169169
physicsbasedanimation,9781584503804, 未找到中文, None
170170
rtcameras,9780123116345, 未找到中文, None
171171
physicsforgameprogrammers,9781590594728, 未找到中文, None
172-
physicsforgamedevelopers2,9781449392512, 未找到中文, None
172+
physicsforgamedevelopers2,9781449392512,游戏开发物理学 第2版,9787115384706
173173
physicsmodeling,9781592000937, 未找到中文, None
174174
gamephysicsenginedev2,9780123819765, 游戏物理引擎开发,9787302344568
175175
gamephysics2,9780123749031, 未找到中文, None

zh-cn.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ def get_image(isbn, image_filename):
2424
image = response.read()
2525
ft.write(image)
2626

27-
def get_book_url(isbn):
27+
def get_book_url_year(isbn):
2828
url = "https://api.douban.com/v2/book/isbn/" + isbn
29-
result = "https://book.douban.com/"
29+
result = "https://book.douban.com/", ""
3030
try:
3131
response = urllib2.urlopen(url)
3232
detail = response.read()
33-
return json.loads(detail)["alt"]
33+
return json.loads(detail)["alt"], json.loads(detail)["pubdate"][:4]
3434
except Exception as e:
3535
print isbn
3636
print e
@@ -46,13 +46,15 @@ def get_book_info(book_index):
4646
title = line[2].strip()
4747
zh_isbn = line[3]
4848
if title == "未找到中文":
49-
return None, None
49+
return None, None, None
5050
else:
5151
image_path = IMAGE_PATH.format(book_index=book_index.strip('"'))
5252

5353
if not os.path.exists(image_path):
5454
get_image(zh_isbn, image_path)
55-
return title, get_book_url(zh_isbn)
55+
book_url, book_year = get_book_url_year(zh_isbn)
56+
return title, book_url, book_year
57+
5658
LABEL_DICT = {
5759
"":"",
5860
"Recommended Path": "推荐路线",
@@ -129,13 +131,14 @@ def get_book_info(book_index):
129131
}
130132

131133
RE_BOOK_LINE = re.compile(r'^\"?\w*\"?\w* \[label=<<TABLE[\S ]* URL="https?:/{2}\w.+"]$')
132-
BOOK_LINE = '{book_index} [label=<<TABLE BORDER="0" CELLSPACING="0"><TR><TD WIDTH="100" HEIGHT="100" FIXEDSIZE="TRUE"><IMG SCALE="TRUE" SRC="{image_path}"/></TD></TR><TR><TD>{book_title}</TD></TR></TABLE>> URL="{url}"]\n'
134+
BOOK_LINE = '{book_index} [label=<<TABLE BORDER="0" CELLSPACING="0"><TR><TD WIDTH="100" HEIGHT="100" FIXEDSIZE="TRUE"><IMG SCALE="TRUE" SRC="{image_path}"/></TD></TR><TR><TD>{book_title}<br/>({book_year})</TD></TR></TABLE>> URL="{url}"]\n'
133135
RE_SECTION_LINE = re.compile(r'^label=<<TABLE BORDER="0" CELLPADDING="10"><TR><TD>\d+\.[\w. ()]*</TD></TR></TABLE>>$')
134136
SECTION_LINE = 'label=<<TABLE BORDER="0" CELLPADDING="10"><TR><TD>{section_title}</TD></TR></TABLE>>\n'
135137
RE_LABEL_LINE = re.compile(r'^\w+ \[label="[\w -=\./\\]*"\]$')
136138
LABEL_LINE = '{label_index} [label="{label}"]\n'
137139
RE_CONTENT_LINE = re.compile(r'[\w ]+\[color="#[\w]{6}", label=[<"]\d+\. [\w ()]+[">]\]')
138140

141+
139142
if __name__ == '__main__':
140143
with open("game-programmer.dot") as en_f, open("game-programmer-zh-cn.dot",'w') as zh_f:
141144
for line in en_f:
@@ -157,12 +160,12 @@ def get_book_info(book_index):
157160

158161
if book_line_match != None:
159162
book_index = line_without_space.split(" ")[0]
160-
book_title, book_url = get_book_info(book_index.strip('"'))
161-
if book_title == None or book_url == None:
163+
book_title, book_url, book_year = get_book_info(book_index.strip('"'))
164+
if book_title == None:
162165
zh_f.write(line)
163166
else:
164167
image_path = IMAGE_PATH.format(book_index=book_index.strip('"'))
165-
writeline = space_front+ BOOK_LINE.format(book_index=book_index, image_path=image_path, book_title=book_title, url=book_url)
168+
writeline = space_front+ BOOK_LINE.format(book_index=book_index, image_path=image_path, book_title=book_title, book_year=book_year, url=book_url)
166169
zh_f.write(writeline)
167170
elif section_line_match != None:
168171
sectionID = re.search(r'\d+\.', line_without_space).group()

0 commit comments

Comments
 (0)