Skip to content

Commit

Permalink
Update for kodi matrix (#13)
Browse files Browse the repository at this point in the history
* fixed mistyped _build_watched_before_filter

* fixed mistyped variable

* Update playrandom.py
  • Loading branch information
porternw authored Apr 8, 2023
1 parent 78f0f3f commit 2f81faf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions python/lib/playrandom.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ def _build_watched_before_filter(content):
if content == "movies":
months = int(get_main_addon().getSetting('movieplayedmonths'))

lastwatched_filter = {'field': 'lastplayed', 'operator': 'notinthelast', 'value': months*30}
return lastwatched_fiter
# jsonrpc stopped playing nicely when combining 'notinthelast' with the other operators in our filter, so falling back to 'lessthan'
#lastwatched_filter = {'field': 'lastplayed', 'operator': 'notinthelast', 'value': months*30}
watchbeforedate = (datetime.now() - timedelta(days=months*30)).isoformat(' ')
lastwatched_filter = {'field': 'lastplayed', 'operator': 'lessthan', 'value': watchbeforedate}
return lastwatched_filter

def _parse_path(pathinfo):
content = None
Expand Down Expand Up @@ -148,7 +151,7 @@ def _parse_path(pathinfo):
elif watchmode == WATCHMODE_WATCHED:
filters.append(played_filter)
elif watchmode == WATCHMODE_WATCHEDBEFORE:
lastwatched_filter = _build_watched_before_fiter(content)
lastwatched_filter = _build_watched_before_filter(content)
filters.append(lastwatched_filter)

if content == 'tvshows' and get_main_addon().getSetting('exclude_extras') == 'true':
Expand Down

0 comments on commit 2f81faf

Please sign in to comment.