|
|
@ -20817,12 +20817,10 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.libraryName.disabled = false;
|
|
|
|
this.libraryName.disabled = false;
|
|
|
|
this.libraryName.value = this.config.libraryName;
|
|
|
|
this.libraryName.value = this.config.libraryName;
|
|
|
|
let libraryType = '';
|
|
|
|
|
|
|
|
let libraryKey = '';
|
|
|
|
let libraryKey = '';
|
|
|
|
// eslint-disable-next-line consistent-return
|
|
|
|
// eslint-disable-next-line consistent-return
|
|
|
|
lodash.forEach(this.sections, section => {
|
|
|
|
lodash.forEach(this.sections, section => {
|
|
|
|
if (lodash.isEqual(section.title, this.libraryName.value)) {
|
|
|
|
if (lodash.isEqual(section.title, this.libraryName.value)) {
|
|
|
|
libraryType = section.type;
|
|
|
|
|
|
|
|
libraryKey = section.key;
|
|
|
|
libraryKey = section.key;
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -20864,42 +20862,20 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
|
|
|
|
this.config.displayType = '';
|
|
|
|
this.config.displayType = '';
|
|
|
|
this.displayType.value = '';
|
|
|
|
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')) {
|
|
|
|
const sortFields = lodash.get(libraryData, `[0].Meta.Type[${displayTypeIndex}].Sort`);
|
|
|
|
sortItems.appendChild(addDropdownItem('titleSort'));
|
|
|
|
if (!lodash.isNil(sortFields) && sortFields.length > 0) {
|
|
|
|
sortItems.appendChild(addDropdownItem('title'));
|
|
|
|
lodash.forEach(sortFields, (sortField) => {
|
|
|
|
sortItems.appendChild(addDropdownItem('originallyAvailableAt'));
|
|
|
|
sortItems.appendChild(addDropdownItem(sortField.key));
|
|
|
|
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'));
|
|
|
|
|
|
|
|
this.sort.style.display = 'block';
|
|
|
|
this.sort.style.display = 'block';
|
|
|
|
this.sortOrder.style.display = 'block';
|
|
|
|
this.sortOrder.style.display = 'block';
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -20908,6 +20884,12 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
|
|
|
|
this.sortOrder.style.display = 'none';
|
|
|
|
this.sortOrder.style.display = 'none';
|
|
|
|
this.config.sort = '';
|
|
|
|
this.config.sort = '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
this.displayType.style.display = 'none';
|
|
|
|
|
|
|
|
this.config.displayType = '';
|
|
|
|
|
|
|
|
this.displayType.value = '';
|
|
|
|
|
|
|
|
}
|
|
|
|
if (lodash.isEmpty(this.config.sort)) {
|
|
|
|
if (lodash.isEmpty(this.config.sort)) {
|
|
|
|
this.sort.value = '';
|
|
|
|
this.sort.value = '';
|
|
|
|
this.sortOrder.value = '';
|
|
|
|
this.sortOrder.value = '';
|
|
|
|