boardgamegeek.com的命令行界面

bggcli的Python项目详细描述


https://travis-ci.org/syllant/bggcli.svg?branch=masterhttps://coveralls.io/repos/syllant/bggcli/badge.svg?branch=master

简介

bggcli是一个命令行接口,为 BoardGameGeek(又名bgg)。它依赖于web ui而不是 official API不提供所有可用功能。

此时只执行3个操作:

  • 从csv文件批量导入/更新游戏集合
  • 从csv文件大容量删除
  • 批量导出为CSV文件,带有版本信息(默认导出中缺少游戏版本)

警告:

  • Use it at your own risks, you may damage your game collection by doing mistakes! Ensure you have a backup of you collection first!
  • This tool is not supported by BoardGameGeek, this is an independent development
  • Be respectful regarding BGG web site: this kind of automated tools can impact performance when used “aggressively” (plenty of requests per second). Provided features are intended to be used for one-shot needs. Also they rely on a real web browser, and should conform with their Terms of Services

安装

Python2.7是必需的。

pip install bggcli

用法

您需要firefox才能安装;firefox将由bggcli自动控制以执行操作 (通过硒库)。

键入bggcli获取有关可用命令的完整帮助。

下面是从帐户account1导出集合并将其导入到另一个帐户account2的示例:

$ bggcli -l mylogin1 -p mypassword1 collection-export mycollection.csv
$ bggcli -l mylogin2 -p mypassword2 collection-import mycollection.csv

更新集合

以下是此操作可用于的一些用例:

  • 在BGG上创建新帐户并转移您的托收:首先从旧帐户导出托收,然后使用 bggcli导入它
  • 对所有或部分游戏进行批量更新:首先从帐户导出集合,在中修改详细信息 csv文件(使用文本编辑器、openoffice、ms-excel或其他工具)并使用bggcli导入文件

导出应使用此工具完成。你也可以在网上手动导出,但你不会有 关于每个游戏版本的信息。

示例:

$ bggcli -l mylogin -p mypassword collection-import mycollection.csv

注意:

  • Column names are those exported by BGG. Any column not recognized will just be ignored
  • When a game already exists in your collection, game is updated with provided CSV values only, other fields are not impacted. You could only update one field for all your game.
  • Games are identified by their internal ID, named ^{tt5}$ in CSV file (name used by BGG). Having the ^{tt6}$ field (name of the game) is also recommended for logging.

从收藏中删除游戏

目标是从您的收藏中删除CSV文件中标识的所有游戏,您将提供作为输入。

示例:

$ bggcli -l mylogin -p mypassword collection-delete mycollection.csv

注意:

  • Only the ^{tt5}$ column will be used for this operation: this is the internal ID managed by BGG. All other columns will just be ignored.

导出集合

将创建一个包含所有游戏的csv文件,就像使用ui一样。

示例:

$ bggcli -l mylogin -p mypassword collection-export mycollection.csv

注意:

  • Only the ^{tt5}$ column will be used for this operation: this is the internal ID managed by BGG. All other columns will just be ignored.

限制

  • 只支持Firefox这些工具依赖于selenium来控制浏览器,并且只支持firefox 硒的开箱即用(即无附加要求)。可以引入对其他浏览器的支持, 但我不确定是否值得。
  • 性能:selenium+firefox关联不是自动化操作的最快方式,但是 在稳定性(没有javascript仿真,firefox可以工作)和简单性(不需要 安装其他任何东西),这在当前上下文中是最重要的。在我的笔记本电脑上,我看到了 1分钟打5场比赛。
  • bgg不导出与游戏版本相关的一些字段:barcode语言`。注意 虽然这只适用于您定义自己的自定义版本,但这应该非常罕见。

对未来版本的想法

以下是一些可以执行的附加任务的想法:

  • 集合的通用导入,基于游戏名称而不是BGG内部标识符。确认是 每一个模棱两可的名字都需要在bgg提供的匹配游戏中进行选择
  • 更新/删除播放内容
  • 更新/删除论坛订阅

最后说明

它真的值得这样的发展吗?可能不是,但我的第二个目标是发现python生态系统!

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Java:字符串。RTL设备语言用标志“+”格式化,数字后加符号   java GAE作为桌面应用程序(Swing)的服务提供商   java将InputStream转换为FileInputStream不适用于Apache POI   java外部Voronoi库“网格”:什么是草图和处理?   重载重写的泛型方法java   java显示组织上设置的错误。springframework。验证。jsp中的错误对象   java一些Spring模型属性没有显示在我的JSP中   java无法编译Guava 23的SimpleTimeLimiter示例   java如何更改JTree中的“根”目录名?   java如何在安卓中对相对布局产生连锁反应?   java错误:org。冬眠例外SQLGrammarException:无法提取结果集,dateAccessed是未知列   如何使用java监听JSON文件更新   由抽象封闭类创建的匿名内部类能否通过反射确定实现类?