def author(self, irc, msg, args, optlist, author): """[--url] <author> Returns a list of books written by the given author. If --url is specified, a link to amazon.com's page for the book will also be returned. """ url = False for (option, argument) in optlist: if option == 'url': url = True attribs = {'ProductName' : 'title', 'Manufacturer' : 'publisher', 'Authors' : 'author', 'OurPrice' : 'price', 'URL' : 'url' } s = '%(title)s, written by %(author)s; published by ' \ '%(publisher)s; price: %(price)s%(url)s' channel = msg.args[0] region = self.registryValue('region', channel) bold = self.registryValue('bold', channel) try: books = amazon.searchByAuthor(author, locale=region) res = self._genResults(s, attribs, books, url, bold) if res: irc.reply(format('%L', res)) return except amazon.AmazonError, e: pass
def author(self, irc, msg, args, optlist, author): """[--url] <author> Returns a list of books written by the given author. If --url is specified, a link to amazon.com's page for the book will also be returned. """ url = False for (option, argument) in optlist: if option == 'url': url = True attribs = { 'ProductName': 'title', 'Manufacturer': 'publisher', 'Authors': 'author', 'OurPrice': 'price', 'URL': 'url' } s = '%(title)s, written by %(author)s; published by ' \ '%(publisher)s; price: %(price)s%(url)s' channel = msg.args[0] region = self.registryValue('region', channel) bold = self.registryValue('bold', channel) try: books = amazon.searchByAuthor(author, locale=region) res = self._genResults(s, attribs, books, url, bold) if res: irc.reply(format('%L', res)) return except amazon.AmazonError, e: pass
searchMode = "books" if (searchLocale != "us"): searchMode = "books-" + searchLocale for searchField in fields: if (searchLocale != "" and searchField != ""): collection = doc.createElement ("List") collection.setAttribute ("name", "Amazon Import") root.appendChild (collection) pythonBooks = None; if searchField == "authors": pythonBooks = amazon.searchByAuthor (query, locale=searchLocale, mode=searchMode) elif searchField == "asin": pythonBooks = amazon.searchByASIN (query, locale=searchLocale, mode=searchMode) elif searchField == "upc": pythonBooks = amazon.searchByUPC (query, locale=searchLocale, mode=searchMode) else: pythonBooks = amazon.searchByKeyword (query, locale=searchLocale, mode=searchMode) for book in pythonBooks: bookElement = doc.createElement ("Book") bookElement.setAttribute ("title", book.ProductName) for key in fieldMap.keys(): name = fieldMap[key] if name == None: