从web服务中提取书目信息
biblio.webquer的Python项目详细描述
简介
这个包提供了许多查询web服务的方法 书目信息,包括两个用于查询和重命名的脚本 ISBN提供的文件。
安装
biblio.webquery[1]可以通过多种方式安装。 首选setuptools[2],但手动安装将 够了。
通过设置工具/简易安装
从命令行调用:
% easy_install biblio.webquery
可能需要超级用户权限。
通过setup.py
下载源tarball,解包并调用setup.py 安装:
% tar zxvf biblio.webquery.tgz % cd biblio.webquery % python setup.py install
可能需要超级用户权限。
用法
根据您的平台,脚本可以安装为.py脚本, 或者某种形式的可执行文件,或者两者兼而有之。
查询sbn
从webservices返回所提供isbn的书目信息。
queryisbn.py [options] ISBNs ...
有以下选项:
--version | show program’s version number and exit |
-h, --help | show this help message and exit |
--debug | For errors, issue a full traceback instead of just a message. |
-s SERVICE, --service=SERVICE | |
The webservice to query. Choices are xisbn (WorldCat xISBN), isbndb (ISBNdb). The default is xisbn. | |
-k KEY, --key=KEY | |
The access key for the webservice, if one is required. |
例如:
% queryisbn.py 1568385048 1564145026 1568385048: title: Drop the rock : removing character defects authors: [Bill Pittman, Todd Weber] publisher: Hazelden year: 1999 lang: eng 1564145026: title: Stop clutter from stealing your life : discover why you clutter and how you can stop authors: [Mike Nelson] publisher: New Page Books year: 2001 lang: eng % /queryisbn.py --debug -s isbndb -k OPNH8HG2 1568385048 1564145026 1568385048: title: Drop the Rock: Removing Character Defects authors: [Bill Pittman, Todd Weber] 1564145026: authors: [Mike Nelson]
重命名bysbn
从文件名中提取ISBN,查找相关书目 Web服务中的信息并相应地重命名文件。
renamebyisbn.py [options] FILES ...
有以下选项:
--version | show program’s version number and exit |
-h, --help | show this help message and exit |
--debug | For errors, issue a full traceback instead of just a message. |
-s SERVICE, --service=SERVICE | |
The webservice to query. Choices are xisbn (WorldCat xISBN), isbndb (ISBNdb). The default is xisbn. | |
-k KEY, --key=KEY | |
The access key for the webservice, if one is required. | |
-c CASE, --case=CASE | |
Case conversion of the new file name. Choices are orig, upper, lower.The default is orig. | |
--leave_whitespace | |
Leave excess whitespace. By default, consecutive spaces in names are compacted | |
--replace_whitespace=REPLACE_WHITESPACE | |
Replace whitespace in the new name with this string. | |
--strip_chars=STRIP_CHARS | |
Remove these characters from the new name. By default this are ‘:!,’”.?()’. | |
--overwrite | Overwrite existing files. |
--dryrun | Check function and without renaming files. |
--template=TEMPLATE | |
The form to use for renaming the file. The fields recognised are auth (primary authors family name), title (full title of the book), short_title (abbreviated title), isbn, year (year of publication). The default is ‘%(auth)s%(year)s_%(short_title)s_(isbn%(isbn)s)’. | |
--unknown=UNKNOWN | |
Use this string if value is undefined. |
在各种处理选项被 应用。按顺序,从名称中去掉字符,多余的空格是 折叠,然后应用大小写转换。我们建议你试试干跑 在重命名任何文件之前。文件扩展名(如果有)在重命名之前被删除,然后重新应用。
例如,使用名为“0763718165.jones course.djvu”、“helm_0671708821(orig.pdf”、“tutor_9780198568322.rar”、“unce.9783540237730.27380.pdf”的4个文件:
% renamebyisbn.py --dryrun books/* Original books/0763718165.Jones Course.djvu ... ~ extracted ISBN 0763718165 ... ~ found Andersen - Data structures in Java : a laboratory course ~ new name Andersen2001_Data structures in Java_isbn0763718165. ~ new path books/Andersen2001_Data structures in Java_isbn0763718165.djvu. Original books/helm_0671708821 (orig).pdf ... ~ extracted ISBN 0671708821 ... ~ found Helmstetter - What to say when you talk about yourself. ~ new name Helmstetter1990_What to say when you talk about yourself_isbn0671708821. ~ new path books/Helmstetter1990_What to say when you talk about yourself_isbn0671708821.pdf. Original books/tutor_9780198568322.rar ... ~ extracted ISBN 9780198568322 ... ~ found Skilling - Data analysis : a Bayesian tutorial ; [for scientists and engineers] ~ new name Skilling2006_Data analysis_isbn9780198568322. ~ new path books/Skilling2006_Data analysis_isbn9780198568322.rar. Original books/unce.9783540237730.27380.pdf ... ~ extracted ISBN 9783540237730 ... ~ found McDaniel - Uncertainty and surprise in complex systems questions on working with the unexpected ~ new name McDaniel2005_Uncertainty and surprise in complex systems questions on working with the unexpected_isbn9783540237730. ~ new path books/McDaniel2005_Uncertainty and surprise in complex systems questions on working with the unexpected_isbn9783540237730.pdf. % renamebyisbn.py --case lower --replace_whitespace ' ' --template '%(auth)s%(year)s_%(short_title)s_isbn%(isbn)s' books/* Original books/0763718165.Jones Course.djvu ... ~ extracted ISBN 0763718165 ... ~ found Andersen - Data structures in Java : a laboratory course ~ new name andersen2001_data-structures-in-java_isbn0763718165. ~ new path books/andersen2001_data-structures-in-java_isbn0763718165.djvu. ~ renaming file Original books/helm_0671708821 (orig).pdf ... ~ extracted ISBN 0671708821 ... ~ found Helmstetter - What to say when you talk about yourself. ~ new name helmstetter1990_what-to-say-when-you-talk-about-yourself_isbn0671708821. ~ new path books/helmstetter1990_what-to-say-when-you-talk-about-yourself_isbn0671708821.pdf. ~ renaming file Original books/tutor_9780198568322.rar ... ~ extracted ISBN 9780198568322 ... ~ found Skilling - Data analysis : a Bayesian tutorial ; [for scientists and engineers] ~ new name skilling2006_data-analysis_isbn9780198568322. ~ new path books/skilling2006_data-analysis_isbn9780198568322.rar. ~ renaming file Original books/unce.9783540237730.27380.pdf ... ~ extracted ISBN 9783540237730 ... ~ found McDaniel - Uncertainty and surprise in complex systems questions on working with the unexpected ~ new name mcdaniel2005_uncertainty-and-surprise-in-complex-systems-questions-on-working-with-the-unexpected_isbn9783540237730. ~ new path books/mcdaniel2005_uncertainty-and-surprise-in-complex-systems-questions-on-working-with-the-unexpected_isbn9783540237730.pdf. ~ renaming file
开发人员注释
webquery提供了几个对其他开发人员可能有用的类:
* BaseWebQuery, a simple class for encapsulating queries to webservices * BaseKeyedWebQuery, ditto except allowing for access keys * XisbnQuery and IsbndbQuery, for fetching bibliographic information from Worldcat xISBN and ISBNdb services respectively * QueryThrottle, for limiting the frequency or total number of service queries. * BibRecord, a general class for holding bibliographic information * PersonalName, a class for holding a name along functions for parsing names into this class.
有关更多信息,请参阅api文档和脚本。
塔诺斯·瓦西拉基斯(thanosvasilakis)发布了一个类似a very useful module的内容,供isbn查询。不管怎么看 从自己的网站上消失了。
biblio命名空间对其他开发人员开放。
历史记录
V0.4.3b,2009年5月7日
- 在源代码分发中包含文档。
V0.4b,2009-05-06
- 首次公开发行。