fixes #562 - Integrate nesbox/snesbox into web client

This commit is contained in:
Luke Pulverenti 2013-10-26 19:19:26 -04:00
parent a1c3ebb854
commit 8140e361fb
6 changed files with 110 additions and 4 deletions

View File

@ -264,6 +264,20 @@
</div>
<a id="btnOpenZap2It" href="#" target="_blank" data-icon="arrow-right" data-inline="true" data-iconpos="notext" data-role="button"></a>
</div>
<div data-role="fieldcontain" id="fldNesBoxName" style="display: none;">
<label for="txtNesBoxName">NES/SNESbox Name:</label>
<div style="display: inline-block; width: 250px;">
<input class="txtProviderId" id="txtNesBoxName" name="txtNesBoxName" data-mini="true" />
</div>
<a id="btnOpenNesBox" href="#" target="_blank" data-icon="arrow-right" data-inline="true" data-iconpos="notext" data-role="button"></a>
</div>
<div data-role="fieldcontain" id="fldNesBoxRom" style="display: none;">
<label for="txtNesBoxRom">NES/SNESbox Game Id:</label>
<div style="display: inline-block; width: 250px;">
<input class="txtProviderId" id="txtNesBoxRom" name="txtNesBoxRom" data-mini="true" />
</div>
<a id="btnOpenNesBoxRom" href="#" target="_blank" data-icon="arrow-right" data-inline="true" data-iconpos="notext" data-role="button"></a>
</div>
</div>
</div>
<div data-role="collapsible" id="genresCollapsible" style="display: none;">

View File

@ -137,6 +137,9 @@
<span id="playButtonContainer" style="display: none;">
<button id="btnPlay" type="button" data-icon="play" data-inline="true" data-mini="true">Play</button>
</span>
<span id="playExternalButtonContainer" style="display: none;">
<a id="btnPlayExternal" data-role="button" data-icon="play" data-inline="true" data-mini="true" href="#" target="_blank">Play</a>
</span>
<span>
<button id="btnRemote" type="button" data-icon="hand-up" data-inline="true" data-mini="true">Remote</button>
</span>

View File

@ -64,9 +64,22 @@
}
if (MediaPlayer.canPlay(item) && item.LocationType !== "Offline" && item.LocationType !== "Virtual") {
$('#playButtonContainer', page).show();
var url = MediaPlayer.getPlayUrl(item);
if (url) {
$('#playExternalButtonContainer', page).show();
$('#playButtonContainer', page).hide();
} else {
$('#playButtonContainer', page).show();
$('#playExternalButtonContainer', page).hide();
}
$('#btnPlayExternal', page).attr('href', url || '#');
} else {
$('#playButtonContainer', page).hide();
$('#playExternalButtonContainer', page).hide();
}
$(".autoNumeric").autoNumeric('init');

View File

@ -425,6 +425,14 @@
$('#fldGamesDb', page).hide();
}
if (item.MediaType == "Game" && (item.GameSystem == "Nintendo" || item.GameSystem == "Super Nintendo")) {
$('#fldNesBoxName', page).show();
$('#fldNesBoxRom', page).show();
} else {
$('#fldNesBoxName', page).hide();
$('#fldNesBoxRom', page).hide();
}
if (item.MediaType == "Game") {
$('#fldPlayers', page).show();
} else {
@ -714,6 +722,8 @@
$('#txtMusicBrainzReleaseGroupId', page).val(providerIds.MusicBrainzReleaseGroup || "");
$('#txtRottenTomatoes', page).val(providerIds.RottenTomatoes || "");
$('#txtZap2It', page).val(providerIds.Zap2It || "");
$('#txtNesBoxName', page).val(providerIds.NesBox || "");
$('#txtNesBoxRom', page).val(providerIds.NesBoxRom || "");
if (item.RunTimeTicks) {
@ -951,7 +961,9 @@
Musicbrainz: $('#txtMusicBrainz', form).val(),
MusicBrainzReleaseGroup: $('#txtMusicBrainzReleaseGroupId', form).val(),
RottenTomatoes: $('#txtRottenTomatoes', form).val(),
Zap2It: $('#txtZap2It', form).val()
Zap2It: $('#txtZap2It', form).val(),
NesBox: $('#txtNesBoxName', form).val(),
NesBoxRom: $('#txtNesBoxRom', form).val()
}
};
@ -1053,6 +1065,35 @@
});
$('#txtNesBoxName', this).on('change', function () {
var val = this.value;
var urlPrefix = currentItem.GameSystem == "Nintendo" ? "http://nesbox.com/game/" : "http://snesbox.com/game/";
if (val) {
$('#btnOpenNesBox', page).attr('href', urlPrefix + val);
} else {
$('#btnOpenNesBox', page).attr('href', '#');
}
});
$('#txtNesBoxRom', this).on('change', function () {
var val = this.value;
var romName = $('#txtNesBoxName', page).val();
var urlPrefix = currentItem.GameSystem == "Nintendo" ? "http://nesbox.com/game/" : "http://snesbox.com/game/";
if (val && romName) {
$('#btnOpenNesBoxRom', page).attr('href', urlPrefix + romName + '/rom/' + val);
} else {
$('#btnOpenNesBoxRom', page).attr('href', '#');
}
});
$('#txtImdb', this).on('change', function () {
var val = this.value;

View File

@ -1278,9 +1278,19 @@
links.push('<a class="textlink" href="http://musicbrainz.org/release-group/' + providerIds.MusicBrainzReleaseGroup + '" target="_blank">MusicBrainz Release Group</a>');
}
if (providerIds.Gamesdb)
if (providerIds.Gamesdb) {
links.push('<a class="textlink" href="http://thegamesdb.net/game/' + providerIds.Gamesdb + '" target="_blank">GamesDB</a>');
}
if (providerIds.NesBox) {
if (item.GameSystem == "Nintendo") {
links.push('<a class="textlink" href="http://nesbox.com/game/' + providerIds.NesBox + '" target="_blank">NESbox</a>');
}
else if (item.GameSystem == "Super Nintendo") {
links.push('<a class="textlink" href="http://snesbox.com/game/' + providerIds.NesBox + '" target="_blank">SNESbox</a>');
}
}
if (providerIds.Zap2It)
links.push('<a class="textlink" href="http://tvlistings.zap2it.com/tv/dexter/' + providerIds.Zap2It + '?aid=zap2it" target="_blank">Zap2It</a>');

View File

@ -750,9 +750,34 @@
if (item.Type == "MusicAlbum" || item.Type == "MusicArtist" || item.Type == "Artist" || item.Type == "MusicGenre") {
return true;
}
if (item.GameSystem == "Nintendo" && item.MediaType == "Game" && item.ProviderIds.NesBox && item.ProviderIds.NesBoxRom) {
return true;
}
if (item.GameSystem == "Super Nintendo" && item.MediaType == "Game" && item.ProviderIds.NesBox && item.ProviderIds.NesBoxRom) {
return true;
}
return self.canPlayMediaType(item.MediaType);
};
self.getPlayUrl = function(item) {
if (item.GameSystem == "Nintendo" && item.MediaType == "Game" && item.ProviderIds.NesBox && item.ProviderIds.NesBoxRom) {
return "http://nesbox.com/game/" + item.ProviderIds.NesBox + '/rom/' + item.ProviderIds.NesBoxRom;
}
if (item.GameSystem == "Super Nintendo" && item.MediaType == "Game" && item.ProviderIds.NesBox && item.ProviderIds.NesBoxRom) {
return "http://snesbox.com/game/" + item.ProviderIds.NesBox + '/rom/' + item.ProviderIds.NesBoxRom;
}
return null;
};
self.canPlayMediaType = function (mediaType) {
var media;
@ -785,7 +810,7 @@
Dashboard.getCurrentUser().done(function (user) {
var item = items[0];
var videoType = (item.VideoType || "").toLowerCase();
var expirementalText = "This feature is experimental. It may not work at all with some titles. Do you wish to continue?";