Coder Social home page Coder Social logo

ludoux / qbittorrent-torrents-exporter Goto Github PK

View Code? Open in Web Editor NEW
119.0 1.0 1.0 329 KB

qBittorrent 种子文件导出小工具 | Export torrent files from BT_backup and append "missing" trackers.

License: GNU General Public License v3.0

Go 100.00%
qbittorrent torrent

qbittorrent-torrents-exporter's Introduction

qbittorrent-torrents-exporter GitHub release (latest by date)

本工具需要Web API 功能打开的运行中的 qbittorrent 客户端和其配套的 BT_backup 文件夹

本工具用于从 BT_backup 中导出 torrent 文件并重命名,并基于 Web API 来支持对 tracker、标签、分类、保存路径等筛选导出。同时针对 qbittorrent 4.4.x 版本会将 tracker 信息从 .torrent 文件中移除一改变,工具支持自动从 .fastresume 文件中读取并还原进导出的 .torrent 文件。

请确保 BT_backup 文件夹(内含 .torrent 和 .fastresume 文件)与本工具处在同一目录下 (如下图示意) ,导出的种子文件将会在新建的名为 export 的文件夹内。

相对位置示意

默认 BT_backup 文件夹地址 (inspired from jslay88/qbt_migrate):

  • Windows: %LOCALAPPDATA%/qBittorrent/BT_backup
  • Linux/Mac: $HOME/.local/share/data/qBittorrent/BT_backup

This tool need a running qbittorrent program with its Web API supported and its BT_backup folder.

It can help you export torrent files from BT_backup and automatically rename them, with tracker/tag/category/path-filter supported. Besides, it can automatically append missing trackers into exported .torrent file as qbittorrent 4.4.x will remove tracker information from .torrent file.

Please make sure the BT_backup folder(.torrent and .fastresume files) is under the same folder with exporter, and the exported torrent files will in a new-create folder named export.

Default BT_backup paths (inspired from jslay88/qbt_migrate):

  • Windows: %LOCALAPPDATA%/qBittorrent/BT_backup
  • Linux/Mac: $HOME/.local/share/data/qBittorrent/BT_backup

使用方法 | How to use

Download the bianary (no Go environment needed) in releases page

导出目录 | Exported Path: export/<path>/<trackerhost>/<category>/

导出文件名 | Exported Filename: [<tags>][<state>]<name>.torrent

纯参数运行 | Running with arguments only

参数名 解释 示例
qh *qBittorrent Host Url (Web API) -qh "http://127.0.0.1:6363"
qu 登录用户名 | qBittorrent Username -qu "admin"
qp 登录密码 | qBittorrent Password -qp "password"
fc 需要导出的分类(留空全导出) | Categories to be exported(Stay blank to export all) -fc "cate1,cate2" or -fc ""
fp 需要导出的保存路径(留空全导出) | SavePaths to be exported(Stay blank to export all) -fp "path1,path2" or -fp ""
ft 需要导出的标签(留空全导出) | Tag to be exported(Stay blank to export all) -ft "tag1,tag2" or -ft ""
fth 需要导出的tracker(留空全导出) | Tracker to be exported(Stay blank to export all) -fth "leech.com,club.net" or -fth ""
at 将导出的任务打上此标签名(留空不打) | Tag exported torrent task(Stay blank to not tag) -at "exported" or -at ""
githubchannel Force to use github channel to check update instead of using gitee channel -githubchannel
❯ ./qbittorrent-torrents-exporter -h
Usage of ./main:
  -at string
        AppendTag (default "-")
  -fc string
        CategoryFilter (default "-")
  -fp string
        PathFilter (default "-")
  -ft string
        TagFilter (default "-")
  -fth string
        TrackerHostFilter (default "-")
  -githubchannel
        Force to use github channel to check update instead of gitee channel.
  -qh string
        qBittorrent host. ex: http://127.0.0.1:6363
  -qp string
        qBittorrent password.
  -qu string
        qBittorrent usrname.

PS: 如果不传入 qh 参数,则会使用引导交互来在终端输入登录信息等;如果不传入 fc fp ft fth at 中任一参数,则会使用交互引导来在终端输入筛选信息等。

PS: If qh is unset, tool will ask users to give login information. If fc fp ft fth and at are all unset, tool will ask users to give filter information.

Examples

