Skip to content
This repository has been archived by the owner on Oct 2, 2020. It is now read-only.

Commit

Permalink
Implement Netflix search in non-USA countries
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceK33z committed Jan 10, 2017
1 parent 7cab821 commit d060ba1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ To update, just run the command above again.
First, you need to get your [API token from Plex](https://support.plex.tv/hc/en-us/articles/204059436-Finding-your-account-token-X-Plex-Token).

```
plex2netflix --host 192.168.0.42 --token=xxx --section=Movies
plex2netflix --host 192.168.0.42 --token=xxx --country=us --section=Movies
```

By default it searches the Netflix library of the US. You can specify `--country` to let it search in a Netflix library of a different country. For example, to search in the Netherlands, add `--country=nl`.

Optionally comma-separate the sections like `--section=Movies,Shows`. If you leave out `--section`, it will try to automatically find libraries.

If your Plex server lives at a non-default port, you can use `--port`.
Expand Down
2 changes: 1 addition & 1 deletion lib/apis/plex2netflix-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = function (media) {
})
.then((response) => {
const countries = response.body.countries;
resolve([media, countries.includes('us')]);
resolve([media, countries]);
})
.catch((err) => {
reject([media, err]);
Expand Down
2 changes: 2 additions & 0 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const argv = yargs
.string('section').alias('section', 's').describe('section', 'Comma-separated library section titles from Plex')
.demand('token').alias('token', 't').describe('token', 'API token from Plex')
.string('host').default('host', '127.0.0.1').describe('host', 'Hostname for Plex Web')
.string('country').default('country', 'us').describe('country', 'Country code for Netflix')
.default('port', 32400).describe('port', 'Port for Plex Web')
.boolean('show-imdb').default('show-imdb', false).describe('show-imdb', 'Show IMDb IDs in the output')
.describe('year', 'Filter media in library section on release year')
Expand All @@ -21,4 +22,5 @@ new Plex2Netflix({ // eslint-disable-line no-new
port: argv.port,
year: argv.year,
showImdb: argv.showImdb,
country: argv.country,
});
4 changes: 2 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ Plex2Netflix.prototype.getMediaForSection = function (sectionUri) {
return this.getMediaMetadata(item.key)
.then(plex2NetflixServer)
.then((args) => {
const [mediaItem, isAvailable] = args;
if (isAvailable) {
const [mediaItem, countryList] = args;
if (countryList.includes(this.options.country)) {
availableCounter += 1;
return this.reportOption('movieAvailable', mediaItem);
}
Expand Down

0 comments on commit d060ba1

Please sign in to comment.