added love, dislike, and unlove to context menus for media items, fixed error where disabled contextmenu items would stop the rest after from adding

This commit is contained in:
booploops 2022-01-05 03:08:59 -08:00
parent 8ecd174a11
commit 091dc32fbd
5 changed files with 239 additions and 8 deletions

View file

@ -87,7 +87,7 @@
},
mounted() {
let duration = this.item.attributes.durationInMillis ?? 0
if(duration == 0 || !this.showDuration) {
if (duration == 0 || !this.showDuration) {
this.displayDuration = false
}
},
@ -179,7 +179,7 @@
}
}
},
contextMenu(event) {
async contextMenu(event) {
let self = this
let data_type = this.getDataType()
let item_id = this.item.attributes.playParams.id ?? this.item.id
@ -277,6 +277,38 @@
app.selectedMediaItems = []
}
},
{
"id": "love",
"name": "Love",
"disabled": true,
"action": function () {
app.love(self.item)
}
},
{
"id": "unlove",
"name": "Unlove",
"disabled": true,
"action": function () {
app.unlove(self.item)
}
},
{
"id": "dislike",
"name": "Dislike",
"disabled": true,
"action": function () {
app.dislike(self.item)
}
},
{
"id": "undo_dislike",
"name": "Undo dislike",
"disabled": true,
"action": function () {
app.unlove(self.item)
}
},
{
"name": "Go to Artist",
"action": function () {
@ -307,6 +339,16 @@
menus.multiple.items = menus.multiple.items.concat(this.contextExt.multiple)
}
}
let rating = await app.getRating(self.item)
if(rating == 0) {
menus.normal.items.find(x => x.id == 'love').disabled = false
menus.normal.items.find(x => x.id == 'dislike').disabled = false
}else if(rating == 1) {
menus.normal.items.find(x => x.id == 'unlove').disabled = false
}else if(rating == -1) {
menus.normal.items.find(x => x.id == 'undo_dislike').disabled = false
}
CiderContextMenu.Create(event, menus[useMenu])
},
visibilityChanged: function (isVisible, entry) {