Finally fixed thumbnails
This commit is contained in:
parent
063d2d08af
commit
106d151157
|
|
@ -11,7 +11,7 @@ if discord.__version__ != "2.0.0a":
|
||||||
"using 'pip install git+https://github.com/Rapptz/discord.py@master'"
|
"using 'pip install git+https://github.com/Rapptz/discord.py@master'"
|
||||||
)
|
)
|
||||||
|
|
||||||
__version__ = "1.1.3"
|
__version__ = "1.1.4"
|
||||||
__title__ = "pomice"
|
__title__ = "pomice"
|
||||||
__author__ = "cloudwithax"
|
__author__ = "cloudwithax"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,14 @@
|
||||||
|
import re
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
from .enums import SearchType
|
from .enums import SearchType
|
||||||
|
|
||||||
|
SOUNDCLOUD_URL_REGEX = re.compile(
|
||||||
|
r"^(https?:\/\/)?(www.)?(m\.)?soundcloud\.com\/[\w\-\.]+(\/)+[\w\-\.]+/?$"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class Track:
|
class Track:
|
||||||
"""The base track object. Returns critical track information needed for parsing by Lavalink.
|
"""The base track object. Returns critical track information needed for parsing by Lavalink.
|
||||||
|
|
@ -30,12 +35,20 @@ class Track:
|
||||||
|
|
||||||
self.title = info.get("title")
|
self.title = info.get("title")
|
||||||
self.author = info.get("author")
|
self.author = info.get("author")
|
||||||
self.thumbnail = info.get("thumbnail")
|
self.uri = info.get("uri")
|
||||||
|
self.identifier = info.get("identifier")
|
||||||
|
if info.get("thumbnail"):
|
||||||
|
self.thumbnail = info.get("thumbnail")
|
||||||
|
else:
|
||||||
|
if SOUNDCLOUD_URL_REGEX.match(self.uri):
|
||||||
|
# ok so theres no feasible way of getting a Soundcloud image URL
|
||||||
|
# so we're just gonna leave it blank for brevity
|
||||||
|
self.thumbnail = None
|
||||||
|
else:
|
||||||
|
self.thumbnail = f"https://img.youtube.com/vi/{self.identifier}/mqdefault.jpg"
|
||||||
self.length = info.get("length")
|
self.length = info.get("length")
|
||||||
self.ctx = ctx
|
self.ctx = ctx
|
||||||
self.requester = self.ctx.author if ctx else None
|
self.requester = self.ctx.author if ctx else None
|
||||||
self.identifier = info.get("identifier")
|
|
||||||
self.uri = info.get("uri")
|
|
||||||
self.is_stream = info.get("isStream")
|
self.is_stream = info.get("isStream")
|
||||||
self.is_seekable = info.get("isSeekable")
|
self.is_seekable = info.get("isSeekable")
|
||||||
self.position = info.get("position")
|
self.position = info.get("position")
|
||||||
|
|
|
||||||
|
|
@ -383,6 +383,7 @@ class Node:
|
||||||
) as response:
|
) as response:
|
||||||
data = await response.json()
|
data = await response.json()
|
||||||
|
|
||||||
|
|
||||||
load_type = data.get("loadType")
|
load_type = data.get("loadType")
|
||||||
|
|
||||||
if not load_type:
|
if not load_type:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue