edwellbrook / node-tvdb

Node.js library for accessing TheTVDB API
https://edwellbrook.github.io/node-tvdb/
MIT License
65 stars 28 forks source link

this.language = language || 'en'; #139

Closed tunailgaz closed 4 years ago

tunailgaz commented 4 years ago

this default option gives me outdated values all the time, changed to 'us' after that i am getting updated values

didnt even check if 'us' is a valid language or not.. just saying

tunailgaz commented 4 years ago

ok i checked languages there is no 'us' abbreviation. so if you dont set any language, by default this lib sets to 'en' and asks for 'en' updates, if anyone wants to get all available data not just 'en' you can pass invalid abbreviation to this libs constructor and you get all available data. ex: const TheTVDB = require("node-tvdb"); const tvdb = new TheTVDB(API_KEY,'us'); // 'us' is invalid but overwrites the 'en'

edwellbrook commented 4 years ago

Hey there! Thanks for opening a PR.

Could you talk me through what you're trying to do here? If the library works as-is and there's a use case that could have been better documented, please let me know!

Cheers!

tunailgaz commented 4 years ago

Hey there! Thanks for opening a PR.

Could you talk me through what you're trying to do here? If the library works as-is and there's a use case that could have been better documented, please let me know!

Cheers!

yes sir let me try to explain. lets assume there is a abc series on tvdb, and it has 1 season 5 episodes. I was trying to get 'abc' episodes by using getEpisodesBySeriesId function, and result had 4 episodes... but on website there are 5 episodes. Then, i found that getEpisodesBySeriesId requesting with 'en' language by default and if there are no 'en' updates, tvdb sends only 'en' results which might exclude some episodes. However if you provide a wrong abbreviation like 'us' it sends all the available data which includes all 5 episodes. Finally, i think setting 'en' as default language should be removed.

index.js line 46 this.language = language || 'en'; this line should be if(language){ this.language = language } in my opinion. anyway hope i explained myself. And ignore my PR, because there is no 'us' abbreviation.

OmgImAlexis commented 4 years ago

@tunailgaz if you need en-us as your default then pass it through. This PR should be closed.