Skip to content

Commit

Permalink
fixed random genres for tvshows&movies
Browse files Browse the repository at this point in the history
  • Loading branch information
cartmandos committed Feb 14, 2019
1 parent 33488bb commit 605fe76
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion resources/lib/movies.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ def forgenre(self):
genre = self.options.get("genre", "")
# get a random genre if no genre found
if not genre:
genres = self.metadatautils.kodidb.genres("movie")[0]["label"]
# get a random genre if no genre provided
json_result = self.metadatautils.kodidb.genres("movie")
if json_result:
genre = json_result[randint(0, len(json_result) - 1)]["label"]
all_items = []
if genre:
# get all movies from the same genre
Expand Down
2 changes: 1 addition & 1 deletion resources/lib/tvshows.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def forgenre(self):
# get a random genre if no genre provided
json_result = self.metadatautils.kodidb.genres("tvshow")
if json_result:
genre = json_result[0]["label"]
genre = json_result[randint(0, len(json_result)-1)]["label"]
if genre:
# get all tvshows from the same genre
for item in self.get_genre_tvshows(genre, self.options["hide_watched"], self.options["limit"]):
Expand Down

0 comments on commit 605fe76

Please sign in to comment.