mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-13 08:36:38 +08:00
@@ -3,31 +3,38 @@ package service
|
||||
// QBitTorrentToInfo 将旧的 QBitTorrent 转换为新的 TorrentInfo。
|
||||
func QBitTorrentToInfo(q QBitTorrent) TorrentInfo {
|
||||
return TorrentInfo{
|
||||
Hash: q.Hash,
|
||||
Name: q.Name,
|
||||
Size: q.Size,
|
||||
Progress: float64(q.Progress),
|
||||
DLSpeed: q.DLSpeed,
|
||||
UPSpeed: q.UpSpeed,
|
||||
State: q.State,
|
||||
SavePath: q.SavePath,
|
||||
NumSeeds: q.NumSeeds,
|
||||
NumLeechs: q.NumLeech,
|
||||
Hash: q.Hash,
|
||||
Name: q.Name,
|
||||
Size: q.Size,
|
||||
Progress: float64(q.Progress),
|
||||
DLSpeed: q.DLSpeed,
|
||||
UPSpeed: q.UpSpeed,
|
||||
State: q.State,
|
||||
SavePath: q.SavePath,
|
||||
NumSeeds: q.NumSeeds,
|
||||
NumLeechs: q.NumLeech,
|
||||
ContentPath: q.ContentPath,
|
||||
CompletionOn: q.CompletionOn,
|
||||
}
|
||||
}
|
||||
|
||||
// TorrentInfoToQBit 将 TorrentInfo 转换回旧的 QBitTorrent 格式(兼容性)。
|
||||
func TorrentInfoToQBit(t TorrentInfo) QBitTorrent {
|
||||
return QBitTorrent{
|
||||
Hash: t.Hash,
|
||||
Name: t.Name,
|
||||
State: t.State,
|
||||
Progress: float32(t.Progress),
|
||||
DLSpeed: t.DLSpeed,
|
||||
UpSpeed: t.UPSpeed,
|
||||
NumSeeds: t.NumSeeds,
|
||||
NumLeech: t.NumLeechs,
|
||||
Size: t.Size,
|
||||
SavePath: t.SavePath,
|
||||
Hash: t.Hash,
|
||||
ClientID: "",
|
||||
Source: "",
|
||||
Name: t.Name,
|
||||
State: canonicalTorrentState(t.State, t.Progress),
|
||||
Progress: float32(normalizedTorrentProgress(t.Progress)),
|
||||
DLSpeed: t.DLSpeed,
|
||||
UpSpeed: t.UPSpeed,
|
||||
NumSeeds: t.NumSeeds,
|
||||
NumLeech: t.NumLeechs,
|
||||
Size: t.Size,
|
||||
SavePath: t.SavePath,
|
||||
Category: t.Category,
|
||||
ContentPath: t.ContentPath,
|
||||
CompletionOn: t.CompletionOn,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user