Fix bug with tv and movie paths
This commit is contained in:
parent
51e75e9f0f
commit
881dffefe6
@ -116,9 +116,9 @@ def get_tv_shows():
|
|||||||
def get_games():
|
def get_games():
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
i = inotify.adapters.Inotify()
|
i = inotify.adapters.Inotify()
|
||||||
i.add_watch(func.GAMES_DIRECTORY)
|
i.add_watch(str(func.GAMES_DIRECTORY))
|
||||||
for directory in os.listdir(str(func.GAMES_DIRECTORY)):
|
for directory in func.GAMES_DIRECTORY.iterdir():
|
||||||
path = pathlib.Path(func.GAMES_DIRECTORY, directory)
|
path = func.GAMES_DIRECTORY / directory
|
||||||
if path.is_dir():
|
if path.is_dir():
|
||||||
i.add_watch(str(path))
|
i.add_watch(str(path))
|
||||||
|
|
||||||
|
@ -168,7 +168,9 @@ def get_movie(tmdb_id):
|
|||||||
directors_cut = request.args.get("directors_cut", default=False, type=bool)
|
directors_cut = request.args.get("directors_cut", default=False, type=bool)
|
||||||
res_4k = request.args.get("res_4k", default=False, type=bool)
|
res_4k = request.args.get("res_4k", default=False, type=bool)
|
||||||
movie_data = database.db_get_movie_by_tmdb_id(tmdb_id, extended=extended, directors_cut=directors_cut)
|
movie_data = database.db_get_movie_by_tmdb_id(tmdb_id, extended=extended, directors_cut=directors_cut)
|
||||||
filename = movie_data.path.replace(str(func.MOVIES_DIRECTORY), "")
|
filename: str = movie_data.path.replace(str(func.MOVIES_DIRECTORY), "")
|
||||||
|
if filename.startswith("/"):
|
||||||
|
filename = filename[1:]
|
||||||
if res_4k:
|
if res_4k:
|
||||||
filename = filename.replace(f"({movie_data.year})", f"({movie_data.year})(4K)")
|
filename = filename.replace(f"({movie_data.year})", f"({movie_data.year})(4K)")
|
||||||
response = make_response(send_from_directory(func.MOVIES_DIRECTORY, filename))
|
response = make_response(send_from_directory(func.MOVIES_DIRECTORY, filename))
|
||||||
@ -180,7 +182,9 @@ def get_movie(tmdb_id):
|
|||||||
@login_required
|
@login_required
|
||||||
def get_episode(tmdb_id):
|
def get_episode(tmdb_id):
|
||||||
episode_data = database.db_get_episode_by_tmdb_id(tmdb_id)
|
episode_data = database.db_get_episode_by_tmdb_id(tmdb_id)
|
||||||
filename = episode_data.path.replace(str(func.TV_SHOWS_DIRECTORY), "")
|
filename: str = episode_data.path.replace(str(func.TV_SHOWS_DIRECTORY), "")
|
||||||
|
if filename.startswith("/"):
|
||||||
|
filename = filename[1:]
|
||||||
response = make_response(send_from_directory(func.TV_SHOWS_DIRECTORY, filename))
|
response = make_response(send_from_directory(func.TV_SHOWS_DIRECTORY, filename))
|
||||||
response.headers["content-type"] = "video/webm"
|
response.headers["content-type"] = "video/webm"
|
||||||
return response
|
return response
|
||||||
|
Loading…
Reference in New Issue
Block a user