@xriss/weerss 0.0.12 → 0.0.13

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.
Files changed (4) hide show
  1. package/hoard.js +1 -1
  2. package/package.json +1 -1
  3. package/shows.js +12 -2
  4. package/weerss.js +14 -17
package/hoard.js CHANGED
@@ -69,7 +69,7 @@ hoard.fetch_text=async function(url,refresh)
69
69
  let timeout_id
70
70
  let res=await Promise.race([
71
71
  fetch(corsurl),
72
- new Promise(function(_, reject){ timeout_id=setTimeout(function(){reject("timeout")}, 2*1000) } ),
72
+ new Promise(function(_, reject){ timeout_id=setTimeout(function(){reject("timeout")}, 10*1000) } ),
73
73
  ])
74
74
  if(timeout_id) { clearTimeout(timeout_id) }
75
75
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xriss/weerss",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "source": "weerss.js",
5
5
  "type": "module",
6
6
  "repository": {
package/shows.js CHANGED
@@ -142,6 +142,8 @@ shows.get_show=async function(filename)
142
142
 
143
143
  let name=filename
144
144
  if(!name){return} // give up
145
+
146
+ item_tags=name.replace(/[^a-zA-Z0-9]/g," ").replace(/\s+/g," ").trim().toLowerCase().split(" ")
145
147
 
146
148
  if(!item_name)
147
149
  {
@@ -151,7 +153,6 @@ shows.get_show=async function(filename)
151
153
  item_name=shows.clean_name(aa[1])
152
154
  item_season=Number(aa[2])
153
155
  item_episode=Number(aa[3])
154
- item_tags=shows.clean_name(aa[4]).split(" ")
155
156
  }
156
157
  }
157
158
 
@@ -164,7 +165,6 @@ shows.get_show=async function(filename)
164
165
  item_name=aa[1].replace(/[^a-zA-Z0-9]/g," ").replace(/\s+/g," ").trim().toLowerCase()
165
166
  item_season=Number(aa[2]) // season is the year
166
167
  item_episode=Number(aa[3]+aa[4]) // join month and day to make a 4 digit episode number
167
- item_tags=aa[5].replace(/[^a-zA-Z0-9]/g," ").replace(/\s+/g," ").trim().toLowerCase().split(" ")
168
168
  item_date=aa[2]+"-"+aa[3]+"-"+aa[4]
169
169
  }
170
170
  }
@@ -276,7 +276,17 @@ shows.good_episode=function(show,rules)
276
276
  {
277
277
  if( !rules ) { return true }
278
278
 
279
+ let tvmaze=show.tvmaze||{}
279
280
  let flags={}
281
+
282
+ if( tvmaze.language ) { flags[ tvmaze.language.trim().toLowerCase() ]=true }
283
+ if( tvmaze.type ) { flags[ tvmaze.type.trim().toLowerCase() ]=true }
284
+ if( tvmaze.genres )
285
+ for( let genre of tvmaze.genres || [] )
286
+ {
287
+ flags[ genre.trim().toLowerCase() ]=true
288
+ }
289
+
280
290
  for( let tag of show.tags || [] )
281
291
  {
282
292
  flags[ tag.trim().toLowerCase() ]=true
package/weerss.js CHANGED
@@ -288,6 +288,19 @@ weerss.getlist=async function()
288
288
  }
289
289
  }
290
290
 
291
+ for( let idx=bucket.length-1 ; idx>0 ; idx-- ) // remove huge/small files
292
+ {
293
+ if( bucket[ idx ].torrent.file_length > weerss.config.episode.maxsize ) // 3GB
294
+ {
295
+ bucket.splice( idx , 1 )
296
+ }
297
+
298
+ if( bucket[ idx ].torrent.file_length < weerss.config.episode.minsize ) // 3GB
299
+ {
300
+ bucket.splice( idx , 1 )
301
+ }
302
+ }
303
+
291
304
 
292
305
  if( weerss.config.episode.best == "small" )
293
306
  {
@@ -307,23 +320,7 @@ weerss.getlist=async function()
307
320
  error("unknown config.episode.best option")
308
321
  }
309
322
 
310
- while( bucket.length>0 ) // be real picky about size
311
- {
312
- if( bucket[ bucket.length-1 ].torrent.file_length > weerss.config.episode.maxsize ) // 3GB
313
- {
314
- bucket.pop()
315
- }
316
- else
317
- if( bucket[ 0 ].torrent.file_length < weerss.config.episode.minsize ) // 3GB
318
- {
319
- bucket.shift()
320
- }
321
- else
322
- {
323
- break
324
- }
325
- }
326
- while( bucket.length>0 ) // check episode flags
323
+ while( bucket.length>0 ) // check episode flags ( uses words from filename + all the show flags )
327
324
  {
328
325
  if( ! shows.good_episode(bucket[ 0 ].show,weerss.config.episode.rules) ) // skip this episode?
329
326
  {