fixes #548 - Add provider links to edit page

This commit is contained in:
Luke Pulverenti 2013-09-23 16:27:49 -04:00
parent 6eff327675
commit bc70b9ed6e
3 changed files with 172 additions and 20 deletions

View File

@ -199,35 +199,64 @@
<p id="albumAssociationMessage" style="display: none;">Associate this album with a movie, tv series and/or game, and we'll be able to link it to other items in your library.</p>
<div data-role="fieldcontain" id="fldGamesDb" style="display: none;">
<label for="txtGamesDb">GamesDb:</label>
<input id="txtGamesDb" name="txtGamesDb" data-mini="true" />
<div style="display: inline-block; width: 250px;">
<input class="txtProviderId" id="txtGamesDb" name="txtGamesDb" data-mini="true" />
</div>
<a id="btnOpenGamesDb" href="#" target="_blank" data-icon="arrow-right" data-inline="true" data-iconpos="notext" data-role="button"></a>
</div>
<div data-role="fieldcontain" id="fldImdb" style="display: none;">
<label for="txtImdb">Imdb:</label>
<input id="txtImdb" name="txtImdb" data-mini="true" />
<div style="display: inline-block; width: 250px;">
<input class="txtProviderId" id="txtImdb" name="txtImdb" data-mini="true" />
</div>
<a id="btnOpenImdb" href="#" target="_blank" data-icon="arrow-right" data-inline="true" data-iconpos="notext" data-role="button"></a>
</div>
<div data-role="fieldcontain" id="fldMusicBrainz" style="display: none;">
<label for="txtMusicBrainz">MusicBrainz:</label>
<input id="txtMusicBrainz" name="txtMusicBrainz" data-mini="true" />
<div style="display: inline-block; width: 250px;">
<input class="txtProviderId" id="txtMusicBrainz" name="txtMusicBrainz" data-mini="true" />
</div>
<a id="btnOpenMusicbrainz" href="#" target="_blank" data-icon="arrow-right" data-inline="true" data-iconpos="notext" data-role="button"></a>
</div>
<div data-role="fieldcontain" id="fldMusicBrainzReleaseGroupId" style="display: none;">
<label for="txtMusicBrainzReleaseGroupId">MusicBrainz Release Group Id:</label>
<input id="txtMusicBrainzReleaseGroupId" name="txtMusicBrainzReleaseGroupId" data-mini="true" />
<div style="display: inline-block; width: 250px;">
<input class="txtProviderId" id="txtMusicBrainzReleaseGroupId" name="txtMusicBrainzReleaseGroupId" data-mini="true" />
</div>
<a id="btnOpenMusicbrainzReleaseGroup" href="#" target="_blank" data-icon="arrow-right" data-inline="true" data-iconpos="notext" data-role="button"></a>
</div>
<div data-role="fieldcontain" id="fldRottenTomatoes" style="display: none;">
<label for="txtRottenTomatoes">Rotten Tomatoes:</label>
<input id="txtRottenTomatoes" name="txtRottenTomatoes" data-mini="true" />
<div style="display: inline-block; width: 250px;">
<input class="txtProviderId" id="txtRottenTomatoes" name="txtRottenTomatoes" data-mini="true" />
</div>
</div>
<div data-role="fieldcontain" id="fldTmdb" style="display: none;">
<label for="txtTmdb">TheMovieDB:</label>
<input id="txtTmdb" name="txtTmdb" data-mini="true" />
<div style="display: inline-block; width: 250px;">
<input class="txtProviderId" id="txtTmdb" name="txtTmdb" data-mini="true" />
</div>
<a id="btnOpenTmdb" href="#" target="_blank" data-icon="arrow-right" data-inline="true" data-iconpos="notext" data-role="button"></a>
</div>
<div data-role="fieldcontain" id="fldTvdb" style="display: none;">
<label for="txtTvdb">TheTVDB:</label>
<input id="txtTvdb" name="txtTvdb" data-mini="true" />
<div style="display: inline-block; width: 250px;">
<input class="txtProviderId" id="txtTvdb" name="txtTvdb" data-mini="true" />
</div>
<a id="btnOpenTvdb" href="#" target="_blank" data-icon="arrow-right" data-inline="true" data-iconpos="notext" data-role="button"></a>
</div>
<div data-role="fieldcontain" id="fldTvCom" style="display: none;">
<label for="txtTvCom">TV.com:</label>
<input id="txtTvCom" name="txtTvCom" data-mini="true" />
<div style="display: inline-block; width: 250px;">
<input class="txtProviderId" id="txtTvCom" name="txtTvCom" data-mini="true" />
</div>
</div>
<div data-role="fieldcontain" id="fldZap2It" style="display: none;">
<label for="txtZap2It">Zap2it:</label>
<div style="display: inline-block; width: 250px;">
<input class="txtProviderId" id="txtZap2It" name="txtZap2It" data-mini="true" />
</div>
<a id="btnOpenZap2It" href="#" target="_blank" data-icon="arrow-right" data-inline="true" data-iconpos="notext" data-role="button"></a>
</div>
</div>
</div>

