Created
June 29, 2012 07:47
-
-
Save CF-Terence/3016533 to your computer and use it in GitHub Desktop.
XBMC search function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Function: Search the array list of TV shows and get the results that matches exactly/contain the characters in the search string | |
*/ | |
self.getSearchedMovieArray = function(search_string){ | |
//CF.setJoin("d"+(listJoin+1), 0); //hide the movie wall list | |
//CF.setJoin("d"+listJoin, 1); // show the thumbnail and title wall list only. | |
//push all values into array into a singular format | |
self.rpc("VideoLibrary.GetMovies", { "sort": {"order": "ascending", "method": "label"}, "properties": ["playcount", "title", "thumbnail", "fanart"]}, function(data) { | |
MovieSearchlistArray = []; | |
//CF.listRemove("l"+listJoin); | |
for (i=0; i<data.result.limits.total; i++) { | |
var thumbnail = self.URL + "vfs/" + data.result.movies[i].thumbnail; | |
var movieid = data.result.movies[i].movieid; | |
var title = decode_utf8(data.result.movies[i].title); | |
var playcount = data.result.movies[i].playcount; | |
if(newCompare(title, search_string)) // refer to newCompare() from customised function section) | |
{ | |
//CF.log(thumbnail); | |
//CF.log(movieid); | |
//CF.log(title); | |
MovieSearchlistArray.push({ // Add to array to add to list in one go later | |
s1: thumbnail, | |
s2: title, | |
s5: "[MOVIES] All Movies", | |
d1: { | |
tokens: { | |
"[id]": movieid, | |
"[showname]": title | |
} | |
}, | |
d2: (playcount > 0) ? 1 : 0, | |
}); | |
} else { | |
//CF.log(thumbnail); | |
//CF.log(movieid); | |
//CF.log(title); | |
MovieSearchlistArray.push({ // Add to array to add to list in one go later | |
s1: thumbnail, | |
s2: title, | |
s5: "[MOVIES] All Movies", | |
d1: { | |
tokens: { | |
"[id]": movieid, | |
"[showname]": title | |
} | |
}, | |
d2: (playcount > 0) ? 1 : 0, | |
}); | |
} | |
}//end for loop | |
//CF.listAdd("l"+baseJoin, templistArray ); | |
//CF.listAdd("l"+listJoin, MovieSearchlistArray); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment