IMDb BBCode

Started by Chen Zhen, August 16, 2014, 01:32:26 pm

Previous topic - Next topic

Chen Zhen

August 16, 2014, 01:32:26 pm Last Edit: August 27, 2014, 12:19:23 am by Napalm
Due to legal aspects of IMDb's policy, only links to their database are permitted therefore the original IMDb code using a 3rd party API has been removed. In its stead I am providing an alternative Movie data source BBCode from the TMDb API.

TMDb BBCode:

Please note that due to the TMDb policy the logo/link located within the BBCode should remain.

NOTE: Remember to change ######## from the code shown below to your TMDb API key.
You must register on the TMDb website and apply for your own API key.






BBCodes using type: [tag]content[/tag]
Examples:
Code Select

[tmdb]movie/268[/tmdb]

[tmdb]tv/13916[/tmdb]

[tmdb]tv/1705[/tmdb]



Code for PersonalizedBBC:
Code Select

<!-- TMDb API scrape code c/o Napalm @ web-develop.ca -->
<!-- Last upated: Aug.26/2014 -->
<!-- Replace ######## with your API key -->
<script type="text/javascript">
var my_tmdb_api = "########";
var myUndefinedMsg = 'TMDb data not found';
var myMaxHeight = "100%";
function myInArray(mediaType, mediaTypes)
{
for(var i = 0; i < mediaTypes.length; i++)
if(mediaTypes[i] === mediaType)
return true;

return false;
}
function myStrPos(haystack, needle, offset)
{
var i = (haystack + '').indexOf(needle, (offset || 0));
return i === -1 ? false : true;
}
var req = new XMLHttpRequest();
var myMediaContent = "{content}", myGenres = "", myLanguages = "", myCompanies = "", myCreatedBy = "",myProducers = "",myActors = "", myActorsChars = "", myMovie = new Array, myMediaArray = ["tv", "movie"];
var myMediaType = myMediaContent.split("/")[0];
myMediaType = myInArray(myMediaType, myMediaArray) ? myMediaType : "movie";
var myMedia = myStrPos(myMediaContent,myMediaType + "/") ? myMediaContent : myMediaType + "/" + myMediaContent;
req.open("GET", "https://api.themoviedb.org/3/" + myMedia + "?api_key=" + my_tmdb_api + "&append_to_response=external_ids,credits,releases", false);
req.send(null);

