pyxunlei-for-nastool


Namepyxunlei-for-nastool JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/Dominique9898/pyxunlei-for-nastool
Summary基于Docker版本的迅雷API客户端,可作为NAStool的下载器插件使用
upload_time2024-12-22 10:04:44
maintainerNone
docs_urlNone
authordominikwei
requires_python<4.0,>=3.10
licenseNone
keywords xunlei download docker nastool nas
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyxunlei
基于Docker版本的[Xunlei API Client](https://github.com/cnk3x/xunlei),可作为 [NAStool](https://github.com/NAStool/nas-tools) 的下载器插件使用。

## 支持版本
python@3.10
迅雷Docker@3.21.0

# 创建虚拟环境并安装依赖
```bash
poetry shell
poetry install
```

## 使用方法
```python
from pyxunlei import XunleiClient

#  初始化时支持以下参数:
#  host (str): 域名或IP
#  port (int): 端口号
#  ssl (bool): 是否启动HTTPS
#  device_name (str): 设备名称,当同一个账号下绑定了多个远程迅雷,可指定设备名称,设备名称可在迅雷APP查看
#      例如:群晖-xunlei
#      device_name为空时使用第一个设备.
#  download_root_dir(str): 下载根目录的目录名称,可以在web页面上查看,如不填写则默认选择第一个(一般是迅雷下载)
xunlei_client = XunLeiClient(
        '192.168.1.21', 2345, device_name="群晖-xunlei-")

# 获取已完成任务列表
completed_tasks = xunlei_client.completed_tasks()

# 获取未完成任务列表
uncompleted_tasks = xunlei_client.uncompleted_tasks()

# 提交磁力链接
magnetic_link = "磁力链接"
sub_dir = "子目录"  # 为空时则不创建子目录
preprocess_file = xunlei_client.filter_file_by_size  # 指定预处理文件函数,可使用内置的filter_file_by_size过滤掉小于500M以及大于40G的文件
xunlei_client.download_magnetic(magnetic_link, sub_dir, preprocess_file)

# 提交种子链接
torrent_file_path = "your.torrent"  # 种子文件路径
xunlei_client.download_torrent(torrent_file_path, sub_dir, preprocess_file)

# 任务管理
task_id = "任务ID"  # 创建任务时会返回task_id

# 暂停任务
xunlei_client.pause_task(task_id)

# 开始/继续任务
xunlei_client.start_task(task_id)

# 删除任务
xunlei_client.delete_task(task_id)
```

## 注意事项
1. 需要先安装并运行 [Docker版迅雷](https://github.com/cnk3x/xunlei)
2. 默认使用admin/admin作为登录凭证,如有修改请更新代码中的认证信息
3. 可以拿来作为集成到NAStool下载器插件使用
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Dominique9898/pyxunlei-for-nastool",
    "name": "pyxunlei-for-nastool",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "xunlei, download, docker, nastool, nas",
    "author": "dominikwei",
    "author_email": "dominikwei9988@outlook.com",
    "download_url": "https://files.pythonhosted.org/packages/7f/80/e048c8a8f2d25fcb97206342c7dfea830237f1b6d9e2bb3d6588547dbdf5/pyxunlei_for_nastool-0.1.0.tar.gz",
    "platform": null,
    "description": "# pyxunlei\n\u57fa\u4e8eDocker\u7248\u672c\u7684[Xunlei API Client](https://github.com/cnk3x/xunlei)\uff0c\u53ef\u4f5c\u4e3a [NAStool](https://github.com/NAStool/nas-tools) \u7684\u4e0b\u8f7d\u5668\u63d2\u4ef6\u4f7f\u7528\u3002\n\n## \u652f\u6301\u7248\u672c\npython@3.10\n\u8fc5\u96f7Docker@3.21.0\n\n# \u521b\u5efa\u865a\u62df\u73af\u5883\u5e76\u5b89\u88c5\u4f9d\u8d56\n```bash\npoetry shell\npoetry install\n```\n\n## \u4f7f\u7528\u65b9\u6cd5\n```python\nfrom pyxunlei import XunleiClient\n\n#  \u521d\u59cb\u5316\u65f6\u652f\u6301\u4ee5\u4e0b\u53c2\u6570:\n#  host (str): \u57df\u540d\u6216IP\n#  port (int): \u7aef\u53e3\u53f7\n#  ssl (bool): \u662f\u5426\u542f\u52a8HTTPS\n#  device_name (str): \u8bbe\u5907\u540d\u79f0\uff0c\u5f53\u540c\u4e00\u4e2a\u8d26\u53f7\u4e0b\u7ed1\u5b9a\u4e86\u591a\u4e2a\u8fdc\u7a0b\u8fc5\u96f7\uff0c\u53ef\u6307\u5b9a\u8bbe\u5907\u540d\u79f0\uff0c\u8bbe\u5907\u540d\u79f0\u53ef\u5728\u8fc5\u96f7APP\u67e5\u770b\n#      \u4f8b\u5982\uff1a\u7fa4\u6656-xunlei\n#      device_name\u4e3a\u7a7a\u65f6\u4f7f\u7528\u7b2c\u4e00\u4e2a\u8bbe\u5907.\n#  download_root_dir(str): \u4e0b\u8f7d\u6839\u76ee\u5f55\u7684\u76ee\u5f55\u540d\u79f0\uff0c\u53ef\u4ee5\u5728web\u9875\u9762\u4e0a\u67e5\u770b\uff0c\u5982\u4e0d\u586b\u5199\u5219\u9ed8\u8ba4\u9009\u62e9\u7b2c\u4e00\u4e2a(\u4e00\u822c\u662f\u8fc5\u96f7\u4e0b\u8f7d)\nxunlei_client = XunLeiClient(\n        '192.168.1.21', 2345, device_name=\"\u7fa4\u6656-xunlei-\")\n\n# \u83b7\u53d6\u5df2\u5b8c\u6210\u4efb\u52a1\u5217\u8868\ncompleted_tasks = xunlei_client.completed_tasks()\n\n# \u83b7\u53d6\u672a\u5b8c\u6210\u4efb\u52a1\u5217\u8868\nuncompleted_tasks = xunlei_client.uncompleted_tasks()\n\n# \u63d0\u4ea4\u78c1\u529b\u94fe\u63a5\nmagnetic_link = \"\u78c1\u529b\u94fe\u63a5\"\nsub_dir = \"\u5b50\u76ee\u5f55\"  # \u4e3a\u7a7a\u65f6\u5219\u4e0d\u521b\u5efa\u5b50\u76ee\u5f55\npreprocess_file = xunlei_client.filter_file_by_size  # \u6307\u5b9a\u9884\u5904\u7406\u6587\u4ef6\u51fd\u6570\uff0c\u53ef\u4f7f\u7528\u5185\u7f6e\u7684filter_file_by_size\u8fc7\u6ee4\u6389\u5c0f\u4e8e500M\u4ee5\u53ca\u5927\u4e8e40G\u7684\u6587\u4ef6\nxunlei_client.download_magnetic(magnetic_link, sub_dir, preprocess_file)\n\n# \u63d0\u4ea4\u79cd\u5b50\u94fe\u63a5\ntorrent_file_path = \"your.torrent\"  # \u79cd\u5b50\u6587\u4ef6\u8def\u5f84\nxunlei_client.download_torrent(torrent_file_path, sub_dir, preprocess_file)\n\n# \u4efb\u52a1\u7ba1\u7406\ntask_id = \"\u4efb\u52a1ID\"  # \u521b\u5efa\u4efb\u52a1\u65f6\u4f1a\u8fd4\u56detask_id\n\n# \u6682\u505c\u4efb\u52a1\nxunlei_client.pause_task(task_id)\n\n# \u5f00\u59cb/\u7ee7\u7eed\u4efb\u52a1\nxunlei_client.start_task(task_id)\n\n# \u5220\u9664\u4efb\u52a1\nxunlei_client.delete_task(task_id)\n```\n\n## \u6ce8\u610f\u4e8b\u9879\n1. \u9700\u8981\u5148\u5b89\u88c5\u5e76\u8fd0\u884c [Docker\u7248\u8fc5\u96f7](https://github.com/cnk3x/xunlei)\n2. \u9ed8\u8ba4\u4f7f\u7528admin/admin\u4f5c\u4e3a\u767b\u5f55\u51ed\u8bc1\uff0c\u5982\u6709\u4fee\u6539\u8bf7\u66f4\u65b0\u4ee3\u7801\u4e2d\u7684\u8ba4\u8bc1\u4fe1\u606f\n3. \u53ef\u4ee5\u62ff\u6765\u4f5c\u4e3a\u96c6\u6210\u5230NAStool\u4e0b\u8f7d\u5668\u63d2\u4ef6\u4f7f\u7528\n```\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "\u57fa\u4e8eDocker\u7248\u672c\u7684\u8fc5\u96f7API\u5ba2\u6237\u7aef\uff0c\u53ef\u4f5c\u4e3aNAStool\u7684\u4e0b\u8f7d\u5668\u63d2\u4ef6\u4f7f\u7528",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/Dominique9898/pyxunlei-for-nastool",
        "Repository": "https://github.com/Dominique9898/pyxunlei-for-nastool"
    },
    "split_keywords": [
        "xunlei",
        " download",
        " docker",
        " nastool",
        " nas"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "16bde9bc301c89424a14bbc6e779d58b54b4a1af2cc5263e9a196aaa054eaa99",
                "md5": "9d24bc34221b6240c7ea05fe8cf9a8a9",
                "sha256": "3658885b0c949a79bbdb90003ea16c887109b32557d279a8b330bb7729f78211"
            },
            "downloads": -1,
            "filename": "pyxunlei_for_nastool-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9d24bc34221b6240c7ea05fe8cf9a8a9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 9266,
            "upload_time": "2024-12-22T10:04:43",
            "upload_time_iso_8601": "2024-12-22T10:04:43.234335Z",
            "url": "https://files.pythonhosted.org/packages/16/bd/e9bc301c89424a14bbc6e779d58b54b4a1af2cc5263e9a196aaa054eaa99/pyxunlei_for_nastool-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7f80e048c8a8f2d25fcb97206342c7dfea830237f1b6d9e2bb3d6588547dbdf5",
                "md5": "2d37a1e6df77ed752bb373fbf7d625a9",
                "sha256": "8801d9d46dddf2c9cece3ea524f84e6b63b409d85d2cf154cf06444791844c35"
            },
            "downloads": -1,
            "filename": "pyxunlei_for_nastool-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2d37a1e6df77ed752bb373fbf7d625a9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 9174,
            "upload_time": "2024-12-22T10:04:44",
            "upload_time_iso_8601": "2024-12-22T10:04:44.724339Z",
            "url": "https://files.pythonhosted.org/packages/7f/80/e048c8a8f2d25fcb97206342c7dfea830237f1b6d9e2bb3d6588547dbdf5/pyxunlei_for_nastool-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-22 10:04:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Dominique9898",
    "github_project": "pyxunlei-for-nastool",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pyxunlei-for-nastool"
}
        
Elapsed time: 0.35487s