From 578fdcfbe8c7a7efb39c132e23a546ad761f53f4 Mon Sep 17 00:00:00 2001 From: Dmitrii Misharov Date: Tue, 26 Jan 2021 22:00:57 +0100 Subject: [PATCH] =?UTF-8?q?Fixed=20missing=20'=D0=91=D1=83=D0=B4=D1=83=20?= =?UTF-8?q?=D1=81=D0=BC=D0=BE=D1=82=D1=80=D0=B5=D1=82=D1=8C'=20context=20m?= =?UTF-8?q?enu=20item=20(#160)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/resources/lib/modeling.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/resources/lib/modeling.py b/src/resources/lib/modeling.py index b04947e..2e46d63 100644 --- a/src/resources/lib/modeling.py +++ b/src/resources/lib/modeling.py @@ -54,6 +54,8 @@ def watching_movies(self): def watching_tvshows(self): tvshows = [] for item in self.plugin.client("watching/serials").get(data={"subscribed": 1})["items"]: + # This needs in order to add context menu items in "Я смотрю" + item["in_watchlist"] = 1 tvshow = self.instantiate(item=item) tvshow.new = item["new"] tvshow._video_info = {"mediatype": tvshow.mediatype} @@ -183,6 +185,11 @@ def watching_info(self): @property def list_item(self): + def is_in_watchlist(): + if self.item.get("in_watchlist") is not None: + return str(int(self.item["in_watchlist"])) + return "" + li = self.plugin.list_item( getattr(self, "li_title", self.title), poster=self.item.get("posters", {}).get("big"), @@ -190,12 +197,10 @@ def list_item(self): thumbnailImage=self.item.get( "thumbnail", self.item.get("posters", {}).get("small", "") ), - properties={"id": self.item_id}, + properties={"id": self.item_id, "in_watchlist": is_in_watchlist()}, video_info=self.video_info, addContextMenuItems=True, ) - if self.item.get("in_watchlist") is not None: - li.setProperty("in_watchlist", str(int(self.item["in_watchlist"]))) li.markAdvert(self.item.get("advert")) return li