❯ ./qbittorrent-torrents-exporter -qh "http://127.0.0.1:8080"
❯ ./qbittorrent-torrents-exporter -qh "http://127.0.0.1:8080" -qu "admin" -qp "adminadmin"
❯ ./qbittorrent-torrents-exporter -qh "http://127.0.0.1:8080" -qu "admin" -qp "adminadmin" -fc "cate_needed_to_export"
❯ ./qbittorrent-torrents-exporter -qh "http://127.0.0.1:8080" -qu "admin" -qp "adminadmin" -fc "cate_needed_to_export" -at "exported"

交互式运行 | Running directly

不传递任何参数或者只传递 -githubchannel 参数,软件则会以交互方式让用户提供相关信息。

Tool will ask users to provide information if all arguments are unset or only -githubchannel is set.

截图 | Screenshots

qbittorrent-torrents-exporter's People

Contributors

ludoux avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

griffin641498

qbittorrent-torrents-exporter's Issues

panic: runtime error: index out of range [0] with length 0

github.com/ludoux/qbittorrent-torrents-exporter v0.3.5
New version found!
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
main.genMap({0xc000010200, 0x1a}, {0x0, 0x0}, {0x0, 0x0})
/github/workspace/main.go:152 +0xbaf
main.main()
/github/workspace/main.go:623 +0x81e

1234

panic: runtime error: index out of range [8] with length 0

使用 v0.3.3 报错:

