Skip to content

Commit

Permalink
add API URL and query for TV search
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Porsch committed May 1, 2014
1 parent 0f753f7 commit 9041cc3
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/qml/moviedbwrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ function TMDb(app_locale) {
_addField(this.config['version']) + _addField('genre')
this.method['movie_get_info'] = this.config['baseUrl'] +
_addField(this.config['version']) + _addField('movie')
this.method['tv_get_info'] = this.config['baseUrl'] +
_addField(this.config['version']) + _addField('tv')
this.method['person_get_info'] = this.config['baseUrl'] +
_addField(this.config['version']) + _addField('person')
this.method['genres_get_list'] = this.config['baseUrl'] +
Expand Down Expand Up @@ -259,6 +261,36 @@ function movie_info(movie_id, details, config) {
return url
}

/**
* Wrapper method which provides the API url for getting the full TV show info,
* and accepts the movie TMDB id and the custom configuration
*
* @param {string} The tv show's TMDB id to look up
* @param {string} The comma-separated TV show details to look for, leave empty for general info
* @param {object} The custom configuration for the look up. Values typically
* changed could be the app_locale.
* @return {string} API url for looking up TV show information
*/
function tv_info(id, details, config) {
if (!config)
config = { }
var wrapper = instance(config.app_locale)
var url = ''
if (details.indexOf(',') > -1)
url = wrapper.getCommonUrl('tv_get_info', config) +
_addField(id) +
_addArgument(wrapper.config['key_param'], wrapper.config['key_value'], '?') +
_addArgument(wrapper.config['lang_param'], wrapper.config['lang_value']) +
_addArgument('append_to_response', encodeURI(details))
else
url = wrapper.getCommonUrl('tv_get_info', config) +
_addField(id) + _addField(details) +
_addArgument(wrapper.config['key_param'], wrapper.config['key_value'], '?') +
_addArgument(wrapper.config['lang_param'], wrapper.config['lang_value'])
console.debug('** TV GET INFO URL:', url)
return url
}

/**
* Wrapper method which provides the API url for getting the full person info,
* and accepts the person TMDB id and the custom configuration
Expand Down

0 comments on commit 9041cc3

Please sign in to comment.