Changeset View
Changeset View
Standalone View
Standalone View
src/fetch/scripts/dark_horse_comics.py
Context not available. | |||||
191 | Prints entry's XML content to stdout | 191 | Prints entry's XML content to stdout | ||
---|---|---|---|---|---|
192 | """ | 192 | """ | ||
193 | try: | 193 | try: | ||
194 | print nEntry.toxml() | 194 | print(nEntry.toxml()) | ||
195 | except: | 195 | except: | ||
196 | print sys.stderr, "Error while outputting XML content from entry to Tellico" | 196 | print(sys.stderr, "Error while outputting XML content from entry to Tellico") | ||
197 | 197 | | |||
198 | def printXMLTree(self): | 198 | def printXMLTree(self): | ||
199 | """ | 199 | """ | ||
200 | Outputs XML content to stdout | 200 | Outputs XML content to stdout | ||
201 | """ | 201 | """ | ||
202 | self.__collection.appendChild(self.__images) | 202 | self.__collection.appendChild(self.__images) | ||
203 | print XML_HEADER; print DOCTYPE | 203 | print(XML_HEADER); print(DOCTYPE) | ||
204 | print self.__root.toxml() | 204 | print(self.__root.toxml()) | ||
205 | 205 | | |||
206 | 206 | | |||
207 | class DarkHorseParser: | 207 | class DarkHorseParser: | ||
Context not available. | |||||
276 | f.write(img) | 276 | f.write(img) | ||
277 | f.close() | 277 | f.close() | ||
278 | except: | 278 | except: | ||
279 | print sys.stderr, "Error: could not write image into /tmp" | 279 | print(sys.stderr, "Error: could not write image into /tmp") | ||
280 | 280 | | |||
281 | b64data = (md5 + '.jpeg', base64.encodestring(img)) | 281 | b64data = (md5 + '.jpeg', base64.encodestring(img)) | ||
282 | 282 | | |||
Context not available. | |||||
285 | try: | 285 | try: | ||
286 | os.remove(imgPath) | 286 | os.remove(imgPath) | ||
287 | except: | 287 | except: | ||
288 | print sys.stderr, "Error: could not delete temporary image /tmp/%s.jpeg" % md5 | 288 | print(sys.stderr, "Error: could not delete temporary image /tmp/%s.jpeg" % md5) | ||
289 | 289 | | |||
290 | return b64data | 290 | return b64data | ||
291 | 291 | | |||
Context not available. | |||||
425 | return None | 425 | return None | ||
426 | 426 | | |||
427 | def halt(): | 427 | def halt(): | ||
428 | print "HALT." | 428 | print("HALT.") | ||
429 | sys.exit(0) | 429 | sys.exit(0) | ||
430 | 430 | | |||
431 | def showUsage(): | 431 | def showUsage(): | ||
432 | print "Usage: %s comic" % sys.argv[0] | 432 | print("Usage: %s comic" % sys.argv[0]) | ||
433 | sys.exit(1) | 433 | sys.exit(1) | ||
434 | 434 | | |||
435 | def main(): | 435 | def main(): | ||
Context not available. |