if(req.responseText)
{
var myMovie = JSON.parse(req.responseText);
if (myMovie["title"] !== undefined && myMediaType === "movie")
{
if (myMovie["overview"].length > 200)
var myOverview = "<span style=\"width:300px;height:50px;line-height:1.3em;overflow-x:hidden;oveflow-y:scroll;padding:3px;display:inline-block;\">" + myMovie["overview"] + "</span>";
else
var myOverview = myMovie["overview"];
var myPoster = "http://image.tmdb.org/t/p/w185" + myMovie["poster_path"];
var myRated = myMovie["releases"]["countries"][0]["certification"] ? myMovie["releases"]["countries"][0]["certification"] : "?";
var myMonths = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
var myDate = myMovie["release_date"].split("-");
for (i=0; i < myMovie["genres"].length; i++)
myGenres += myMovie["genres"][i]["name"] + ", ";
for (i=0; i < myMovie["spoken_languages"].length; i++)
myLanguages += myMovie["spoken_languages"][i]["name"] + ", ";
for (i=0; i < myMovie["production_companies"].length; i++)
myCompanies += myMovie["production_companies"][i]["name"] + ", ";
for (i=0; i < myMovie["credits"]["cast"].length; i++)
{
myActors += "<a title=\"Profile for " + myMovie["credits"]["cast"][i]["name"] + "\" href=\"https://www.themoviedb.org/person/" + myMovie["credits"]["cast"][i]["id"] + "\">" + myMovie["credits"]["cast"][i]["name"] + "</a>, ";
myActorsChars += myMovie["credits"]["cast"][i]["name"] + ", ";
}
for (i=0; i < myMovie["credits"]["crew"].length; i++)
{
if (myMovie["credits"]["crew"][i]["job"] === "Producer")
myProducers += "<a title=\"Profile for " + myMovie["credits"]["crew"][i]["name"] + "\" href=\"https://www.themoviedb.org/person/" + myMovie["credits"]["crew"][i]["id"] + "\">" + myMovie["credits"]["crew"][i]["name"] + "</a>, ";
}
if (myActorsChars.length > 100)
var myCast = "<span style=\"width:300px;height:25px;line-height:1.3em;overflow-x:hidden;oveflow-y:scroll;padding:3px;display:inline-block;\">" + myActors.trim().replace(/(^,)|(,$)/g, "") + "</span>";
else
var myCast = myActors.trim().replace(/(^,)|(,$)/g, "");

document.write("<div style=\"display:table-row;overflow:hidden;\">");
document.write("<span style=\"table-cell;float:left;\">");
document.write("<img style=\"width:180px;height:280px;\" src=\"" + myPoster + "\" alt=\"\" /><br />");
document.write("</span>");
document.write("<span style=\"table-cell;float:right;margin-left: 15px;font-family: Helvetica, sans-serif; font-size: 12px;max-width: 300px;max-height: "+ myMaxHeight + ";line-height: 16px;\">");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Title:</h2> " + "<a title=\"IMDb Website\" href= \"http://www.imdb.com/title/" + myMovie["imdb_id"] + "/?ref_=inth_ov_i\">" + myMovie["title"] + "</a></span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Type:</h2> " + myMediaType.charAt(0).toUpperCase() + myMediaType.slice(1) + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Genre:</h2> " + myGenres.trim().replace(/(^,)|(,$)/g, "") + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Language:</h2> " + myLanguages.trim().replace(/(^,)|(,$)/g, "") + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Rated:</h2> " + myRated + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Released:</h2> " + myDate[2] + " " + myMonths[parseInt(myDate[1],10)] + " " + myDate[0] + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">TMBd Rating:</h2> " + myMovie["vote_average"] + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Production Companies:</h2> " + myCompanies.trim().replace(/(^,)|(,$)/g, "") + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Producers:</h2> " + myProducers.trim().replace(/(^,)|(,$)/g, "") + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Cast:</h2> " + myCast + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Plot:</h2> " + myOverview + "</span><br />");
document.write("<span style=\"margin-bottom: 0px;\"><a href=\"https://www.themoviedb.org/movie/" + myMovie["id"] + "\"><img title=\"TMDb Website\" style=\"width:80px;height:15px;\" src=\"https://d3a8mw37cqal2z.cloudfront.net/assets/8d0e15fe2a8e8abf7b14876f9a4f8158/images/tmdb-logo.png\" alt=\"\" /></a></span>");
document.write("</span>");
document.write("</div>");
}
else if (myMovie["name"] !== undefined && myMediaType === "tv")
{
if (myMovie["overview"].length > 100)
var myOverview = "<span style=\"width:300px;height:50px;line-height:1.3em;overflow-x:hidden;oveflow-y:scroll;padding:3px;display:inline-block;\">" + myMovie["overview"] + "</span>";
else
var myOverview = myMovie["overview"];
var myPoster = "http://image.tmdb.org/t/p/w185" + myMovie["seasons"][0]["poster_path"];
var myMonths = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
var myDate = myMovie["first_air_date"].split("-");
var myLastDate = myMovie["last_air_date"].split("-");
var myImdbId = myMovie["external_ids"]["imdb_id"];
for (i=0; i < myMovie["genres"].length; i++)
myGenres += myMovie["genres"][i]["name"] + ", ";
for (i=0; i < myMovie["languages"].length; i++)
myLanguages += myMovie["languages"][i] + ", ";
for (i=0; i < myMovie["networks"].length; i++)
myCompanies += myMovie["networks"][i]["name"] + ", ";
for (i=0; i < myMovie["created_by"].length; i++)
myCreatedBy += myMovie["created_by"][i]["name"] + ", ";
for (i=0; i < myMovie["credits"]["cast"].length; i++)
{
myActors += "<a title=\"Profile for " + myMovie["credits"]["cast"][i]["name"] + "\" href=\"https://www.themoviedb.org/person/" + myMovie["credits"]["cast"][i]["id"] + "\">" + myMovie["credits"]["cast"][i]["name"] + "</a>, ";
myActorsChars += myMovie["credits"]["cast"][i]["name"] + ", ";
}
if (myActorsChars.length > 100)
var myCast = "<span style=\"width:300px;height:25px;line-height:1.3em;overflow-x:hidden;oveflow-y:scroll;padding:3px;display:inline-block;\">" + myActors.trim().replace(/(^,)|(,$)/g, "") + "</span>";
else
var myCast = myActors.trim().replace(/(^,)|(,$)/g, "");

document.write("<div style=\"display:table-row;\">");
document.write("<span style=\"table-cell;float:left;\">");
document.write("<img style=\"width:180px;height:280px;overflow:hidden;\" src=\"" + myPoster + "\" alt=\"\" /><br />");
document.write("</span>");
document.write("<span style=\"table-cell;float:right;margin-left: 15px;font-family: Helvetica, sans-serif; font-size: 12px; max-width: 300px;max-height: " + myMaxHeight + ";line-height:16px;\">");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Title:</h2> " + "<a title=\"IMDb Website\" href= \"http://www.imdb.com/title/" + myImdbId + "/?ref_=inth_ov_i\">" + myMovie["name"] + "</a></span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Type:</h2> " + myMediaType.charAt(0).toUpperCase() + myMediaType.slice(1) + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Created By:</h2> " + myCreatedBy.trim().replace(/(^,)|(,$)/g, "") + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Genres:</h2> " + myGenres.trim().replace(/(^,)|(,$)/g, "") + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Language:</h2> " + myLanguages.trim().replace(/(^,)|(,$)/g, "") + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Seasons:</h2> " + myMovie["number_of_seasons"] + "</span> / ");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Episodes:</h2> " + myMovie["number_of_episodes"] + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Release Date:</h2> " + myDate[2] + " " + myMonths[parseInt(myDate[1],10)] + " " + myDate[0] + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Last Aired:</h2> " + myLastDate[2] + " " + myMonths[parseInt(myLastDate[1],10)] + " " + myLastDate[0] + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">TMBd Rating:</h2> " + myMovie["vote_average"] + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Networks:</h2> " + myCompanies.trim().replace(/(^,)|(,$)/g, "") + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Status:</h2> " + myMovie["status"] + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Cast:</h2> " + myCast + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Plot:</h2> " + (myMovie["overview"] ? myOverview : "n/a") + "</span><br />");
document.write("<span style=\"margin-bottom: 0px;\"><a href=\"https://www.themoviedb.org/" + myMedia + "\"><img title=\"TMDb Website\" style=\"width:80px;height:15px;\" src=\"https://d3a8mw37cqal2z.cloudfront.net/assets/8d0e15fe2a8e8abf7b14876f9a4f8158/images/tmdb-logo.png\" alt=\"\" /></a></span>");
document.write("</span>");
document.write("</div>");
}
else
document.write(myUndefinedMsg + "<br />");
}
else
document.write(myUndefinedMsg + "<br />");
</script>






