|
|
|
@ -20817,12 +20817,10 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
|
|
|
|
|
}
|
|
|
|
|
this.libraryName.disabled = false;
|
|
|
|
|
this.libraryName.value = this.config.libraryName;
|
|
|
|
|
let libraryType = '';
|
|
|
|
|
let libraryKey = '';
|
|
|
|
|
// eslint-disable-next-line consistent-return
|
|
|
|
|
lodash.forEach(this.sections, section => {
|
|
|
|
|
if (lodash.isEqual(section.title, this.libraryName.value)) {
|
|
|
|
|
libraryType = section.type;
|
|
|
|
|
libraryKey = section.key;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -20864,42 +20862,20 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
|
|
|
|
|
this.config.displayType = '';
|
|
|
|
|
this.displayType.value = '';
|
|
|
|
|
}
|
|
|
|
|
let displayTypeIndex = 0;
|
|
|
|
|
if (this.config.displayType) {
|
|
|
|
|
lodash.forEach(types, (sectionType, sectionKey) => {
|
|
|
|
|
const key = sectionType.key.split('type=')[1];
|
|
|
|
|
if (key === parseInt(this.config.displayType, 10)) {
|
|
|
|
|
displayTypeIndex = parseInt(sectionKey, 10);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
this.displayType.style.display = 'none';
|
|
|
|
|
this.config.displayType = '';
|
|
|
|
|
this.displayType.value = '';
|
|
|
|
|
}
|
|
|
|
|
if (lodash.isEqual(libraryType, 'show')) {
|
|
|
|
|
sortItems.appendChild(addDropdownItem('titleSort'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('title'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('year'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('originallyAvailableAt'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('rating'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('audienceRating'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('userRating'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('contentRating'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('unviewedLeafCount'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('episode.addedAt'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('addedAt'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('lastViewedAt'));
|
|
|
|
|
this.sort.style.display = 'block';
|
|
|
|
|
this.sortOrder.style.display = 'block';
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else if (lodash.isEqual(libraryType, 'movie')) {
|
|
|
|
|
sortItems.appendChild(addDropdownItem('titleSort'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('title'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('originallyAvailableAt'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('rating'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('audienceRating'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('userRating'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('duration'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('viewOffset'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('viewCount'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('addedAt'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('lastViewedAt'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('mediaHeight'));
|
|
|
|
|
sortItems.appendChild(addDropdownItem('mediaBitrate'));
|
|
|
|
|
const sortFields = lodash.get(libraryData, `[0].Meta.Type[${displayTypeIndex}].Sort`);
|
|
|
|
|
if (!lodash.isNil(sortFields) && sortFields.length > 0) {
|
|
|
|
|
lodash.forEach(sortFields, (sortField) => {
|
|
|
|
|
sortItems.appendChild(addDropdownItem(sortField.key));
|
|
|
|
|
});
|
|
|
|
|
this.sort.style.display = 'block';
|
|
|
|
|
this.sortOrder.style.display = 'block';
|
|
|
|
|
}
|
|
|
|
@ -20908,6 +20884,12 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
|
|
|
|
|
this.sortOrder.style.display = 'none';
|
|
|
|
|
this.config.sort = '';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
this.displayType.style.display = 'none';
|
|
|
|
|
this.config.displayType = '';
|
|
|
|
|
this.displayType.value = '';
|
|
|
|
|
}
|
|
|
|
|
if (lodash.isEmpty(this.config.sort)) {
|
|
|
|
|
this.sort.value = '';
|
|
|
|
|
this.sortOrder.value = '';
|
|
|
|
|