cross-seed 6.0.0-3 → 6.0.0-30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Result.js +17 -11
- package/dist/Result.js.map +1 -1
- package/dist/action.js +158 -47
- package/dist/action.js.map +1 -1
- package/dist/arr.js +200 -0
- package/dist/arr.js.map +1 -0
- package/dist/clients/Deluge.js +129 -71
- package/dist/clients/Deluge.js.map +1 -1
- package/dist/clients/QBittorrent.js +74 -58
- package/dist/clients/QBittorrent.js.map +1 -1
- package/dist/clients/RTorrent.js +12 -10
- package/dist/clients/RTorrent.js.map +1 -1
- package/dist/clients/TorrentClient.js.map +1 -1
- package/dist/clients/Transmission.js +10 -10
- package/dist/clients/Transmission.js.map +1 -1
- package/dist/cmd.js +16 -16
- package/dist/cmd.js.map +1 -1
- package/dist/config.template.cjs +83 -46
- package/dist/config.template.cjs.map +1 -1
- package/dist/configSchema.js +97 -13
- package/dist/configSchema.js.map +1 -1
- package/dist/configuration.js +3 -0
- package/dist/configuration.js.map +1 -1
- package/dist/constants.js +100 -6
- package/dist/constants.js.map +1 -1
- package/dist/dataFiles.js +4 -5
- package/dist/dataFiles.js.map +1 -1
- package/dist/decide.js +263 -158
- package/dist/decide.js.map +1 -1
- package/dist/diff.js +12 -2
- package/dist/diff.js.map +1 -1
- package/dist/errors.js +5 -2
- package/dist/errors.js.map +1 -1
- package/dist/indexers.js +31 -4
- package/dist/indexers.js.map +1 -1
- package/dist/jobs.js +2 -0
- package/dist/jobs.js.map +1 -1
- package/dist/logger.js +19 -5
- package/dist/logger.js.map +1 -1
- package/dist/migrations/05-caps.js +16 -0
- package/dist/migrations/05-caps.js.map +1 -0
- package/dist/migrations/06-uniqueDecisions.js +29 -0
- package/dist/migrations/06-uniqueDecisions.js.map +1 -0
- package/dist/migrations/migrations.js +11 -1
- package/dist/migrations/migrations.js.map +1 -1
- package/dist/parseTorrent.js +5 -0
- package/dist/parseTorrent.js.map +1 -1
- package/dist/pipeline.js +181 -85
- package/dist/pipeline.js.map +1 -1
- package/dist/preFilter.js +130 -52
- package/dist/preFilter.js.map +1 -1
- package/dist/pushNotifier.js +4 -2
- package/dist/pushNotifier.js.map +1 -1
- package/dist/runtimeConfig.js.map +1 -1
- package/dist/searchee.js +203 -13
- package/dist/searchee.js.map +1 -1
- package/dist/server.js +22 -15
- package/dist/server.js.map +1 -1
- package/dist/startup.js +2 -0
- package/dist/startup.js.map +1 -1
- package/dist/torrent.js +84 -39
- package/dist/torrent.js.map +1 -1
- package/dist/torznab.js +285 -95
- package/dist/torznab.js.map +1 -1
- package/dist/utils.js +155 -31
- package/dist/utils.js.map +1 -1
- package/package.json +3 -1
package/dist/config.template.cjs
CHANGED
@@ -27,6 +27,36 @@ module.exports = {
|
|
27
27
|
* and separate them with commas, and surround the entire set in brackets.
|
28
28
|
*/
|
29
29
|
torznab: [],
|
30
|
+
/**
|
31
|
+
* URL(s) to your Sonarr instance(s), included in the same way as torznab
|
32
|
+
* URLs but for your Sonarr: note that api is not at the end. see below.
|
33
|
+
*
|
34
|
+
* You should order these in most likely to match -> least likely order.
|
35
|
+
* They are searched sequentially as they are listed.
|
36
|
+
*
|
37
|
+
* This apikey parameter comes from Sonarr
|
38
|
+
*
|
39
|
+
* Example: sonarr: ["http://sonarr:8989/?apikey=12345"],
|
40
|
+
*
|
41
|
+
* sonarr: ["http://sonarr:8989/?apikey=12345",
|
42
|
+
* "http://sonarr4k:8989/?apikey=12345"],
|
43
|
+
*/
|
44
|
+
sonarr: undefined,
|
45
|
+
/**
|
46
|
+
* URL(s) to your Radarr instance(s), included in the same way as torznab
|
47
|
+
* URLs but for your Radarr: note that api is not at the end. see below.
|
48
|
+
*
|
49
|
+
* You should order these in most likely to match -> least likely order.
|
50
|
+
* They are searched sequentially as they are listed.
|
51
|
+
*
|
52
|
+
* This apikey parameter comes from Radarr
|
53
|
+
*
|
54
|
+
* Example: radarr: ["http://radarr:7878/?apikey=12345"],
|
55
|
+
*
|
56
|
+
* radarr: ["http://radarr:7878/?apikey=12345",
|
57
|
+
* "http://radarr4k:7878/?apikey=12345"],
|
58
|
+
*/
|
59
|
+
radarr: undefined,
|
30
60
|
/**
|
31
61
|
* Bind to a specific host address.
|
32
62
|
* Example: "127.0.0.1"
|
@@ -51,6 +81,10 @@ module.exports = {
|
|
51
81
|
/**
|
52
82
|
* The url of your qBittorrent webui.
|
53
83
|
* Only relevant with action: "inject".
|
84
|
+
*
|
85
|
+
* If using Automatic Torrent Management, please read:
|
86
|
+
* https://www.cross-seed.org/docs/v6-migration#qbittorrent
|
87
|
+
*
|
54
88
|
* Supply your username and password inside the url like so:
|
55
89
|
* "http://username:password@localhost:8080"
|
56
90
|
*/
|
@@ -77,7 +111,7 @@ module.exports = {
|
|
77
111
|
/**
|
78
112
|
* Pause at least this many seconds in between each search. Higher is safer
|
79
113
|
* for you and friendlier for trackers.
|
80
|
-
* Minimum value of
|
114
|
+
* Minimum value of 30.
|
81
115
|
*/
|
82
116
|
delay: 30,
|
83
117
|
/**
|
@@ -85,8 +119,9 @@ module.exports = {
|
|
85
119
|
* to your downloaded torrent data to find matches, rather than relying
|
86
120
|
* entirely on the .torrent files themselves for matching.
|
87
121
|
*
|
88
|
-
* If directories are entered, they must all be
|
122
|
+
* If directories are entered, they must all be in a single option and they
|
89
123
|
* need to be surrounded by brackets.
|
124
|
+
*
|
90
125
|
* Windows users will need to use double backslash in all paths in this
|
91
126
|
* config.
|
92
127
|
*
|
@@ -98,12 +133,11 @@ module.exports = {
|
|
98
133
|
dataDirs: [],
|
99
134
|
/**
|
100
135
|
* Defines what qBittorrent or Deluge category to set on linked torrents
|
101
|
-
* Default is "cross-seed-link".
|
102
136
|
*
|
103
137
|
* qBittorrent: If you have linking enabled, all torrents will be injected
|
104
138
|
* to this category.
|
105
139
|
*
|
106
|
-
* Default is "cross-seed-
|
140
|
+
* Default is "cross-seed-link".
|
107
141
|
*/
|
108
142
|
linkCategory: "cross-seed-link",
|
109
143
|
/**
|
@@ -119,11 +153,14 @@ module.exports = {
|
|
119
153
|
* IF YOU ARE USING HARDLINKS, THIS MUST BE UNDER THE SAME VOLUME AS YOUR
|
120
154
|
* DATADIRS. THIS PATH MUST ALSO BE ACCESSIBLE VIA YOUR TORRENT CLIENT
|
121
155
|
* USING THE SAME PATH.
|
156
|
+
*
|
157
|
+
* We recommend reading the following FAQ entry:
|
158
|
+
* https://www.cross-seed.org/docs/basics/faq-troubleshooting#what-linktype-should-i-use
|
122
159
|
*/
|
123
160
|
linkDir: undefined,
|
124
161
|
/**
|
125
162
|
* cross-seed will use links of this type to inject data-based matches into
|
126
|
-
* your client.
|
163
|
+
* your client. We recommend reading the following FAQ entry:
|
127
164
|
* https://www.cross-seed.org/docs/basics/faq-troubleshooting#what-linktype-should-i-use
|
128
165
|
* Options: "symlink", "hardlink".
|
129
166
|
*/
|
@@ -134,8 +171,8 @@ module.exports = {
|
|
134
171
|
* Each individual Torznab tracker's cross-seeds, otherwise, will have it's
|
135
172
|
* own folder with the tracker's name and it's links within it.
|
136
173
|
*
|
137
|
-
*
|
138
|
-
*
|
174
|
+
* If using Automatic Torrent Management in qBittorrent, please read:
|
175
|
+
* https://www.cross-seed.org/docs/v6-migration#qbittorrent
|
139
176
|
*
|
140
177
|
* Default: false.
|
141
178
|
*/
|
@@ -148,6 +185,9 @@ module.exports = {
|
|
148
185
|
* "partial" is like risky but allows matches if they are missing small
|
149
186
|
* files like .nfo/.srt.
|
150
187
|
* Options: "safe", "risky", "partial".
|
188
|
+
*
|
189
|
+
* We recommend reading the following FAQ entry:
|
190
|
+
* https://www.cross-seed.org/docs/basics/faq-troubleshooting#what-linktype-should-i-use
|
151
191
|
*/
|
152
192
|
matchMode: "safe",
|
153
193
|
/**
|
@@ -155,7 +195,7 @@ module.exports = {
|
|
155
195
|
* searchees. Setting this to higher values will result in more searchees
|
156
196
|
* and more API hits to your indexers.
|
157
197
|
*/
|
158
|
-
maxDataDepth:
|
198
|
+
maxDataDepth: 2,
|
159
199
|
/**
|
160
200
|
* Directory containing .torrent files.
|
161
201
|
* For qBittorrent, this is BT_Backup.
|
@@ -174,47 +214,39 @@ module.exports = {
|
|
174
214
|
*/
|
175
215
|
outputDir: ".",
|
176
216
|
/**
|
177
|
-
* Whether to
|
178
|
-
* packs.
|
179
|
-
* This option overrides includeSingleEpisodes when set to true.
|
180
|
-
*/
|
181
|
-
includeEpisodes: false,
|
182
|
-
/**
|
183
|
-
* Whether to include single episode torrents in the search (not those from
|
217
|
+
* Whether to include single episode torrents in a search (not those from
|
184
218
|
* season packs).
|
185
|
-
*
|
219
|
+
*
|
220
|
+
* This setting does not affect matching episodes from rss and
|
221
|
+
* announce.
|
186
222
|
*/
|
187
223
|
includeSingleEpisodes: false,
|
188
224
|
/**
|
189
|
-
* Include torrents which
|
190
|
-
* This option does not override includeEpisodes or includeSingleEpisodes.
|
225
|
+
* Include torrents which are comprised of non-video files.
|
191
226
|
*
|
192
|
-
* If this option is set to false, any folders or torrents
|
193
|
-
*
|
227
|
+
* If this option is set to false, any folders or torrents whose
|
228
|
+
* totalNonVideoFilesSize / totalSize > fuzzySizeThreshold
|
229
|
+
* will be excluded.
|
194
230
|
*
|
195
|
-
* For example, if you have .srt or .nfo files inside
|
196
|
-
*
|
231
|
+
* For example, if you have .srt or .nfo files inside a torrent, using
|
232
|
+
* false will still allow the torrent to be considered for cross-seeding
|
233
|
+
* while disallowing torrents that are music, games, books, etc.
|
197
234
|
* For full disc based folders (not .ISO) you may wish to set this as true.
|
198
|
-
* You may also want to set this as false to exclude things like music,
|
199
|
-
* games, or books.
|
200
|
-
*
|
201
|
-
* To search for everything except episodes, use:
|
202
235
|
*
|
203
|
-
*
|
204
|
-
* includeSingleEpisodes: false
|
205
|
-
* includeNonVideos: true
|
236
|
+
* To search for all video media except individual episodes, use:
|
206
237
|
*
|
207
|
-
*
|
238
|
+
* includeSingleEpisodes: false
|
239
|
+
* includeNonVideos: false
|
208
240
|
*
|
209
|
-
*
|
210
|
-
* includeNonVideos: true
|
241
|
+
* To search for all video media including individual episodes, use:
|
211
242
|
*
|
212
|
-
*
|
243
|
+
* includeSingleEpisodes: true
|
244
|
+
* includeNonVideos: false
|
213
245
|
*
|
214
|
-
*
|
215
|
-
*
|
216
|
-
* includeNonVideos: true
|
246
|
+
* To search for absolutely ALL types of content, including non-video, configure
|
247
|
+
* your episode settings based on the above examples and use:
|
217
248
|
*
|
249
|
+
* includeNonVideos: true
|
218
250
|
*/
|
219
251
|
includeNonVideos: false,
|
220
252
|
/**
|
@@ -232,9 +264,10 @@ module.exports = {
|
|
232
264
|
/**
|
233
265
|
* Exclude torrents first seen by cross-seed more than this long ago.
|
234
266
|
* Examples:
|
235
|
-
* "
|
236
|
-
* "
|
237
|
-
*
|
267
|
+
* "5 days"
|
268
|
+
* "2 weeks"
|
269
|
+
*
|
270
|
+
* This value must be in the range of 2-5 times your excludeRecentSearch
|
238
271
|
*/
|
239
272
|
excludeOlder: "2 weeks",
|
240
273
|
/**
|
@@ -243,7 +276,9 @@ module.exports = {
|
|
243
276
|
* Doesn't exclude previously failed searches.
|
244
277
|
* Examples:
|
245
278
|
* "2 days"
|
246
|
-
* "
|
279
|
+
* "5 days"
|
280
|
+
*
|
281
|
+
* This value must be 2-5x less than excludeOlder.
|
247
282
|
*/
|
248
283
|
excludeRecentSearch: "3 days",
|
249
284
|
/**
|
@@ -276,6 +311,8 @@ module.exports = {
|
|
276
311
|
* Examples:
|
277
312
|
* "2 weeks"
|
278
313
|
* "3 days"
|
314
|
+
*
|
315
|
+
* This value must be at least 3x less than your excludeRecentSearch
|
279
316
|
*/
|
280
317
|
searchCadence: "1 day",
|
281
318
|
/**
|
@@ -285,7 +322,7 @@ module.exports = {
|
|
285
322
|
* "30 seconds"
|
286
323
|
* null
|
287
324
|
*/
|
288
|
-
snatchTimeout:
|
325
|
+
snatchTimeout: "30 seconds",
|
289
326
|
/**
|
290
327
|
* Fail search requests that haven't responded after this long.
|
291
328
|
* Set to null for an infinite timeout.
|
@@ -293,7 +330,7 @@ module.exports = {
|
|
293
330
|
* "30 seconds"
|
294
331
|
* null
|
295
332
|
*/
|
296
|
-
searchTimeout:
|
333
|
+
searchTimeout: "2 minutes",
|
297
334
|
/**
|
298
335
|
* The number of searches to make in one run/batch.
|
299
336
|
* If more than this many searches are queued,
|
@@ -314,10 +351,10 @@ module.exports = {
|
|
314
351
|
*
|
315
352
|
* examples:
|
316
353
|
*
|
317
|
-
*
|
318
|
-
*
|
319
|
-
*
|
320
|
-
*
|
354
|
+
* blockList: ["-excludedGroup", "-excludedGroup2"],
|
355
|
+
* blocklist: ["x265"],
|
356
|
+
* blocklist: ["Release.Name"],
|
357
|
+
* blocklist: ["3317e6485454354751555555366a8308c1e92093"],
|
321
358
|
*/
|
322
359
|
blockList: undefined,
|
323
360
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"config.template.cjs","sourceRoot":"","sources":["../src/config.template.cjs"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,qBAAqB;;AAErB,MAAM,CAAC,OAAO,GAAG;IAChB;;;;;;;;QAQI;IAEJ;;;;;OAKG;IACH,MAAM,EAAE,SAAS;IAEjB;;;;;;OAMG;IACH,OAAO,EAAE,EAAE;IAEX;;;;OAIG;IACH,IAAI,EAAE,SAAS;IAEf;;OAEG;IACH,IAAI,EAAE,IAAI;IAEV;;;OAGG;IACH,sBAAsB,EAAE,SAAS;IAEjC;;;;OAIG;IACH,cAAc,EAAE,SAAS;IAEzB
|
1
|
+
{"version":3,"file":"config.template.cjs","sourceRoot":"","sources":["../src/config.template.cjs"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,qBAAqB;;AAErB,MAAM,CAAC,OAAO,GAAG;IAChB;;;;;;;;QAQI;IAEJ;;;;;OAKG;IACH,MAAM,EAAE,SAAS;IAEjB;;;;;;OAMG;IACH,OAAO,EAAE,EAAE;IAEX;;;;;;;;;;;;;OAaG;IACH,MAAM,EAAE,SAAS;IAEjB;;;;;;;;;;;;;OAaG;IACH,M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Aa,EAAE,YAAY;IAE3B;;;;;;OAMG;IACH,aAAa,EAAE,WAAW;IAE1B;;;;;;;;;OASG;IACH,WAAW,EAAE,GAAG;IAEhB;;;;;;;;;;;;;OAaG;IACH,SAAS,EAAE,SAAS;CACpB,CAAC"}
|
package/dist/configSchema.js
CHANGED
@@ -1,18 +1,28 @@
|
|
1
1
|
import ms from "ms";
|
2
2
|
import { z } from "zod";
|
3
|
-
import { Action, LinkType, MatchMode } from "./constants.js";
|
3
|
+
import { Action, LinkType, MatchMode, NEWLINE_INDENT } from "./constants.js";
|
4
4
|
import { logger } from "./logger.js";
|
5
|
+
import { resolve, relative, isAbsolute } from "path";
|
5
6
|
/**
|
6
7
|
* error messages and map returned upon Zod validation failure
|
7
8
|
*/
|
8
9
|
const ZodErrorMessages = {
|
9
10
|
vercel: "format does not follow vercel's `ms` style ( https://github.com/vercel/ms#examples )",
|
10
11
|
emptyString: "cannot have an empty string. If you want to unset it, use null or undefined.",
|
11
|
-
|
12
|
-
|
12
|
+
delayNegative: "delay is in seconds, you can't travel back in time.",
|
13
|
+
delayUnsupported: `delay must be 30 seconds to 1 hour.${NEWLINE_INDENT}To even out search loads please see the following documentation:${NEWLINE_INDENT}(https://www.cross-seed.org/docs/basics/daemon#set-up-periodic-searches)`,
|
14
|
+
rssCadenceUnsupported: "rssCadence must be 10-120 minutes",
|
15
|
+
searchCadenceUnsupported: "searchCadence must be at least 1 day.",
|
16
|
+
searchCadenceExcludeRecent: "excludeRecentSearch must be at least 3x searchCadence.",
|
17
|
+
excludeRecentOlder: "excludeOlder and excludeRecentSearch must be defined for searching. excludeOlder must be 2-5x excludeRecentSearch.",
|
18
|
+
fuzzySizeThreshold: "fuzzySizeThreshold must be between 0 and 1 with a maximum of 0.1 when using searchCadence or rssCadence",
|
13
19
|
injectUrl: "You need to specify rtorrentRpcUrl, transmissionRpcUrl, qbittorrentUrl, or delugeRpcUrl when using 'inject'",
|
14
|
-
qBitAutoTMM: "
|
20
|
+
qBitAutoTMM: "If using Automatic Torrent Management in qBittorrent, please read: https://www.cross-seed.org/docs/v6-migration#qbittorrent",
|
21
|
+
includeSingleEpisodes: "includeSingleEpisodes is not recommended when using announce, please read: https://www.cross-seed.org/docs/v6-migration#updated-includesingleepisodes-behavior",
|
22
|
+
needsInject: "You need to use the 'inject' action for partial matching.",
|
15
23
|
needsLinkDir: "You need to set a linkDir (and have your data accessible) for risky or partial matching to work.",
|
24
|
+
linkDirInDataDir: "You cannot have your linkDir inside of your dataDirs. Please adjust your paths to correct this.",
|
25
|
+
ouputDirInInputDir: "You cannot have your outputDir inside of your torrentDir/dataDirs. Please adjust your paths to correct this.",
|
16
26
|
};
|
17
27
|
/**
|
18
28
|
* custom zod error map for logging
|
@@ -58,15 +68,34 @@ function transformDurationString(durationStr, ctx) {
|
|
58
68
|
}
|
59
69
|
return duration;
|
60
70
|
}
|
71
|
+
/**
|
72
|
+
* check a potential child path being inside a array of parent paths
|
73
|
+
* @param childDir path of the potential child (e.g linkDir)
|
74
|
+
* @param parentDirs array of parentDir paths (e.g dataDirs)
|
75
|
+
* @returns true if `childDir` is inside any `parentDirs` at any nesting level, false otherwise.
|
76
|
+
*/
|
77
|
+
function isChildPath(childDir, parentDirs) {
|
78
|
+
return parentDirs.some((parentDir) => {
|
79
|
+
const resolvedParent = resolve(parentDir);
|
80
|
+
const resolvedChild = resolve(childDir);
|
81
|
+
const relativePath = relative(resolvedParent, resolvedChild);
|
82
|
+
// if the path does not start with '..' and is not absolute
|
83
|
+
return !(relativePath.startsWith("..") || isAbsolute(relativePath));
|
84
|
+
});
|
85
|
+
}
|
61
86
|
/**
|
62
87
|
* an object of the zod schema
|
63
88
|
* each are named after what they are intended to validate
|
64
89
|
*/
|
65
90
|
export const VALIDATION_SCHEMA = z
|
66
91
|
.object({
|
67
|
-
delay: z
|
68
|
-
|
69
|
-
|
92
|
+
delay: z
|
93
|
+
.number()
|
94
|
+
.nonnegative({
|
95
|
+
message: ZodErrorMessages.delayNegative,
|
96
|
+
})
|
97
|
+
.gte(30, ZodErrorMessages.delayUnsupported)
|
98
|
+
.lte(3600, ZodErrorMessages.delayUnsupported),
|
70
99
|
torznab: z.array(z.string().url()),
|
71
100
|
dataDirs: z.array(z.string()).nullish(),
|
72
101
|
matchMode: z.nativeEnum(MatchMode),
|
@@ -80,7 +109,6 @@ export const VALIDATION_SCHEMA = z
|
|
80
109
|
maxDataDepth: z.number().gte(1),
|
81
110
|
torrentDir: z.string().nullable(),
|
82
111
|
outputDir: z.string(),
|
83
|
-
includeEpisodes: z.boolean(),
|
84
112
|
includeSingleEpisodes: z.boolean(),
|
85
113
|
includeNonVideos: z.boolean(),
|
86
114
|
fuzzySizeThreshold: z.number().positive().lte(1, {
|
@@ -90,12 +118,24 @@ export const VALIDATION_SCHEMA = z
|
|
90
118
|
.string()
|
91
119
|
.min(1, { message: ZodErrorMessages.emptyString })
|
92
120
|
.transform(transformDurationString)
|
93
|
-
.nullish()
|
121
|
+
.nullish()
|
122
|
+
.or(z
|
123
|
+
.boolean()
|
124
|
+
.refine((value) => value !== true, {
|
125
|
+
message: "Expected string, received boolean (true)",
|
126
|
+
})
|
127
|
+
.transform(() => null)),
|
94
128
|
excludeRecentSearch: z
|
95
129
|
.string()
|
96
130
|
.min(1, { message: ZodErrorMessages.emptyString })
|
97
131
|
.transform(transformDurationString)
|
98
|
-
.nullish()
|
132
|
+
.nullish()
|
133
|
+
.or(z
|
134
|
+
.boolean()
|
135
|
+
.refine((value) => value !== true, {
|
136
|
+
message: "Expected string, received boolean (true)",
|
137
|
+
})
|
138
|
+
.transform(() => null)),
|
99
139
|
action: z.nativeEnum(Action),
|
100
140
|
qbittorrentUrl: z.string().url().nullish(),
|
101
141
|
rtorrentRpcUrl: z.string().url().nullish(),
|
@@ -114,12 +154,15 @@ export const VALIDATION_SCHEMA = z
|
|
114
154
|
.string()
|
115
155
|
.min(1, { message: ZodErrorMessages.emptyString })
|
116
156
|
.transform(transformDurationString)
|
117
|
-
.nullish()
|
157
|
+
.nullish()
|
158
|
+
.refine((cadence) => !cadence ||
|
159
|
+
(cadence >= ms("10 minutes") && cadence <= ms("2 hours")), ZodErrorMessages.rssCadenceUnsupported),
|
118
160
|
searchCadence: z
|
119
161
|
.string()
|
120
162
|
.min(1, { message: ZodErrorMessages.emptyString })
|
121
163
|
.transform(transformDurationString)
|
122
|
-
.nullish()
|
164
|
+
.nullish()
|
165
|
+
.refine((cadence) => !cadence || cadence >= ms("1 day"), ZodErrorMessages.searchCadenceUnsupported),
|
123
166
|
snatchTimeout: z
|
124
167
|
.string()
|
125
168
|
.min(1, { message: ZodErrorMessages.emptyString })
|
@@ -138,8 +181,26 @@ export const VALIDATION_SCHEMA = z
|
|
138
181
|
.nullish()
|
139
182
|
.transform((value) => (Array.isArray(value) ? value : [])),
|
140
183
|
apiKey: z.string().min(24).nullish(),
|
184
|
+
radarr: z
|
185
|
+
.array(z.string().url())
|
186
|
+
.nullish()
|
187
|
+
.transform((value) => value ?? []),
|
188
|
+
sonarr: z
|
189
|
+
.array(z.string().url())
|
190
|
+
.nullish()
|
191
|
+
.transform((value) => value ?? []),
|
141
192
|
})
|
142
193
|
.strict()
|
194
|
+
.refine((config) => !config.searchCadence ||
|
195
|
+
!config.excludeRecentSearch ||
|
196
|
+
3 * config.searchCadence <= config.excludeRecentSearch, ZodErrorMessages.searchCadenceExcludeRecent)
|
197
|
+
.refine((config) => !config.searchCadence ||
|
198
|
+
(config.excludeOlder &&
|
199
|
+
config.excludeRecentSearch &&
|
200
|
+
config.excludeOlder >= 2 * config.excludeRecentSearch &&
|
201
|
+
config.excludeOlder <= 5 * config.excludeRecentSearch), ZodErrorMessages.excludeRecentOlder)
|
202
|
+
.refine((config) => config.fuzzySizeThreshold <= 0.1 ||
|
203
|
+
(!config.searchCadence && !config.rssCadence), ZodErrorMessages.fuzzySizeThreshold)
|
143
204
|
.refine((config) => {
|
144
205
|
if (config.action === Action.INJECT &&
|
145
206
|
config.qbittorrentUrl &&
|
@@ -148,11 +209,34 @@ export const VALIDATION_SCHEMA = z
|
|
148
209
|
logger.warn(ZodErrorMessages.qBitAutoTMM);
|
149
210
|
}
|
150
211
|
return true;
|
212
|
+
})
|
213
|
+
.refine((config) => {
|
214
|
+
if (config.includeSingleEpisodes && config.rssCadence) {
|
215
|
+
logger.warn(ZodErrorMessages.includeSingleEpisodes);
|
216
|
+
}
|
217
|
+
return true;
|
151
218
|
})
|
152
219
|
.refine((config) => !(config.action === Action.INJECT &&
|
153
220
|
!config.rtorrentRpcUrl &&
|
154
221
|
!config.qbittorrentUrl &&
|
155
222
|
!config.transmissionRpcUrl &&
|
156
223
|
!config.delugeRpcUrl), ZodErrorMessages.injectUrl)
|
157
|
-
.refine((config) => config.
|
224
|
+
.refine((config) => config.action === Action.INJECT ||
|
225
|
+
config.matchMode !== MatchMode.PARTIAL, ZodErrorMessages.needsInject)
|
226
|
+
.refine((config) => config.linkDir || config.matchMode === MatchMode.SAFE, ZodErrorMessages.needsLinkDir)
|
227
|
+
.refine((config) => {
|
228
|
+
if (config.linkDir && config.dataDirs) {
|
229
|
+
return !isChildPath(config.linkDir, config.dataDirs);
|
230
|
+
}
|
231
|
+
return true;
|
232
|
+
}, ZodErrorMessages.linkDirInDataDir)
|
233
|
+
.refine((config) => {
|
234
|
+
if (config.torrentDir) {
|
235
|
+
return !isChildPath(config.outputDir, [
|
236
|
+
config.torrentDir,
|
237
|
+
...(config.dataDirs ?? []),
|
238
|
+
]);
|
239
|
+
}
|
240
|
+
return true;
|
241
|
+
}, ZodErrorMessages.ouputDirInInputDir);
|
158
242
|
//# sourceMappingURL=configSchema.js.map
|
package/dist/configSchema.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"configSchema.js","sourceRoot":"","sources":["../src/configSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAA8B,CAAC,EAA2B,MAAM,KAAK,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,QAAQ,EAA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Ac;IACtB,CAAC,MAAM,CAAC,kBAAkB;IAC1B,CAAC,MAAM,CAAC,YAAY,CACpB,EACF,gBAAgB,CAAC,SAAS,CAC1B;KACA,MAAM,CACN,CAAC,MAAM,EAAE,EAAE,CACV,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM;IAC/B,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC,OAAO,EACvC,gBAAgB,CAAC,WAAW,CAC5B;KACA,MAAM,CACN,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC,IAAI,EACjE,gBAAgB,CAAC,YAAY,CAC7B;KACA,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE;IAClB,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACvC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,CAAC;KACpC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE;IAClB,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QACvB,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE;YACrC,MAAM,CAAC,UAAU;YACjB,GAAG,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC;SAC1B,CAAC,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC"}
|
package/dist/configuration.js
CHANGED
@@ -23,6 +23,9 @@ export function appDir() {
|
|
23
23
|
accessSync(appDir, constants.R_OK | constants.W_OK);
|
24
24
|
}
|
25
25
|
catch (e) {
|
26
|
+
if (e.code === "ENOENT") {
|
27
|
+
return appDir;
|
28
|
+
}
|
26
29
|
const dockerMessage = process.env.DOCKER_ENV === "true"
|
27
30
|
? ` Use chown to set the owner to ${process.getuid()}:${process.getgid()}`
|
28
31
|
: "";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../src/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../src/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAwClD,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;CAOxC,CAAC,IAAI,EAAE,CAAC;AAET,MAA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C1D,CAAC;QACH,CAAC;aAAM,CAAC;YACP,MAAM,CAAC,CAAC;QACT,CAAC;IACF,CAAC;AACF,CAAC"}
|
package/dist/constants.js
CHANGED
@@ -6,15 +6,92 @@ export const PROGRAM_VERSION = packageDotJson.version;
|
|
6
6
|
export const USER_AGENT = `CrossSeed/${PROGRAM_VERSION}`;
|
7
7
|
export const TORRENT_TAG = "cross-seed";
|
8
8
|
export const TORRENT_CATEGORY_SUFFIX = `.cross-seed`;
|
9
|
-
export const
|
10
|
-
export const
|
9
|
+
export const NEWLINE_INDENT = "\n\t\t\t\t";
|
10
|
+
export const EP_REGEX = /^(?<title>.+?)[_.\s-]+(?:(?<season>S\d+)?[_.\s-]{0,3}(?!(?:19|20)\d{2})(?<episode>(?:E|(?<=S\d+[_\s-]{1,3}))\d+(?:[\s-]?(?!(?:19|20)\d{2})E?\d+)?(?![pix]))(?!\d+[pix])|(?<date>(?<year>(?:19|20)\d{2})[_.\s-](?<month>\d{2})[_.\s-](?<day>\d{2})))/i;
|
11
|
+
export const IS_MULTI_EP_REGEX = /E\d+(?:[-.]?S\d+E\d|[-.]?E\d|[-.]\d)/i;
|
12
|
+
export const SEASON_REGEX = /^(?<title>.+?)[[_.\s-]+(?<season>S\d+)(?:[_.\s~-]*?(?<seasonmax>S?\d+))?(?=\b(?!E\d+))/i;
|
11
13
|
export const MOVIE_REGEX = /^(?<title>.+?)-?[_.\s][[(]?(?<year>(?:18|19|20)\d{2})[)\]]?(?![pix])/i;
|
12
|
-
export const ANIME_REGEX = /^(?:\[(?<group>.*?)\][_
|
13
|
-
export const RELEASE_GROUP_REGEX = /(?<=-)(?:\W|\b)(?!(?:\d{3,4}[ip]))(?!\d+\b)(?:\W|\b)(?<group>[\w ]+?)(?:\[.+\])?(?:\))?(
|
14
|
-
export const
|
14
|
+
export const ANIME_REGEX = /^(?:\[(?<group>.*?)\][_\s-]?)?(?:\[?(?<title>.+?)[_\s-]?(?:\(?(?:\d{1,2}(?:st|nd|rd|th))?\s?Season)?[_\s-]?\]?)(?:[([~/|-]\s?(?!\d{1,4})(?<altTitle>.+?)[)\]~-]?\s?)?[_\s-]?(?:[[(]?(?<year>(?:19|20)\d{2})[)\]]?)?[[_\s-](?:S\d{1,2})?[_\s-]{0,3}(?:#|EP?|(?:SP))?[_\s-]{0,3}(?!\d+[a-uw-z])(?<release>\d{1,4})(?!\.[0-46-9])/i;
|
15
|
+
export const RELEASE_GROUP_REGEX = /(?<=-)(?:\W|\b)(?!(?:\d{3,4}[ip]))(?!\d+\b)(?:\W|\b)(?<group>[\w .]+?)(?:\[.+\])?(?:\))?(?:\s\[.+\])?$/i;
|
16
|
+
export const ANIME_GROUP_REGEX = /^\s*\[(?<group>.+?)\]/i;
|
17
|
+
export const RESOLUTION_REGEX = /\b(?<res>\d{3,4}[pix](?:\d{3,4}[pi]?)?)\b/i;
|
18
|
+
export const RES_STRICT_REGEX = /(?<res>(?:2160|1080|720)[pi])/;
|
19
|
+
export const YEARS_REGEX = /(?<year>(?:19|20)\d{2})(?![pix])/gi;
|
20
|
+
export const REPACK_PROPER_REGEX = /(?:\b(?<type>(?:REPACK|PROPER|\d\v\d)\d?))\b/i;
|
21
|
+
export const ARR_PROPER_REGEX = /(?:\b(?<arrtype>(?:Proper|v\d)))\b/;
|
22
|
+
export const SCENE_TITLE_REGEX = /^(?:[a-z0-9]{0,5}-)?(?<title>.*)/;
|
23
|
+
export const ARR_DIR_REGEX = /^(?<title>(?!.*(?:(\d{3,4}[ipx])|([xh.]+26[4-6])|(dvd)|(mpeg)|(xvid)|(?:(he)|a)vc))[\p{L}\s:\w'’!();.,&–+-]+(?:\(\d{4}\))?)(?<id>\s[{[](?:tm|tv|im)db(?:id)?-\w+?[}\]])?$/iu;
|
24
|
+
export const SONARR_SUBFOLDERS_REGEX = /^(?:S(?:eason )?(?<seasonNum>\d{1,4}))$/i;
|
25
|
+
export const NON_UNICODE_ALPHANUM_REGEX = /[^\p{L}\p{N}]+/giu;
|
26
|
+
// Needs to be handled through helper functions since there are variations
|
27
|
+
const SOURCE_REGEXES = {
|
28
|
+
AMZN: /\b(amzn|amazon(hd)?)\b[ ._-]web[ ._-]?(dl|rip)?\b/i,
|
29
|
+
DSNP: /\b(dsnp|dsny|disney)\b/i,
|
30
|
+
NF: /\b(nf|netflix(u?hd)?)\b/i,
|
31
|
+
HULU: /\b(hulu)\b/i,
|
32
|
+
ATVP: /\b(atvp|aptv)\b/i,
|
33
|
+
HBO: /\b(hbo)(?![ ._-]max)\b|\b(hmax|hbom|hbo[ ._-]max)\b/i,
|
34
|
+
PCOK: /\b(pcok)\b/i,
|
35
|
+
PMTP: /\b(pmtp|Paramount Plus)\b/i,
|
36
|
+
};
|
37
|
+
export function parseSource(title) {
|
38
|
+
for (const [source, regex] of Object.entries(SOURCE_REGEXES)) {
|
39
|
+
if (regex.test(title))
|
40
|
+
return source;
|
41
|
+
}
|
42
|
+
return null;
|
43
|
+
}
|
44
|
+
export function sourceRegexRemove(title) {
|
45
|
+
const originalLength = title.length;
|
46
|
+
for (const regex of Object.values(SOURCE_REGEXES)) {
|
47
|
+
const newTitle = title.replace(regex, "");
|
48
|
+
if (newTitle.length !== originalLength)
|
49
|
+
return newTitle;
|
50
|
+
}
|
51
|
+
return title;
|
52
|
+
}
|
15
53
|
export const VIDEO_EXTENSIONS = [".mkv", ".mp4", ".avi", ".ts"];
|
16
|
-
export const
|
54
|
+
export const VIDEO_DISC_EXTENSIONS = [".m2ts", ".ifo", ".vob", ".bup"];
|
55
|
+
export const AUDIO_EXTENSIONS = [
|
56
|
+
".wav",
|
57
|
+
".aiff",
|
58
|
+
".alac",
|
59
|
+
".flac",
|
60
|
+
".ape",
|
61
|
+
".mp3",
|
62
|
+
".aac",
|
63
|
+
".m4a",
|
64
|
+
".m4b",
|
65
|
+
".m4p",
|
66
|
+
".ogg",
|
67
|
+
".wma",
|
68
|
+
".aa",
|
69
|
+
".aax",
|
70
|
+
];
|
71
|
+
export const BOOK_EXTENSIONS = [
|
72
|
+
".epub",
|
73
|
+
".mobi",
|
74
|
+
".azw",
|
75
|
+
".azw3",
|
76
|
+
".azw4",
|
77
|
+
".pdf",
|
78
|
+
".djvu",
|
79
|
+
".html",
|
80
|
+
".chm",
|
81
|
+
".cbr",
|
82
|
+
".cbz",
|
83
|
+
".cb7",
|
84
|
+
".cbt",
|
85
|
+
".cba",
|
86
|
+
];
|
87
|
+
export const ALL_EXTENSIONS = [
|
88
|
+
...VIDEO_EXTENSIONS,
|
89
|
+
...AUDIO_EXTENSIONS,
|
90
|
+
...BOOK_EXTENSIONS,
|
91
|
+
...VIDEO_DISC_EXTENSIONS,
|
92
|
+
];
|
17
93
|
export const TORRENT_CACHE_FOLDER = "torrent_cache";
|
94
|
+
export const UNKNOWN_TRACKER = "UnknownTracker";
|
18
95
|
export var Action;
|
19
96
|
(function (Action) {
|
20
97
|
Action["SAVE"] = "save";
|
@@ -36,16 +113,33 @@ export var Decision;
|
|
36
113
|
Decision["MATCH"] = "MATCH";
|
37
114
|
Decision["MATCH_SIZE_ONLY"] = "MATCH_SIZE_ONLY";
|
38
115
|
Decision["MATCH_PARTIAL"] = "MATCH_PARTIAL";
|
116
|
+
Decision["FUZZY_SIZE_MISMATCH"] = "FUZZY_SIZE_MISMATCH";
|
39
117
|
Decision["SIZE_MISMATCH"] = "SIZE_MISMATCH";
|
118
|
+
Decision["PARTIAL_SIZE_MISMATCH"] = "PARTIAL_SIZE_MISMATCH";
|
40
119
|
Decision["NO_DOWNLOAD_LINK"] = "NO_DOWNLOAD_LINK";
|
41
120
|
Decision["DOWNLOAD_FAILED"] = "DOWNLOAD_FAILED";
|
121
|
+
Decision["MAGNET_LINK"] = "MAGNET_LINK";
|
42
122
|
Decision["RATE_LIMITED"] = "RATE_LIMITED";
|
43
123
|
Decision["INFO_HASH_ALREADY_EXISTS"] = "INFO_HASH_ALREADY_EXISTS";
|
44
124
|
Decision["FILE_TREE_MISMATCH"] = "FILE_TREE_MISMATCH";
|
45
125
|
Decision["RELEASE_GROUP_MISMATCH"] = "RELEASE_GROUP_MISMATCH";
|
46
126
|
Decision["BLOCKED_RELEASE"] = "BLOCKED_RELEASE";
|
47
127
|
Decision["PROPER_REPACK_MISMATCH"] = "PROPER_REPACK_MISMATCH";
|
128
|
+
Decision["RESOLUTION_MISMATCH"] = "RESOLUTION_MISMATCH";
|
129
|
+
Decision["SOURCE_MISMATCH"] = "SOURCE_MISMATCH";
|
48
130
|
})(Decision || (Decision = {}));
|
131
|
+
export function isAnyMatchedDecision(decision) {
|
132
|
+
return (decision === Decision.MATCH ||
|
133
|
+
decision === Decision.MATCH_SIZE_ONLY ||
|
134
|
+
decision === Decision.MATCH_PARTIAL);
|
135
|
+
}
|
136
|
+
export function isStaticDecision(decision) {
|
137
|
+
return (decision === Decision.RELEASE_GROUP_MISMATCH ||
|
138
|
+
decision === Decision.RESOLUTION_MISMATCH ||
|
139
|
+
decision === Decision.SOURCE_MISMATCH ||
|
140
|
+
decision === Decision.PROPER_REPACK_MISMATCH ||
|
141
|
+
decision === Decision.MAGNET_LINK);
|
142
|
+
}
|
49
143
|
export var MatchMode;
|
50
144
|
(function (MatchMode) {
|
51
145
|
MatchMode["SAFE"] = "safe";
|