BBCodes using type: [tag=option]content[/tag]
Examples:
Code Select

[tmdb=movie]268[/tmdb]

[tmdb=tv]13916[/tmdb]

[tmdb=tv]1705[/tmdb]



Code for PersonalizedBBC:
Code Select

<!-- TMDb API scrape code c/o Napalm @ web-develop.ca -->
<!-- Last upated: Aug.26/2014 -->
<!-- Replace ######## with your API key -->
<script type="text/javascript">
var my_tmdb_api = "########";
var myUndefinedMsg = 'TMDb data not found';
var myMaxHeight = "100%";
function myInArray(mediaType, mediaTypes)
{
for(var i = 0; i < mediaTypes.length; i++)
if(mediaTypes[i] === mediaType)
return true;

return false;
}
var req = new XMLHttpRequest();
var myMediaType = "{option}";
var myMediaContent = "{content}", myGenres = "", myLanguages = "", myCompanies = "", myCreatedBy = "",myProducers = "",myActors = "", myActorsChars = "", myMovie = new Array, myMediaArray = ["tv", "movie"];
myMediaType = myInArray(myMediaType, myMediaArray) ? myMediaType : "movie";
var myMedia = myMediaType + "/" + myMediaContent;
req.open("GET", "https://api.themoviedb.org/3/" + myMedia + "?api_key=" + my_tmdb_api + "&append_to_response=external_ids,credits,releases", false);
req.send(null);

