mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
Music improvements
This commit is contained in:
parent
96b60bf1d5
commit
5e8756df2d
8 changed files with 12 additions and 11 deletions
|
@ -28,7 +28,7 @@ class YtdlDiscord:
|
||||||
ffmpeg.input(self.ytdl_file.filename)
|
ffmpeg.input(self.ytdl_file.filename)
|
||||||
.output(destination_filename, format="s16le", ac=2, ar="48000")
|
.output(destination_filename, format="s16le", ac=2, ar="48000")
|
||||||
.overwrite_output()
|
.overwrite_output()
|
||||||
.run(quiet=True)
|
.run(quiet=not __debug__)
|
||||||
)
|
)
|
||||||
self.pcm_filename = destination_filename
|
self.pcm_filename = destination_filename
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,9 @@ class YtdlFile:
|
||||||
"""Information about a youtube-dl downloaded file."""
|
"""Information about a youtube-dl downloaded file."""
|
||||||
|
|
||||||
_default_ytdl_args = {
|
_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.
|
"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.
|
"outtmpl": "%(epoch)s-%(title)s-%(id)s.%(ext)s", # Use the default outtmpl.
|
||||||
"ignoreerrors": True # Ignore unavailable videos
|
"ignoreerrors": True # Ignore unavailable videos
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ 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:
|
if "entries" in first_info and first_info["entries"][0] is not None:
|
||||||
second_info_list = []
|
second_info_list = []
|
||||||
for second_info in first_info["entries"]:
|
for second_info in first_info["entries"]:
|
||||||
if second_info is None:
|
if second_info is None:
|
||||||
|
@ -107,11 +107,12 @@ class YtdlInfo:
|
||||||
"youtube": 0xCC0000,
|
"youtube": 0xCC0000,
|
||||||
"soundcloud": 0xFF5400,
|
"soundcloud": 0xFF5400,
|
||||||
"Clyp": 0x3DBEB3,
|
"Clyp": 0x3DBEB3,
|
||||||
"Bandcamp": 0x1DA0C3
|
"Bandcamp": 0x1DA0C3,
|
||||||
|
"Peertube": 0x0A193C,
|
||||||
}
|
}
|
||||||
embed = discord.Embed(title=self.title,
|
embed = discord.Embed(title=self.title,
|
||||||
colour=discord.Colour(colors.get(self.extractor, 0x4F545C)),
|
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:
|
if self.thumbnail:
|
||||||
embed.set_thumbnail(url=self.thumbnail)
|
embed.set_thumbnail(url=self.thumbnail)
|
||||||
if self.uploader:
|
if self.uploader:
|
||||||
|
|
|
@ -36,7 +36,7 @@ class PlayNH(NetworkHandler):
|
||||||
raise Exception("No music_data for this guild")
|
raise Exception("No music_data for this guild")
|
||||||
# Create url
|
# Create url
|
||||||
ytdl_args = {
|
ytdl_args = {
|
||||||
"format": "bestaudio",
|
"format": "bestaudio/best",
|
||||||
"outtmpl": f"./downloads/{datetime.datetime.now().timestamp()}_%(title)s.%(ext)s"
|
"outtmpl": f"./downloads/{datetime.datetime.now().timestamp()}_%(title)s.%(ext)s"
|
||||||
}
|
}
|
||||||
# Start downloading
|
# Start downloading
|
||||||
|
|
|
@ -36,7 +36,7 @@ class SoundcloudNH(NetworkHandler):
|
||||||
raise KeyError("No music data available for this guild.")
|
raise KeyError("No music data available for this guild.")
|
||||||
# Create url
|
# Create url
|
||||||
ytdl_args = {
|
ytdl_args = {
|
||||||
"format": "bestaudio",
|
"format": "bestaudio/best",
|
||||||
"outtmpl": f"./downloads/{datetime.datetime.now().timestamp()}_%(title)s.%(ext)s"
|
"outtmpl": f"./downloads/{datetime.datetime.now().timestamp()}_%(title)s.%(ext)s"
|
||||||
}
|
}
|
||||||
# Start downloading
|
# Start downloading
|
||||||
|
|
|
@ -35,7 +35,7 @@ class YoutubeNH(NetworkHandler):
|
||||||
raise KeyError("No music data available for this guild.")
|
raise KeyError("No music data available for this guild.")
|
||||||
# Create url
|
# Create url
|
||||||
ytdl_args = {
|
ytdl_args = {
|
||||||
"format": "bestaudio",
|
"format": "bestaudio/best",
|
||||||
"outtmpl": f"./downloads/{datetime.datetime.now().timestamp()}_%(title)s.%(ext)s"
|
"outtmpl": f"./downloads/{datetime.datetime.now().timestamp()}_%(title)s.%(ext)s"
|
||||||
}
|
}
|
||||||
# Start downloading
|
# Start downloading
|
||||||
|
|
|
@ -19,7 +19,7 @@ class ZawarudoNH(NetworkHandler):
|
||||||
message_type = "music_zawarudo"
|
message_type = "music_zawarudo"
|
||||||
|
|
||||||
ytdl_args = {
|
ytdl_args = {
|
||||||
"format": "bestaudio",
|
"format": "bestaudio/best",
|
||||||
"outtmpl": f"./downloads/%(title)s.%(ext)s"
|
"outtmpl": f"./downloads/%(title)s.%(ext)s"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
semantic = "5.0a65"
|
semantic = "5.0a66"
|
||||||
|
|
Loading…
Reference in a new issue