Skip to content

Commit

Permalink
Fixed missing 'Буду смотреть' context menu item (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
quarckster authored Jan 26, 2021
1 parent b3d704d commit 578fdcf
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/resources/lib/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -183,19 +185,22 @@ 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"),
fanart=self.item.get("posters", {}).get("wide"),
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

Expand Down

0 comments on commit 578fdcf

Please sign in to comment.