if(req.responseText)
{
var myMovie = JSON.parse(req.responseText);
if (myMovie["title"] !== undefined && myMediaType === "movie")
{
if (myMovie["overview"].length > 200)
var myOverview = "<span style=\"width:300px;height:50px;line-height:1.3em;overflow-x:hidden;oveflow-y:scroll;padding:3px;display:inline-block;\">" + myMovie["overview"] + "</span>";
else
var myOverview = myMovie["overview"];
var myPoster = "http://image.tmdb.org/t/p/w185" + myMovie["poster_path"];
var myRated = myMovie["releases"]["countries"][0]["certification"] ? myMovie["releases"]["countries"][0]["certification"] : "?";
var myMonths = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
var myDate = myMovie["release_date"].split("-");
for (i=0; i < myMovie["genres"].length; i++)
myGenres += myMovie["genres"][i]["name"] + ", ";
for (i=0; i < myMovie["spoken_languages"].length; i++)
myLanguages += myMovie["spoken_languages"][i]["name"] + ", ";
for (i=0; i < myMovie["production_companies"].length; i++)
myCompanies += myMovie["production_companies"][i]["name"] + ", ";
for (i=0; i < myMovie["credits"]["cast"].length; i++)
{
myActors += "<a title=\"Profile for " + myMovie["credits"]["cast"][i]["name"] + "\" href=\"https://www.themoviedb.org/person/" + myMovie["credits"]["cast"][i]["id"] + "\">" + myMovie["credits"]["cast"][i]["name"] + "</a>, ";
myActorsChars += myMovie["credits"]["cast"][i]["name"] + ", ";
}
for (i=0; i < myMovie["credits"]["crew"].length; i++)
{
if (myMovie["credits"]["crew"][i]["job"] === "Producer")
myProducers += "<a title=\"Profile for " + myMovie["credits"]["crew"][i]["name"] + "\" href=\"https://www.themoviedb.org/person/" + myMovie["credits"]["crew"][i]["id"] + "\">" + myMovie["credits"]["crew"][i]["name"] + "</a>, ";
}
if (myActorsChars.length > 100)
var myCast = "<span style=\"width:300px;height:25px;line-height:1.3em;overflow-x:hidden;oveflow-y:scroll;padding:3px;display:inline-block;\">" + myActors.trim().replace(/(^,)|(,$)/g, "") + "</span>";
else
var myCast = myActors.trim().replace(/(^,)|(,$)/g, "");

document.write("<div style=\"display:table-row;overflow:hidden;\">");
document.write("<span style=\"table-cell;float:left;\">");
document.write("<img style=\"width:180px;height:280px;\" src=\"" + myPoster + "\" alt=\"\" /><br />");
document.write("</span>");
document.write("<span style=\"table-cell;float:right;margin-left: 15px;font-family: Helvetica, sans-serif; font-size: 12px;max-width: 300px;max-height: "+ myMaxHeight + ";line-height: 16px;\">");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Title:</h2> " + "<a title=\"IMDb Website\" href= \"http://www.imdb.com/title/" + myMovie["imdb_id"] + "/?ref_=inth_ov_i\">" + myMovie["title"] + "</a></span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Type:</h2> " + myMediaType.charAt(0).toUpperCase() + myMediaType.slice(1) + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Genre:</h2> " + myGenres.trim().replace(/(^,)|(,$)/g, "") + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Language:</h2> " + myLanguages.trim().replace(/(^,)|(,$)/g, "") + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Rated:</h2> " + myRated + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Released:</h2> " + myDate[2] + " " + myMonths[parseInt(myDate[1],10)] + " " + myDate[0] + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">TMBd Rating:</h2> " + myMovie["vote_average"] + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Production Companies:</h2> " + myCompanies.trim().replace(/(^,)|(,$)/g, "") + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Producers:</h2> " + myProducers.trim().replace(/(^,)|(,$)/g, "") + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Cast:</h2> " + myCast + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Plot:</h2> " + myOverview + "</span><br />");
document.write("<span style=\"margin-bottom: 0px;\"><a href=\"https://www.themoviedb.org/movie/" + myMovie["id"] + "\"><img title=\"TMDb Website\" style=\"width:80px;height:15px;\" src=\"https://d3a8mw37cqal2z.cloudfront.net/assets/8d0e15fe2a8e8abf7b14876f9a4f8158/images/tmdb-logo.png\" alt=\"\" /></a></span>");
document.write("</span>");
document.write("</div>");
}
else if (myMovie["name"] !== undefined && myMediaType === "tv")
{
if (myMovie["overview"].length > 100)
var myOverview = "<span style=\"width:300px;height:50px;line-height:1.3em;overflow-x:hidden;oveflow-y:scroll;padding:3px;display:inline-block;\">" + myMovie["overview"] + "</span>";
else
var myOverview = myMovie["overview"];
var myPoster = "http://image.tmdb.org/t/p/w185" + myMovie["seasons"][0]["poster_path"];
var myMonths = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
var myDate = myMovie["first_air_date"].split("-");
var myLastDate = myMovie["last_air_date"].split("-");
var myImdbId = myMovie["external_ids"]["imdb_id"];
for (i=0; i < myMovie["genres"].length; i++)
myGenres += myMovie["genres"][i]["name"] + ", ";
for (i=0; i < myMovie["languages"].length; i++)
myLanguages += myMovie["languages"][i] + ", ";
for (i=0; i < myMovie["networks"].length; i++)
myCompanies += myMovie["networks"][i]["name"] + ", ";
for (i=0; i < myMovie["created_by"].length; i++)
myCreatedBy += myMovie["created_by"][i]["name"] + ", ";
for (i=0; i < myMovie["credits"]["cast"].length; i++)
{
myActors += "<a title=\"Profile for " + myMovie["credits"]["cast"][i]["name"] + "\" href=\"https://www.themoviedb.org/person/" + myMovie["credits"]["cast"][i]["id"] + "\">" + myMovie["credits"]["cast"][i]["name"] + "</a>, ";
myActorsChars += myMovie["credits"]["cast"][i]["name"] + ", ";
}
if (myActorsChars.length > 100)
var myCast = "<span style=\"width:300px;height:25px;line-height:1.3em;overflow-x:hidden;oveflow-y:scroll;padding:3px;display:inline-block;\">" + myActors.trim().replace(/(^,)|(,$)/g, "") + "</span>";
else
var myCast = myActors.trim().replace(/(^,)|(,$)/g, "");

document.write("<div style=\"display:table-row;\">");
document.write("<span style=\"table-cell;float:left;\">");
document.write("<img style=\"width:180px;height:280px;overflow:hidden;\" src=\"" + myPoster + "\" alt=\"\" /><br />");
document.write("</span>");
document.write("<span style=\"table-cell;float:right;margin-left: 15px;font-family: Helvetica, sans-serif; font-size: 12px; max-width: 300px;max-height: " + myMaxHeight + ";line-height:16px;\">");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Title:</h2> " + "<a title=\"IMDb Website\" href= \"http://www.imdb.com/title/" + myImdbId + "/?ref_=inth_ov_i\">" + myMovie["name"] + "</a></span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Type:</h2> " + myMediaType.charAt(0).toUpperCase() + myMediaType.slice(1) + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Created By:</h2> " + myCreatedBy.trim().replace(/(^,)|(,$)/g, "") + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Genres:</h2> " + myGenres.trim().replace(/(^,)|(,$)/g, "") + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Language:</h2> " + myLanguages.trim().replace(/(^,)|(,$)/g, "") + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Seasons:</h2> " + myMovie["number_of_seasons"] + "</span> / ");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Episodes:</h2> " + myMovie["number_of_episodes"] + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Release Date:</h2> " + myDate[2] + " " + myMonths[parseInt(myDate[1],10)] + " " + myDate[0] + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Last Aired:</h2> " + myLastDate[2] + " " + myMonths[parseInt(myLastDate[1],10)] + " " + myLastDate[0] + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">TMBd Rating:</h2> " + myMovie["vote_average"] + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Networks:</h2> " + myCompanies.trim().replace(/(^,)|(,$)/g, "") + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Status:</h2> " + myMovie["status"] + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Cast:</h2> " + myCast + "</span><br />");
document.write("<span style=\"margin-bottom: 15px;\"><h2 style=\"display:inline;\">Plot:</h2> " + (myMovie["overview"] ? myOverview : "n/a") + "</span><br />");
document.write("<span style=\"margin-bottom: 0px;\"><a href=\"https://www.themoviedb.org/" + myMedia + "\"><img title=\"TMDb Website\" style=\"width:80px;height:15px;\" src=\"https://d3a8mw37cqal2z.cloudfront.net/assets/8d0e15fe2a8e8abf7b14876f9a4f8158/images/tmdb-logo.png\" alt=\"\" /></a></span>");
document.write("</span>");
document.write("</div>");
}
else
document.write(myUndefinedMsg + "<br />");
}
else
document.write(myUndefinedMsg + "<br />");
</script>