View File

@ -422,6 +422,12 @@
$('#fldTvCom', page).hide();
}
if (item.Type == "Series") {
$('#fldZap2It', page).show();
} else {
$('#fldZap2It', page).hide();
}
if (item.Type == "Series") {
$('#fldStatus', page).show();
$('#fldAirDays', page).show();
@ -665,15 +671,18 @@
$('#txtMusicBrainz', page).val(providerIds.Musicbrainz || "");
$('#txtMusicBrainzReleaseGroupId', page).val(providerIds.MusicBrainzReleaseGroup || "");
$('#txtRottenTomatoes', page).val(providerIds.RottenTomatoes || "");
$('#txtZap2It', page).val(providerIds.Zap2It || "");
if (item.RunTimeTicks) {
var minutes = item.RunTimeTicks / 600000000;
$('#txtSeriesRuntime', page).val(minutes);
} else {
$('#txtSeriesRuntime', page).val("");
}
$('.txtProviderId', page).trigger('change');
}
function convertTo24HourFormat(time) {
@ -788,7 +797,7 @@
function generateSliders(fields, type) {
var html = '';
for (var i = 0; i < fields.length; i++) {
var field = fields[i];
var name = field.name;
var value = field.value || field.name;
@ -806,31 +815,31 @@
function populateInternetProviderSettings(page, item, lockedFields) {
var container = $('#providerSettingsContainer', page);
lockedFields = lockedFields || new Array();
var metadatafields = [
{ name: "Name" },
{ name: "Overview" },
{ name: "Genres" },
{ name: "Parental Rating", value: "OfficialRating" },
{ name: "People", value: "Cast" }
];
if (item.Type == "Person") {
metadatafields.push({ name: "Birth location", value: "ProductionLocations" });
} else {
metadatafields.push({ name: "Production Locations", value: "ProductionLocations" });
}
if (item.Type == "Series") {
metadatafields.push({ name: "Runtime" });
}
metadatafields.push({ name: "Studios" });
metadatafields.push({ name: "Tags" });
var html = '';
html += "<h3>Fields</h3>";
html += generateSliders(metadatafields, 'Fields');
container.html(html).trigger('create');
@ -899,7 +908,8 @@
Tvcom: $('#txtTvCom', form).val(),
Musicbrainz: $('#txtMusicBrainz', form).val(),
MusicBrainzReleaseGroup: $('#txtMusicBrainzReleaseGroupId', form).val(),
RottenTomatoes: $('#txtRottenTomatoes', form).val()
RottenTomatoes: $('#txtRottenTomatoes', form).val(),
Zap2It: $('#txtZap2It', form).val()
}
};
@ -909,9 +919,9 @@
item.ProductionLocations = placeOfBirth ? [placeOfBirth] : [];
}
if (currentItem.Type == "Series") {
// 600000000
var seriesRuntime = $('#txtSeriesRuntime', form).val();
item.RunTimeTicks = seriesRuntime ? (seriesRuntime * 600000000) : null;
@ -988,6 +998,114 @@
var page = this;
$('#txtGamesDb', this).on('change', function () {
var val = this.value;
if (val) {
$('#btnOpenGamesDb', page).attr('href', 'http://thegamesdb.net/game/' + val);
} else {
$('#btnOpenGamesDb', page).attr('href', '#');
}
});
$('#txtImdb', this).on('change', function () {
var val = this.value;
if (val) {
if (currentItem.Type == "Person") {
$('#btnOpenImdb', page).attr('href', 'http://www.imdb.com/name/' + val);
} else {
$('#btnOpenImdb', page).attr('href', 'http://www.imdb.com/title/' + val);
}
} else {
$('#btnOpenImdb', page).attr('href', '#');
}
});
$('#txtMusicBrainz', this).on('change', function () {
var val = this.value;
if (val) {
if (currentItem.Type == "MusicArtist" || currentItem.Type == "Artist") {
$('#btnOpenMusicbrainz', page).attr('href', 'http://musicbrainz.org/artist/' + val);
} else {
$('#btnOpenMusicbrainz', page).attr('href', 'http://musicbrainz.org/release/' + val);
}
} else {
$('#btnOpenMusicbrainz', page).attr('href', '#');
}
});
$('#txtMusicBrainzReleaseGroupId', this).on('change', function () {
var val = this.value;
if (val) {
$('#btnOpenMusicbrainzReleaseGroup', page).attr('href', 'http://musicbrainz.org/release-group/' + val);
} else {
$('#btnOpenMusicbrainzReleaseGroup', page).attr('href', '#');
}
});
$('#txtTmdb', this).on('change', function () {
var val = this.value;
if (val) {
if (currentItem.Type == "Movie" || currentItem.Type == "Trailer" || currentItem.Type == "MusicVideo")
$('#btnOpenTmdb', page).attr('href', 'http://www.themoviedb.org/movie/' + val);
else if (currentItem.Type == "BoxSet")
$('#btnOpenTmdb', page).attr('href', 'http://www.themoviedb.org/collection/' + val);
else if (currentItem.Type == "Person")
$('#btnOpenTmdb', page).attr('href', 'http://www.themoviedb.org/person/' + val);
} else {
$('#btnOpenTmdb', page).attr('href', '#');
}
});
$('#txtTvdb', this).on('change', function () {
var val = this.value;
if (val) {
$('#btnOpenTvdb', page).attr('href', 'http://thetvdb.com/index.php?tab=series&id=' + val);
} else {
$('#btnOpenTvdb', page).attr('href', '#');
}
});
$('#txtZap2It', this).on('change', function () {
var val = this.value;
if (val) {
$('#btnOpenZap2It', page).attr('href', 'http://tvlistings.zap2it.com/tv/dexter/' + val);
} else {
$('#btnOpenZap2It', page).attr('href', '#');
}
});
$('#btnRefresh', this).on('click', function () {
$(this).button('disable');

View File

@ -991,9 +991,14 @@
if (item.Type == "MusicArtist" || item.Type == "Artist") {
links.push('<a class="textlink" href="http://musicbrainz.org/artist/' + providerIds.Musicbrainz + '" target="_blank">MusicBrainz</a>');
} else {
links.push('<a class="textlink" href="http://musicbrainz.org/release/' + providerIds.Musicbrainz + '" target="_blank">MusicBrainz</a>');
links.push('<a class="textlink" href="http://musicbrainz.org/release/' + providerIds.Musicbrainz + '" target="_blank">MusicBrainz Release</a>');
}
}
if (providerIds.MusicBrainzReleaseGroup) {
links.push('<a class="textlink" href="http://musicbrainz.org/release-group/' + providerIds.MusicBrainzReleaseGroup + '" target="_blank">MusicBrainz Release Group</a>');
}
if (providerIds.Gamesdb)
links.push('<a class="textlink" href="http://thegamesdb.net/game/' + providerIds.Gamesdb + '" target="_blank">GamesDB</a>');