add config var to video.html template

This commit is contained in:
simon 2022-04-08 22:10:16 +07:00
parent 552636d882
commit 236215cc4c
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4

View File

@ -670,7 +670,7 @@ class VideoView(View):
def get(self, request, video_id): def get(self, request, video_id):
"""get single video""" """get single video"""
colors, cast = self.read_config(user_id=request.user.id) config_handler = AppConfig(request.user.id)
path = f"ta_video/_doc/{video_id}" path = f"ta_video/_doc/{video_id}"
look_up = SearchHandler(path, config=False) look_up = SearchHandler(path, config=False)
video_hit = look_up.get_data() video_hit = look_up.get_data()
@ -692,9 +692,10 @@ class VideoView(View):
"video": video_data, "video": video_data,
"playlist_nav": playlist_nav, "playlist_nav": playlist_nav,
"title": video_title, "title": video_title,
"colors": colors, "colors": config_handler.colors,
"cast": cast, "cast": config_handler.config["application"]["enable_cast"],
"version": settings.TA_VERSION, "version": settings.TA_VERSION,
"config": config_handler.config,
} }
return render(request, "home/video.html", context) return render(request, "home/video.html", context)
@ -711,14 +712,6 @@ class VideoView(View):
return all_navs return all_navs
@staticmethod
def read_config(user_id):
"""read config file"""
config_handler = AppConfig(user_id)
cast = config_handler.config["application"]["enable_cast"]
colors = config_handler.colors
return colors, cast
@staticmethod @staticmethod
def star_creator(rating): def star_creator(rating):
"""convert rating float to stars""" """convert rating float to stars"""