1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 11:34:18 +00:00

Music improvements

This commit is contained in:
Steffo 2019-10-15 17:26:02 +02:00
parent 96b60bf1d5
commit 5e8756df2d
8 changed files with 12 additions and 11 deletions

View file

@ -28,7 +28,7 @@ class YtdlDiscord:
ffmpeg.input(self.ytdl_file.filename)
.output(destination_filename, format="s16le", ac=2, ar="48000")
.overwrite_output()
.run(quiet=True)
.run(quiet=not __debug__)
)
self.pcm_filename = destination_filename

View file

@ -10,9 +10,9 @@ class YtdlFile:
"""Information about a youtube-dl downloaded file."""
_default_ytdl_args = {
"quiet": True, # Do not print messages to stdout.
"quiet": not __debug__, # Do not print messages to stdout.
"noplaylist": True, # Download single video instead of a playlist if in doubt.
"no_warnings": True, # Do not print out anything for warnings.
"no_warnings": not __debug__, # Do not print out anything for warnings.
"outtmpl": "%(epoch)s-%(title)s-%(id)s.%(ext)s", # Use the default outtmpl.
"ignoreerrors": True # Ignore unavailable videos
}

View file

@ -92,7 +92,7 @@ class YtdlInfo:
if first_info is None:
return []
# If it is a playlist, create multiple videos!
if "entries" in first_info:
if "entries" in first_info and first_info["entries"][0] is not None:
second_info_list = []
for second_info in first_info["entries"]:
if second_info is None:
@ -107,11 +107,12 @@ class YtdlInfo:
"youtube": 0xCC0000,
"soundcloud": 0xFF5400,
"Clyp": 0x3DBEB3,
"Bandcamp": 0x1DA0C3
"Bandcamp": 0x1DA0C3,
"Peertube": 0x0A193C,
}
embed = discord.Embed(title=self.title,
colour=discord.Colour(colors.get(self.extractor, 0x4F545C)),
url=self.webpage_url if self.webpage_url is not None else discord.embeds.EmptyEmbed)
url=self.webpage_url if self.webpage_url is not None and self.webpage_url.startswith("http") else discord.embeds.EmptyEmbed)
if self.thumbnail:
embed.set_thumbnail(url=self.thumbnail)
if self.uploader:

View file

@ -36,7 +36,7 @@ class PlayNH(NetworkHandler):
raise Exception("No music_data for this guild")
# Create url
ytdl_args = {
"format": "bestaudio",
"format": "bestaudio/best",
"outtmpl": f"./downloads/{datetime.datetime.now().timestamp()}_%(title)s.%(ext)s"
}
# Start downloading

View file

@ -36,7 +36,7 @@ class SoundcloudNH(NetworkHandler):
raise KeyError("No music data available for this guild.")
# Create url
ytdl_args = {
"format": "bestaudio",
"format": "bestaudio/best",
"outtmpl": f"./downloads/{datetime.datetime.now().timestamp()}_%(title)s.%(ext)s"
}
# Start downloading

View file

@ -35,7 +35,7 @@ class YoutubeNH(NetworkHandler):
raise KeyError("No music data available for this guild.")
# Create url
ytdl_args = {
"format": "bestaudio",
"format": "bestaudio/best",
"outtmpl": f"./downloads/{datetime.datetime.now().timestamp()}_%(title)s.%(ext)s"
}
# Start downloading

View file

@ -19,7 +19,7 @@ class ZawarudoNH(NetworkHandler):
message_type = "music_zawarudo"
ytdl_args = {
"format": "bestaudio",
"format": "bestaudio/best",
"outtmpl": f"./downloads/%(title)s.%(ext)s"
}

View file

@ -1 +1 @@
semantic = "5.0a65"
semantic = "5.0a66"