Note: Where the first parameter is not included due to user error it will default to movie.





BBCode example icons are attached for older versions of the Personalized BBC modification which do not include it.
The png file is for SMF 2.1 and the gif file is for SMF 2.0.X.
Use FTP to put them into: ../Themes/default/images/bbc/PersonalizedBBC

Chen Zhen

August 17, 2014, 05:19:40 pm #1 Last Edit: August 26, 2014, 07:10:12 pm by Napalm
Example:

Code Select

[tmdb]movie/268[/tmdb]




[tmdb]movie/268[/tmdb]

SilverKnight

August 21, 2014, 09:16:42 am #2 Last Edit: August 21, 2014, 09:20:05 am by SilverKnight
Really nice mod.
[imdb]tt0877057[/imdb]

The image does not seem to work with the imdb example above however.

Cover image:

http://ia.media-imdb.com/images/M/MV5BMjA4NTY2Njk4OF5BMl5BanBnXkFtZTcwODM1MTU3MQ@@._V1_SY317_CR5,0,214,317_AL_.jpg

Chen Zhen

August 23, 2014, 03:08:33 pm #3 Last Edit: August 23, 2014, 04:20:36 pm by Napalm
SilverKnight,

  Thank you for the report.

  I changed the code to alter the image location.  Please let me know if the new code resolves the issue.

