@xriss/weerss 0.0.13 → 0.0.15

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 +3 -3
  3. package/weerss.js +26 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xriss/weerss",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "source": "weerss.js",
5
5
  "type": "module",
6
6
  "repository": {
package/shows.js CHANGED
@@ -82,7 +82,7 @@ shows.get_tvmaze=async function(show,force)
82
82
  let show_year
83
83
  let show_country
84
84
  let show_name=show.name
85
- let qurl="https://api.tvmaze.com/search/shows?q="+show_name.replaceAll(" ","+")
85
+ let qurl="https://api.tvmaze.com/search/shows?q="+show_name.replaceAll(" ","%20")
86
86
  await new Promise(resolve => setTimeout(resolve, 500)) // do not spam requests
87
87
  let tvmaze=await shows.fetch(qurl,force)
88
88
 
@@ -92,7 +92,7 @@ shows.get_tvmaze=async function(show,force)
92
92
  {
93
93
  show_year=show_name.substring(show_name.length-4)
94
94
  show_name=show_name.substring(0,show_name.length-5)
95
- qurl="https://api.tvmaze.com/search/shows?q="+show_name.replaceAll(" ","+")
95
+ qurl="https://api.tvmaze.com/search/shows?q="+show_name.replaceAll(" ","%20")
96
96
  await new Promise(resolve => setTimeout(resolve, 500)) // do not spam requests
97
97
  tvmaze=await shows.fetch(qurl,force)
98
98
  if(tvmaze)
@@ -108,7 +108,7 @@ shows.get_tvmaze=async function(show,force)
108
108
  {
109
109
  show_country=show_name.substring(show_name.length-2)
110
110
  show_name=show_name.substring(0,show_name.length-3)
111
- qurl="https://api.tvmaze.com/search/shows?q="+show_name.replaceAll(" ","+")
111
+ qurl="https://api.tvmaze.com/search/shows?q="+show_name.replaceAll(" ","%20")
112
112
  await new Promise(resolve => setTimeout(resolve, 500)) // do not spam requests
113
113
  tvmaze=await shows.fetch(qurl,force)
114
114
  if(tvmaze)
package/weerss.js CHANGED
@@ -485,17 +485,25 @@ weerss.move=async function(args)
485
485
  let show=await shows.get_show(base+ext)
486
486
  if( show )
487
487
  {
488
- let xtra=""
489
- if(show.year)
490
- {
491
- xtra=xtra+" ("+show.year+")"
492
- }
493
-
494
488
  let SxxExx=("S"+show.season.toString().padStart(2, "0")+"E"+show.episode.toString().padStart(2, "0") )
495
489
 
496
490
  // console.log(base , show.tvmaze.name , show.season , show.episode)
497
- let showname=show.tvmaze.name.replace(/[/\\?%*:|"<>]/g, "-") // remove problematic chars
498
- let to = showname+xtra+"/Season "+show.season+"/"+showname+" "+SxxExx+ext
491
+ // let showname=show.tvmaze.name.replace(/[/\\?%*:|"<>]/g, "-") // remove problematic chars
492
+
493
+ let tvname=sanitize(show.tvmaze.name,{replacement:""})
494
+ let country=show.tvmaze.network && show.tvmaze.network.country && show.tvmaze.network.country.code
495
+ let year=show.tvmaze.premiered && show.tvmaze.premiered.substr(0,4)
496
+ if(country)
497
+ {
498
+ tvname=tvname+" ("+country+")" // put country in dirname
499
+ }
500
+ if(year)
501
+ {
502
+ tvname=tvname+" ("+year+")" // put year in dirname
503
+ }
504
+ let esctvname=`'${tvname.replace(/'/g, `'\\''`)}'`
505
+
506
+ let to = tvname+"/Season "+show.season+"/"+tvname+" "+SxxExx+ext
499
507
  console.log(file)
500
508
 
501
509
  if( dest )
@@ -566,12 +574,17 @@ weerss.dirs=async function(args)
566
574
  console.log(`echo ${escfile}`)
567
575
  if( show.tvmaze )
568
576
  {
569
- let tvname=sanitize(show.tvmaze.name)
570
- let year=file.match(/\((\d\d\d\d)\)/);
571
- year=year && year[1]
577
+ //console.log(show.tvmaze)
578
+ let tvname=sanitize(show.tvmaze.name,{replacement:""})
579
+ let country=show.tvmaze.network && show.tvmaze.network.country && show.tvmaze.network.country.code
580
+ let year=show.tvmaze.premiered && show.tvmaze.premiered.substr(0,4)
581
+ if(country)
582
+ {
583
+ tvname=tvname+" ("+country+")" // put country in dirname
584
+ }
572
585
  if(year)
573
586
  {
574
- tvname=tvname+" ("+year+")" // keep year in dirname
587
+ tvname=tvname+" ("+year+")" // put year in dirname
575
588
  }
576
589
  let esctvname=`'${tvname.replace(/'/g, `'\\''`)}'`
577
590
  let good=shows.good_show(show,weerss.config.show.rules)
@@ -593,7 +606,7 @@ weerss.dirs=async function(args)
593
606
  console.log(`rm -rf ${escfile}`)
594
607
  }
595
608
 
596
- await new Promise(resolve => setTimeout(resolve, 500))
609
+ // await new Promise(resolve => setTimeout(resolve, 500))
597
610
 
598
611
  }catch(e){console.log(e)}
599
612
  }