1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
|
<!DOCTYPE html>
<html>
<head>
<title>TMDb</title>
</head>
<body>
<div id="configPage" data-role="page" class="page type-interior pluginConfigurationPage configPage" data-require="emby-input,emby-button,emby-checkbox">
<div data-role="content">
<div class="content-primary">
<h1>TMDb</h1>
<form class="configForm">
<label class="checkboxContainer">
<input is="emby-checkbox" type="checkbox" id="includeAdult" />
<span>Include adult content in search results.</span>
</label>
<label class="checkboxContainer">
<input is="emby-checkbox" type="checkbox" id="excludeTagsSeries" />
<span>Exclude tags/keywords from metadata fetched for series.</span>
</label>
<label class="checkboxContainer">
<input is="emby-checkbox" type="checkbox" id="excludeTagsMovies" />
<span>Exclude tags/keywords from metadata fetched for movies.</span>
</label>
<label class="checkboxContainer">
<input is="emby-checkbox" type="checkbox" id="importSeasonName" />
<span>Import season name from metadata fetched for series.</span>
</label>
<div class="checkboxContainer checkboxContainer-withDescription">
<label>
<input is="emby-checkbox" type="checkbox" id="importUnairedEpisodes" />
<span>Create unaired (upcoming) episodes from metadata fetched for series.</span>
</label>
<div class="fieldDescription checkboxFieldDescription">Adds virtual entries for episodes listed on TMDb that have not aired yet. This populates the "Upcoming" view. Specials are never added to the "Upcoming" view.</div>
</div>
<div class="checkboxContainer checkboxContainer-withDescription">
<label>
<input is="emby-checkbox" type="checkbox" id="importMissingEpisodes" />
<span>Create missing episodes from metadata fetched for series.</span>
</label>
<div class="fieldDescription checkboxFieldDescription">Adds virtual entries for episodes listed on TMDb that have already aired but are not present in your library. Missing episodes are only shown when enabled in the user display preferences. Both options increase scan times.</div>
</div>
<div class="checkboxContainer checkboxContainer-withDescription">
<label>
<input is="emby-checkbox" type="checkbox" id="importSpecials" />
<span>Include specials when creating unaired and missing episodes.</span>
</label>
<div class="fieldDescription checkboxFieldDescription">When disabled, specials (season 0) are never added as virtual entries and any existing virtual specials are removed.</div>
</div>
<div class="inputContainer inputContainer-withDescription">
<input is="emby-input" type="number" id="missingEpisodeRefreshIntervalDays" pattern="[0-9]*" required min="1" max="365" label="Episode refresh interval (days)" />
<div class="fieldDescription">How often the scheduled task re-checks TMDb for newly announced unaired or missing episodes. Keeps the "Upcoming" view current for series whose local files have not changed.</div>
</div>
<div class="inputContainer inputContainer-withDescription">
<input is="emby-input" type="number" id="upcomingEpisodeGracePeriodDays" pattern="[0-9]*" required min="0" max="365" label="Recently aired grace period (days)" />
<div class="fieldDescription">When missing episodes are disabled, how many days a recently aired episode is kept in place before its placeholder is removed. This allows for the delay between an episode airing and its file being added to the library.</div>
</div>
<div class="verticalSection">
<h2>Libraries</h2>
<div class="fieldDescription" style="margin-bottom:1em;">Choose which TV libraries the unaired/missing episode options above apply to. The settings above are global; this only controls which libraries they run for. Libraries are opted in individually, so newly added libraries are not processed until they are enabled here.</div>
<div id="missingEpisodeLibraries"></div>
</div>
<div class="verticalSection">
<h2>Cast & Crew Settings</h2>
<div class="inputContainer">
<input is="emby-input" type="number" id="maxCastMembers" pattern="[0-9]*" required min="0" max="1000" label="Max Cast Members" />
<div class="fieldDescription">The maximum number of cast members to fetch for an item.</div>
</div>
<div class="inputContainer">
<input is="emby-input" type="number" id="maxCrewMembers" pattern="[0-9]*" required min="0" max="1000" label="Max Crew Members" />
<div class="fieldDescription">The maximum number of crew members to fetch for an item.</div>
</div>
<label class="checkboxContainer">
<input is="emby-checkbox" type="checkbox" id="hideMissingCastMembers" />
<span>Hide cast members without profile images.</span>
</label>
<label class="checkboxContainer">
<input is="emby-checkbox" type="checkbox" id="hideMissingCrewMembers" />
<span>Hide crew members without profile images.</span>
</label>
</div>
<div class="verticalSection">
<h2>Similar Items</h2>
<div class="inputContainer">
<input is="emby-input" type="number" id="similarItemsCacheDays" pattern="[0-9]*" required min="0" max="365" label="Cache duration (days)" />
<div class="fieldDescription">Number of days to cache similar item results from TMDb. Set to 0 to disable caching.</div>
</div>
</div>
<div class="verticalSection verticalSection-extrabottompadding">
<h2>Image Scaling</h2>
<div class="selectContainer">
<select is="emby-select" id="selectPosterSize" label="Poster"></select>
</div>
<div class="selectContainer">
<select is="emby-select" id="selectBackdropSize" label="Backdrop"></select>
</div>
<div class="selectContainer">
<select is="emby-select" id="selectLogoSize" label="Logo"></select>
</div>
<div class="selectContainer">
<select is="emby-select" id="selectProfileSize" label="Profile"></select>
</div>
<div class="selectContainer">
<select is="emby-select" id="selectStillSize" label="Still"></select>
</div>
</div>
<div>
<button is="emby-button" type="submit" class="raised button-submit block"><span>Save</span></button>
</div>
</form>
</div>
</div>
<script type="text/javascript">
var PluginConfig = {
pluginId: "b8715ed1-6c47-4528-9ad3-f72deb539cd4"
};
document.querySelector('.configPage')
.addEventListener('pageshow', function () {
Dashboard.showLoadingMsg();
var clientConfig, pluginConfig;
var populateMissingEpisodeLibraries = function (enabledLibraries) {
var container = document.querySelector('#missingEpisodeLibraries');
ApiClient.getVirtualFolders().then(function (folders) {
// Series only live in TV libraries (and mixed-content libraries, which report
// no collection type), so only those are worth listing here.
var tvLibraries = folders.filter(function (folder) {
return !folder.CollectionType || folder.CollectionType === 'tvshows';
});
if (tvLibraries.length === 0) {
container.innerHTML = '<div class="fieldDescription">No TV libraries found.</div>';
return;
}
container.innerHTML = tvLibraries.map(function (folder) {
var checked = enabledLibraries.indexOf(folder.ItemId) === -1 ? '' : ' checked';
return '<label class="checkboxContainer">'
+ '<input is="emby-checkbox" type="checkbox" class="missingEpisodeLibrary" data-library-id="' + folder.ItemId + '"' + checked + ' />'
+ '<span>' + folder.Name + '</span>'
+ '</label>';
}).join('');
});
}
var configureImageScaling = function() {
if (clientConfig === undefined || pluginConfig === undefined) {
return;
}
if (Object.keys(clientConfig).length === 0) {
clientConfig = {
PosterSizes: [pluginConfig.PosterSize],
BackdropSizes: [pluginConfig.BackdropSize],
LogoSizes: [pluginConfig.LogoSize],
ProfileSizes: [pluginConfig.ProfileSize],
StillSizes: [pluginConfig.StillSize]
};
}
var sizeOptionsGenerator = function (size) {
return '<option value="' + size + '">' + size + '</option>';
}
var selPosterSize = document.querySelector('#selectPosterSize');
selPosterSize.innerHTML = clientConfig.PosterSizes.map(sizeOptionsGenerator);
selPosterSize.value = pluginConfig.PosterSize;
var selBackdropSize = document.querySelector('#selectBackdropSize');
selBackdropSize.innerHTML = clientConfig.BackdropSizes.map(sizeOptionsGenerator);
selBackdropSize.value = pluginConfig.BackdropSize;
var selLogoSize = document.querySelector('#selectLogoSize');
selLogoSize.innerHTML = clientConfig.LogoSizes.map(sizeOptionsGenerator);
selLogoSize.value = pluginConfig.LogoSize;
var selProfileSize = document.querySelector('#selectProfileSize');
selProfileSize.innerHTML = clientConfig.ProfileSizes.map(sizeOptionsGenerator);
selProfileSize.value = pluginConfig.ProfileSize;
var selStillSize = document.querySelector('#selectStillSize');
selStillSize.innerHTML = clientConfig.StillSizes.map(sizeOptionsGenerator);
selStillSize.value = pluginConfig.StillSize;
Dashboard.hideLoadingMsg();
}
const request = {
url: ApiClient.getUrl('tmdb/ClientConfiguration'),
dataType: 'json',
type: 'GET',
headers: { accept: 'application/json' }
}
ApiClient.fetch(request).then(function (config) {
clientConfig = config;
configureImageScaling();
}, function (error) {
error.text().then(function (contents) {
Dashboard.alert({
title: error.statusText,
message: contents
});
clientConfig = {};
configureImageScaling();
});
});
ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) {
document.querySelector('#includeAdult').checked = config.IncludeAdult;
document.querySelector('#excludeTagsSeries').checked = config.ExcludeTagsSeries;
document.querySelector('#excludeTagsMovies').checked = config.ExcludeTagsMovies;
document.querySelector('#importSeasonName').checked = config.ImportSeasonName;
document.querySelector('#importUnairedEpisodes').checked = config.ImportUnairedEpisodes;
document.querySelector('#importMissingEpisodes').checked = config.ImportMissingEpisodes;
document.querySelector('#importSpecials').checked = config.ImportSpecials;
document.querySelector('#missingEpisodeRefreshIntervalDays').value = config.MissingEpisodeRefreshIntervalDays;
document.querySelector('#upcomingEpisodeGracePeriodDays').value = config.UpcomingEpisodeGracePeriodDays;
document.querySelector('#hideMissingCastMembers').checked = config.HideMissingCastMembers;
document.querySelector('#hideMissingCrewMembers').checked = config.HideMissingCrewMembers;
populateMissingEpisodeLibraries(config.EnabledMissingEpisodeLibraries || []);
var maxCastMembers = document.querySelector('#maxCastMembers');
maxCastMembers.value = config.MaxCastMembers;
maxCastMembers.dispatchEvent(new Event('change', {
bubbles: true,
cancelable: false
}));
var maxCrewMembers = document.querySelector('#maxCrewMembers');
maxCrewMembers.value = config.MaxCrewMembers;
maxCrewMembers.dispatchEvent(new Event('change', {
bubbles: true,
cancelable: false
}));
var similarItemsCacheDays = document.querySelector('#similarItemsCacheDays');
similarItemsCacheDays.value = config.SimilarItemsCacheDays;
similarItemsCacheDays.dispatchEvent(new Event('change', {
bubbles: true,
cancelable: false
}));
pluginConfig = config;
configureImageScaling();
});
});
document.querySelector('.configForm')
.addEventListener('submit', function (e) {
Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) {
config.IncludeAdult = document.querySelector('#includeAdult').checked;
config.ExcludeTagsSeries = document.querySelector('#excludeTagsSeries').checked;
config.ExcludeTagsMovies = document.querySelector('#excludeTagsMovies').checked;
config.ImportSeasonName = document.querySelector('#importSeasonName').checked;
config.ImportUnairedEpisodes = document.querySelector('#importUnairedEpisodes').checked;
config.ImportMissingEpisodes = document.querySelector('#importMissingEpisodes').checked;
config.ImportSpecials = document.querySelector('#importSpecials').checked;
config.MissingEpisodeRefreshIntervalDays = parseInt(document.querySelector('#missingEpisodeRefreshIntervalDays').value, 10);
config.UpcomingEpisodeGracePeriodDays = parseInt(document.querySelector('#upcomingEpisodeGracePeriodDays').value, 10);
var libraryCheckboxes = document.querySelectorAll('.missingEpisodeLibrary');
if (libraryCheckboxes.length > 0) {
config.EnabledMissingEpisodeLibraries = Array.prototype.filter
.call(libraryCheckboxes, function (checkbox) { return checkbox.checked; })
.map(function (checkbox) { return checkbox.getAttribute('data-library-id'); });
}
config.MaxCastMembers = document.querySelector('#maxCastMembers').value;
config.MaxCrewMembers = document.querySelector('#maxCrewMembers').value;
config.HideMissingCastMembers = document.querySelector('#hideMissingCastMembers').checked;
config.HideMissingCrewMembers = document.querySelector('#hideMissingCrewMembers').checked;
config.SimilarItemsCacheDays = parseInt(document.querySelector('#similarItemsCacheDays').value, 10);
config.PosterSize = document.querySelector('#selectPosterSize').value;
config.BackdropSize = document.querySelector('#selectBackdropSize').value;
config.LogoSize = document.querySelector('#selectLogoSize').value;
config.ProfileSize = document.querySelector('#selectProfileSize').value;
config.StillSize = document.querySelector('#selectStillSize').value;
ApiClient.updatePluginConfiguration(PluginConfig.pluginId, config).then(Dashboard.processPluginConfigurationUpdateResult);
});
e.preventDefault();
return false;
});
</script>
</div>
</body>
</html>
|