PS D:\qb> D:\qb\qbittorrent-torrents-exporter.exe
github.com/ludoux/qbittorrent-torrents-exporter v0.3.1
qBittorrent host url(ex http://127.0.0.1:6363 ):http://****
qBittorrent username:****
qBittorrent password:****
panic: runtime error: index out of range [8] with length 0

goroutine 1 [running]:
main.getTrackerHost({0xc000278b40, 0x82})
        /github/workspace/main.go:82 +0x6b0
main.genMap({0xc000014160, 0x1a}, {0xc00000e110, 0xf}, {0xc000016078, 0x12})
        /github/workspace/main.go:170 +0x6fd
main.main()
        /github/workspace/main.go:573 +0x45e

#10 (comment)

代码定位:

tmpHost = matchs[i]

目前进展:

0.3.4 新引进的 Debug 输出有点问题,目前还不能定位情况。后续发版 0.3.5 修订一下

怀疑:

  1. tracker 有没有考虑到的情况,致使 getTrackerHost 分析出问题

Linux运行报错

运行说明

  • 程序目录放置正确
  • qbi版本:4.4.2,满足要求

报错说明

使用命令./qbittorrent-torrents-exporter -qh "http://192.168.2.6:8080" -qu "admin" -qp "********" -githubchannel,后出现以下错误

github.com/ludoux/qbittorrent-torrents-exporter v0.1.5
New version found!
get torrents: 1~100
get torrents: 101~118
panic: runtime error: index out of range [-1]

goroutine 1 [running]:
main.getTrackerHost({0xc0004312c0, 0x2a})
        /github/workspace/main.go:70 +0x205
main.genMap({0x7ffe3c555d4d, 0x17}, {0x7ffe3c555d69, 0x5}, {0x7ffe3c555d73, 0xa})
        /github/workspace/main.go:130 +0x6da
main.main()
        /github/workspace/main.go:509 +0x45e

exported .torrent naming scheme

Current behavior:

  • exported .torrent files for torrents with single files in them (not containing any directory structure) are named without corresponding extensions.

Example
torrent with only one file "linux.iso"
is exported as:
/export/path/category/[tag]Linux.torrent

actually should be named:
/export/path/categgory/[tag]Linux.iso.torrent
as this is the full name in the torrent info

 "info" : {
  "length" : 12345678,
  "name" : "Linux.iso"

panic: runtime error: index out of range [0] with length 0

I type in the webui address ---> enter username and password

Terminal error:

panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
main.genMap({0xc00009a590, 0xe}, {0xc00009a5c0, 0x5}, {0xc00009a5e8, 0x6})
/github/workspace/main.go:142 +0xb5b
main.main()
/github/workspace/main.go:573 +0x45e

运行程序报错

使用目前最新版程序,运行如下:

PS D:\qb> D:\qb\qbittorrent-torrents-exporter.exe
github.com/ludoux/qbittorrent-torrents-exporter v0.3.1
qBittorrent host url(ex http://127.0.0.1:6363 ):http://****
qBittorrent username:****
qBittorrent password:****
panic: runtime error: index out of range [8] with length 0

goroutine 1 [running]:
main.getTrackerHost({0xc000278b40, 0x82})
        /github/workspace/main.go:82 +0x6b0
main.genMap({0xc000014160, 0x1a}, {0xc00000e110, 0xf}, {0xc000016078, 0x12})
        /github/workspace/main.go:170 +0x6fd
main.main()
        /github/workspace/main.go:573 +0x45e

使用 #4 (comment) 这里的debug程序,运行如下:

PS D:\qb> D:\qb\debug1.exe
github.com/ludoux/qbittorrent-torrents-exporter v0.2.1
New version found!
qBittorrent host url(ex http://127.0.0.1:6363 ):http://****
qBittorrent username:****
qBittorrent password:****
get torrents: 1~100

……(注:都显示finished)

get torrents: 101~200

……(注:都显示finished)

==** [DHT] **|** [PeX] **|** [LSD] **|https://tracker.*****.pt/announce.php?passkey=***==
err: matchs empty. trackers is ** [DHT] **|** [PeX] **|** [LSD] **|https://tracker.***********.pt/announce.php?passkey=******
panic: runtime error: index out of range [8] with length 0 

goroutine 1 [running]:
main.getTrackerHost({0xc0000b0070, 0x70})
        /home/luu/Documents/Git/qbittorrent-torrents-exporter/main.go:81 +0x7f0
main.genMap({0xc000010160, 0x1a}, {0xc00000a130, 0xf}, {0xc000012078, 0x12})
        /home/luu/Documents/Git/qbittorrent-torrents-exporter/main.go:170 +0x6da
main.main()
        /home/luu/Documents/Git/qbittorrent-torrents-exporter/main.go:569 +0x45e

有两个tracker的导入到qbit只有一个

如图,图下面的才是正常的种子,
This is an image
原本是ipv4加ipv6的tracker,导入到qbit网页端后就只显示一个ipv6了,但动漫花园之类的一个tracker的种子就是正常的

不明原因报错,求作者帮忙诊断,谢谢

大概900个种子,有50个分类和5个标签

管理员命令行报错如下

PS C:\Users\admin\Downloads> .\qbittorrent-torrents-exporter.exe
github.com/ludoux/qbittorrent-torrents-exporter v0.3.0
qBittorrent host url(ex http://127.0.0.1:6363 ):127.0.0.1:8080
qBittorrent username:admin
qBittorrent password:password123
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
main.genMap({0xc0001a2070, 0xe}, {0xc0001a2094, 0x5}, {0xc0001a20c8, 0x8})
/github/workspace/main.go:142 +0xb5b
main.main()
/github/workspace/main.go:573 +0x45e
PS C:\Users\admin\Downloads>

报错求助

PS C:\Users\a\Downloads> .\qbittorrent-torrents-exporter.exe
github.com/ludoux/qbittorrent-torrents-exporter v0.3.0
qBittorrent host url(ex http://127.0.0.1:6363 ):http://192.168.100.97:8080
qBittorrent username:admin
qBittorrent password:123456
get torrents: 1~28
panic: runtime error: index out of range [8] with length 0

goroutine 1 [running]:
main.getTrackerHost({0xc00018c7b0, 0x2f})
/github/workspace/main.go:82 +0x6b0
main.genMap({0xc0000a8f00, 0x1a}, {0xc00009a660, 0x5}, {0xc00009a690, 0x8})
/github/workspace/main.go:170 +0x6da
main.main()
/github/workspace/main.go:573 +0x45e
PS C:\Users\axclo\Downloads>

命令行运行如上,种子自动附加https://cdn.staticaly.com/gh/XIU2/TrackersListCollection/master/all.txt中的tracker地址,猜测是tracker地址太长导致,希望能屏蔽或者规避这个缺陷

panic: runtime error: index out of range [0] with length 0错误

`PS E:\exporter> .\qbittorrent-torrents-exporter.exe -qh "http://192.168.6.250:8383" -qu "admin" -qp "666666"
github.com/ludoux/qbittorrent-torrents-exporter v0.2.1
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
main.genMap({0xc000012160, 0x19}, {0xc00000a0e8, 0x5}, {0xc00000a108, 0x6})
/github/workspace/main.go:138 +0xb5b
main.main()
/github/workspace/main.go:565 +0x45e
PS E:\exporter>
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.