Also please note that the current beta version (v1.6-Beta2) of this mod will have to be used for this to work in all popular browsers (<- updated) until I release a new stable version.
This BBCode may not work properly with Personalized BBC v1.5 for all browsers. (should use v1.6).

Beta Packages: Click Here
Regards.

Chen Zhen

Hmm.. it seems for legal reasons imdb attempts to block scraping and the display of their content. Perhaps this is why the image does not always display properly.

I have found an alternative from another database that does allow the use/display of their content.
The only guideline they request is a link or credit to their site. This is ok since I can just make clicking on the movie title go to their site.
It also requires the site owner to sign up and get an api key. I will probably work in this tonight and post a new code.

Regards,

SilverKnight

A good solution to this would be to retrieve the cover image and store it locally thus securing the file and avoiding the scraping issue.

Chen Zhen

August 24, 2014, 04:00:51 am #6 Last Edit: August 24, 2014, 05:38:01 pm by Napalm
The first post has been updated with code for using the TMDb API.
You must sign up to the site and then apply for your own API key which can be entered into the onset of the BBCode (replace ####### with your API key) .  I left both sets of images as the BBCode still provides a link to the IMDb website for the specific movie. There should be no copyright issue with it since it is not their logo (just simple letters) and they do allow links to their site.

Unfortunately TMDb's API does not include the Actor's names. Perhaps I will post some feedback on their site and ask them if it would be possible to do that as well as a proper parental rating. 


I will most likely update the BBCode in the near future for aesthetics and performance tweaks.
 
Regards.


Deathnote and Fringe TV shows examples:

[tmdb]tv/13916[/tmdb]

[tmdb]tv/1705[/tmdb]

Chen Zhen

All TMDb BBCodes now include their cast.
Movie TMDb BBCode includes Directors.

Each name shown is a link to their respected profile on the TMDb website.
Cast & Plot are containers that may show small vertical overflow bars if the content is excessive which has aesthetic purpose.
There is now an extra max height variable at the onset of the BBCode in case uniformity is desired which atm it is set as 100% for default.
This only concerns all the text shown to the right of the image and does not effect the image dimensions which are hard coded at w:180px h:280px.




You can use these in posts or blocks/modules.
If you don't want people to use them in posts but want to use them in blocks simply set viewing permissions to all and usage permissions to none (Admins are exempt). After which you put your TMDb BBCodes in a BBC block.

Regards.