@xriss/weerss 0.0.15 → 0.0.17

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 (3) hide show
  1. package/package.json +1 -1
  2. package/shows.js +14 -20
  3. package/weerss.js +17 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xriss/weerss",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "source": "weerss.js",
5
5
  "type": "module",
6
6
  "repository": {
package/shows.js CHANGED
@@ -253,13 +253,18 @@ if(weerss.config.debug)
253
253
  }
254
254
 
255
255
  // is this show good?
256
- shows.good_show=function(show,rules)
256
+ shows.good_show=function(show,rules,moretags)
257
257
  {
258
258
  if( !rules ) { return true }
259
259
 
260
260
  let tvmaze=show.tvmaze||{}
261
261
 
262
262
  let flags={}
263
+ if( tvmaze.schedule && tvmaze.schedule.days )
264
+ {
265
+ if( tvmaze.schedule.days.length > 1 ) // flag as soapie if multiple days a week
266
+ { flags[ "soapie" ]=true }
267
+ }
263
268
  if( tvmaze.language ) { flags[ tvmaze.language.trim().toLowerCase() ]=true }
264
269
  if( tvmaze.type ) { flags[ tvmaze.type.trim().toLowerCase() ]=true }
265
270
  if( tvmaze.genres )
@@ -267,6 +272,13 @@ shows.good_show=function(show,rules)
267
272
  {
268
273
  flags[ genre.trim().toLowerCase() ]=true
269
274
  }
275
+ if( moretags )
276
+ {
277
+ for( let tag of moretags )
278
+ {
279
+ flags[ tag.trim().toLowerCase() ]=true
280
+ }
281
+ }
270
282
 
271
283
  return check_flags(flags,rules)
272
284
  }
@@ -274,23 +286,5 @@ shows.good_show=function(show,rules)
274
286
  // is this episode good?
275
287
  shows.good_episode=function(show,rules)
276
288
  {
277
- if( !rules ) { return true }
278
-
279
- let tvmaze=show.tvmaze||{}
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
-
290
- for( let tag of show.tags || [] )
291
- {
292
- flags[ tag.trim().toLowerCase() ]=true
293
- }
294
-
295
- return check_flags(flags,rules)
289
+ return shows.good_show( show , rules , show.tags )
296
290
  }
package/weerss.js CHANGED
@@ -288,16 +288,20 @@ weerss.getlist=async function()
288
288
  }
289
289
  }
290
290
 
291
- for( let idx=bucket.length-1 ; idx>0 ; idx-- ) // remove huge/small files
291
+ for( let idx=bucket.length-1 ; idx>=0 ; idx-- ) // remove huge/small files
292
292
  {
293
- if( bucket[ idx ].torrent.file_length > weerss.config.episode.maxsize ) // 3GB
293
+ let it=bucket[ idx ]
294
+ if( it && it.torrent && it.torrent.file_length )
294
295
  {
295
- bucket.splice( idx , 1 )
296
- }
296
+ if( it.torrent.file_length > weerss.config.episode.maxsize ) // 3GB
297
+ {
298
+ bucket.splice( idx , 1 )
299
+ }
297
300
 
298
- if( bucket[ idx ].torrent.file_length < weerss.config.episode.minsize ) // 3GB
299
- {
300
- bucket.splice( idx , 1 )
301
+ if( it.torrent.file_length < weerss.config.episode.minsize ) // 3GB
302
+ {
303
+ bucket.splice( idx , 1 )
304
+ }
301
305
  }
302
306
  }
303
307
 
@@ -305,14 +309,18 @@ weerss.getlist=async function()
305
309
  if( weerss.config.episode.best == "small" )
306
310
  {
307
311
  bucket.sort(function(a,b){
308
- return a.torrent.file_length - b.torrent.file_length
312
+ let al=(a && a.torrent && a.torrent.file_length) || 0
313
+ let bl=(b && b.torrent && b.torrent.file_length) || 0
314
+ return al - bl
309
315
  })
310
316
  }
311
317
  else
312
318
  if( weerss.config.episode.best == "large" )
313
319
  {
314
320
  bucket.sort(function(a,b){
315
- return b.torrent.file_length - a.torrent.file_length
321
+ let al=(a && a.torrent && a.torrent.file_length) || 0
322
+ let bl=(b && b.torrent && b.torrent.file_length) || 0
323
+ return bl - al
316
324
  })
317
325
  }
318
326
  else