mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Some new commands (that don't really work)
This commit is contained in:
parent
8d08d7e010
commit
d82b824a34
2 changed files with 11 additions and 6 deletions
|
@ -106,7 +106,11 @@ class YtdlInfo:
|
||||||
if first_info is None:
|
if first_info is None:
|
||||||
return []
|
return []
|
||||||
# If it is a playlist, create multiple videos!
|
# If it is a playlist, create multiple videos!
|
||||||
if "entries" in first_info and first_info["entries"][0] is not None:
|
if "entries" in first_info:
|
||||||
|
if len(first_info["entries"]) == 0:
|
||||||
|
return []
|
||||||
|
if first_info["entries"][0] is None:
|
||||||
|
return []
|
||||||
log.debug(f"Found a playlist: {url}")
|
log.debug(f"Found a playlist: {url}")
|
||||||
second_info_list = []
|
second_info_list = []
|
||||||
for second_info in first_info["entries"]:
|
for second_info in first_info["entries"]:
|
||||||
|
|
|
@ -16,6 +16,7 @@ class PlayableYTDQueue(Playable):
|
||||||
def __init__(self, start_with: Optional[List[YtdlDiscord]] = None):
|
def __init__(self, start_with: Optional[List[YtdlDiscord]] = None):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.contents: List[YtdlDiscord] = []
|
self.contents: List[YtdlDiscord] = []
|
||||||
|
self.now_playing: Optional[YtdlDiscord] = None
|
||||||
if start_with is not None:
|
if start_with is not None:
|
||||||
self.contents = [*self.contents, *start_with]
|
self.contents = [*self.contents, *start_with]
|
||||||
log.debug(f"Created new PlayableYTDQueue containing: {self.contents}")
|
log.debug(f"Created new PlayableYTDQueue containing: {self.contents}")
|
||||||
|
@ -27,19 +28,19 @@ class PlayableYTDQueue(Playable):
|
||||||
log.debug(f"Dequeuing an item...")
|
log.debug(f"Dequeuing an item...")
|
||||||
try:
|
try:
|
||||||
# Try to get the first YtdlDiscord of the queue
|
# Try to get the first YtdlDiscord of the queue
|
||||||
ytd: YtdlDiscord = self.contents.pop(0)
|
self.now_playing: YtdlDiscord = self.contents.pop(0)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
# If there isn't anything, yield None
|
# If there isn't anything, yield None
|
||||||
log.debug(f"Nothing to dequeue, yielding None.")
|
log.debug(f"Nothing to dequeue, yielding None.")
|
||||||
yield None
|
yield None
|
||||||
continue
|
continue
|
||||||
log.debug(f"Yielding FileAudioSource from: {ytd}")
|
log.debug(f"Yielding FileAudioSource from: {self.now_playing}")
|
||||||
# Create a FileAudioSource from the YtdlDiscord
|
# Create a FileAudioSource from the YtdlDiscord
|
||||||
# If the file hasn't been fetched / downloaded / converted yet, it will do so before yielding
|
# If the file hasn't been fetched / downloaded / converted yet, it will do so before yielding
|
||||||
async with ytd.spawn_audiosource() as fas:
|
async with self.now_playing.spawn_audiosource() as fas:
|
||||||
# Yield the resulting AudioSource
|
# Yield the resulting AudioSource
|
||||||
yield fas
|
yield fas
|
||||||
# Delete the YtdlDiscord file
|
# Delete the YtdlDiscord file
|
||||||
log.debug(f"Deleting: {ytd}")
|
log.debug(f"Deleting: {self.now_playing}")
|
||||||
await ytd.delete_asap()
|
await self.now_playing.delete_asap()
|
||||||
log.debug(f"Deleted successfully!")
|
log.debug(f"Deleted successfully!")
|
||||||
|
|
Loading…
Reference in a new issue