Comments (5)
Suggestions for implementation approach
- Keep an unwanted fields list and copy all the fields except these from the OS response
var unwantedFields = ["imdb_status", "plot", "from_redis", "request_from", "id", "kind"];
_.extend(data.metadata,response.data);
_(unwantedFields).each(function(field){_.unset(data.metadata,field)});
// do all the processing like
// data.metadata.synopsis = response.data.plot && response.data.plot.match(/add a plot/i) !== null ? undefined : response.data.plot;
OR
2. In the options object send the list of fields the calling method expects from the result object, and copy only those fields in the identify.js
OpenSubtitles.identify({
path: "<path>",
extend:true,
extend_fields:["aka","awards","votes","goofs","etc","etc"]
}).then(function(result){
console.log(result);
});
I need all the fields returned by the OS API, and I wanted to use the 'opensubtitles-api' as is, without making any local changes to it. Request you to please implement the feature. Or if you could tell me which approach, I can make the changes and raise a pull request.
Regards,
Sarath
from opensubtitles-api.
Hi, you can use:
var data;
OpenSubtitles.identify({
path: 'foo/bar',
extend: false
}).then(function (res) {
data = res;
return OpenSubtitles.api.GetIMDBMovieDetails(OpenSubtitles.credentials.status.token, res.metadata.imdbid.replace('tt',''));
}).then(function (res) {
data.metadata = res.data;
return data;
})
I must have had a perfectly good reason for writing it that way, maybe the other results aren't consistent across requests? Or maybe it's because kind
is terribly written? If it were just about renaming 'plot' to 'synopsis', I wouldn't have gone that far. I don't recall and I'll have to check.
from opensubtitles-api.
May be because the response has totally unwanted fields like I mentioned in the code above?
from opensubtitles-api.
Thanks for the reply, I like the identify method you wrote, which pretty much does every check by itself and that's what I liked most about your api client. I know I can chain the method with other api calls to achieve what I want, but I would like to keep that logic in the library itself rather than writing in the main code. If you could make it happen that would be nice :) . For now I am keeping the local changes in the module for my app.
Regards,
from opensubtitles-api.
Well, thanks for that snippet.. :) . Its clean...
from opensubtitles-api.
Related Issues (20)
- Don't save file utf-8 char set on local folder with DonwloadSubtitles method HOT 1
- It does not work HOT 5
- [Feature request ] VTT HOT 5
- typescript support HOT 2
- Why results on the API and on the OpenSubtitles portal not always match? HOT 2
- Supported in browsers? HOT 3
- How does GetAvailableTranslations work? HOT 1
- Suggestion: Convert to async/await syntax HOT 4
- Suggestion: TypeScript HOT 2
- New NPM release HOT 2
- TypeScript type definitions HOT 4
- api limits 5 subtitles per request HOT 1
- Issue: vtt subtitle download not working HOT 4
- OpenSubtitles.search() not returning anything. HOT 11
- Make debug easier
- Episode title parsing TypeError
- TypeError: Cannot read property 'length' of undefined
- Typescript support not found. HOT 1
- Italian translation HOT 1
- Deprecation of XML RPC API by december 2023 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opensubtitles-api.