fix chown for subtitles
This commit is contained in:
parent
5b2d7db102
commit
4038a837cf
|
@ -115,7 +115,7 @@ class YoutubeSubtitle:
|
||||||
source = subtitle["source"]
|
source = subtitle["source"]
|
||||||
lang = subtitle.get("lang")
|
lang = subtitle.get("lang")
|
||||||
response = requests.get(
|
response = requests.get(
|
||||||
subtitle["url"], headers=requests_headers()
|
subtitle["url"], headers=requests_headers(), timeout=30
|
||||||
)
|
)
|
||||||
if not response.ok:
|
if not response.ok:
|
||||||
print(f"{self.video.youtube_id}: failed to download subtitle")
|
print(f"{self.video.youtube_id}: failed to download subtitle")
|
||||||
|
@ -137,14 +137,18 @@ class YoutubeSubtitle:
|
||||||
|
|
||||||
return indexed
|
return indexed
|
||||||
|
|
||||||
@staticmethod
|
def _write_subtitle_file(self, dest_path, subtitle_str):
|
||||||
def _write_subtitle_file(dest_path, subtitle_str):
|
|
||||||
"""write subtitle file to disk"""
|
"""write subtitle file to disk"""
|
||||||
# create folder here for first video of channel
|
# create folder here for first video of channel
|
||||||
os.makedirs(os.path.split(dest_path)[0], exist_ok=True)
|
os.makedirs(os.path.split(dest_path)[0], exist_ok=True)
|
||||||
with open(dest_path, "w", encoding="utf-8") as subfile:
|
with open(dest_path, "w", encoding="utf-8") as subfile:
|
||||||
subfile.write(subtitle_str)
|
subfile.write(subtitle_str)
|
||||||
|
|
||||||
|
host_uid = self.video.config["application"]["HOST_UID"]
|
||||||
|
host_gid = self.video.config["application"]["HOST_GID"]
|
||||||
|
if host_uid and host_gid:
|
||||||
|
os.chown(dest_path, host_uid, host_gid)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _index_subtitle(query_str):
|
def _index_subtitle(query_str):
|
||||||
"""send subtitle to es for indexing"""
|
"""send subtitle to es for indexing"""
|
||||||
|
|
Loading…
Reference in New Issue