mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Fix player ignoring existing songs
This commit is contained in:
parent
0b86fd1ce4
commit
f4804276d9
1 changed files with 2 additions and 2 deletions
|
@ -56,6 +56,8 @@ class Video:
|
||||||
info = info["entries"][0]
|
info = info["entries"][0]
|
||||||
file_id = info.get("title", str(hash(self.ytdl_url)))
|
file_id = info.get("title", str(hash(self.ytdl_url)))
|
||||||
file_id = re.sub(r"(?:\/|\\|\?|\*|\"|<|>|\||:)", "_", file_id)
|
file_id = re.sub(r"(?:\/|\\|\?|\*|\"|<|>|\||:)", "_", file_id)
|
||||||
|
# Set the filename to the downloaded video
|
||||||
|
self.filename = file_id
|
||||||
if os.path.exists(f"opusfiles/{file_id}.opus"):
|
if os.path.exists(f"opusfiles/{file_id}.opus"):
|
||||||
return
|
return
|
||||||
if info.get("duration", 1) > int(config["YouTube"]["max_duration"]):
|
if info.get("duration", 1) > int(config["YouTube"]["max_duration"]):
|
||||||
|
@ -75,8 +77,6 @@ class Video:
|
||||||
# Download the video
|
# Download the video
|
||||||
with youtube_dl.YoutubeDL(ytdl_args) as ytdl:
|
with youtube_dl.YoutubeDL(ytdl_args) as ytdl:
|
||||||
await loop.run_in_executor(executor, functools.partial(ytdl.download, [self.ytdl_url]))
|
await loop.run_in_executor(executor, functools.partial(ytdl.download, [self.ytdl_url]))
|
||||||
# Set the filename to the downloaded video
|
|
||||||
self.filename = file_id
|
|
||||||
|
|
||||||
|
|
||||||
if __debug__:
|
if __debug__:
|
||||||
|
|
Loading…
Reference in a new issue