torrent priority and piece state fix

This commit is contained in:
royalcat 2024-07-07 23:09:13 +03:00
parent 13ce2aa07f
commit 199a82ff0c
33 changed files with 2227 additions and 959 deletions
ui/lib/api

View file

@ -1,8 +1,9 @@
directive @oneOf on INPUT_OBJECT | FIELD_DEFINITION
directive @resolver on INPUT_FIELD_DEFINITION | FIELD_DEFINITION
directive @stream on FIELD_DEFINITION
type ArchiveFS implements Dir & FsEntry {
name: String!
entries: [FsEntry!]!
entries: [FsEntry!]! @resolver
size: Int!
}
input BooleanFilter @oneOf {
@ -43,9 +44,7 @@ input IntFilter @oneOf {
in: [Int!]
}
type Mutation {
validateTorrents(filter: TorrentFilter!): Boolean!
cleanupTorrents(files: Boolean, dryRun: Boolean!): CleanupResponse!
downloadTorrent(infohash: String!, file: String): DownloadTorrentResponse
torrentDaemon: TorrentDaemonMutation @resolver
uploadFile(dir: String!, file: Upload!): Boolean!
dedupeStorage: Int!
}
@ -58,12 +57,12 @@ interface Progress {
total: Int!
}
type Query {
torrents(filter: TorrentsFilter): [Torrent!]!
torrentDaemon: TorrentDaemonQuery @resolver
fsEntry(path: String!): FsEntry
}
type ResolverFS implements Dir & FsEntry {
name: String!
entries: [FsEntry!]!
entries: [FsEntry!]! @resolver
}
type Schema {
query: Query
@ -71,7 +70,7 @@ type Schema {
}
type SimpleDir implements Dir & FsEntry {
name: String!
entries: [FsEntry!]!
entries: [FsEntry!]! @resolver
}
type SimpleFile implements File & FsEntry {
name: String!
@ -90,20 +89,28 @@ type Task {
id: ID!
}
type Torrent {
name: String!
name: String! @resolver
infohash: String!
bytesCompleted: Int!
torrentFilePath: String!
bytesMissing: Int!
files: [TorrentFile!]!
excludedFiles: [TorrentFile!]!
peers: [TorrentPeer!]!
downloading: Boolean!
priority: TorrentPriority! @resolver
files: [TorrentFile!]! @resolver
excludedFiles: [TorrentFile!]! @resolver
peers: [TorrentPeer!]! @resolver
}
type TorrentDaemonMutation {
validateTorrent(filter: TorrentFilter!): Boolean! @resolver
setTorrentPriority(infohash: String!, file: String, priority: TorrentPriority!): Boolean! @resolver
cleanup(files: Boolean, dryRun: Boolean!): CleanupResponse! @resolver
}
type TorrentDaemonQuery {
torrents(filter: TorrentsFilter): [Torrent!]! @resolver
}
type TorrentFS implements Dir & FsEntry {
name: String!
torrent: Torrent!
entries: [FsEntry!]!
entries: [FsEntry!]! @resolver
}
type TorrentFile {
filename: String!
@ -126,6 +133,22 @@ type TorrentPeer {
port: Int!
clientName: String!
}
enum TorrentPriority {
NONE
NORMAL
HIGH
READAHEAD
NEXT
NOW
}
input TorrentPriorityFilter @oneOf {
eq: TorrentPriority
gt: TorrentPriority
lt: TorrentPriority
gte: TorrentPriority
lte: TorrentPriority
in: [TorrentPriority!]
}
type TorrentProgress implements Progress {
torrent: Torrent!
current: Int!
@ -137,6 +160,6 @@ input TorrentsFilter {
bytesCompleted: IntFilter
bytesMissing: IntFilter
peersCount: IntFilter
downloading: BooleanFilter
priority: TorrentPriorityFilter
}
scalar Upload