Disable YT search, working on fix

This commit is contained in:
Will Tekulve 2016-05-12 22:00:27 -04:00
parent bb99430a9b
commit a1cc088b6a

View File

@ -21,12 +21,6 @@ __version__ = "0.0.1"
log = logging.getLogger("red.audio") log = logging.getLogger("red.audio")
log.setLevel(logging.DEBUG) log.setLevel(logging.DEBUG)
__author__ = "tekulvw"
__version__ = "0.0.1"
log = logging.getLogger("red.audio")
log.setLevel(logging.DEBUG)
try: try:
import youtube_dl import youtube_dl
except: except:
@ -195,6 +189,8 @@ class Downloader(threading.Thread):
self.url = "https://youtube.com/watch?v={}".format( self.url = "https://youtube.com/watch?v={}".format(
video["entries"][0]["id"]) video["entries"][0]["id"])
video.url = self.url
self.song = Song(**video) self.song = Song(**video)
@ -1068,14 +1064,14 @@ class Audio:
await self.bot.say("I'm already downloading a file!") await self.bot.say("I'm already downloading a file!")
return return
if caller != "yt_search": if caller == "yt_search":
if not self._valid_playable_url(url):
await self.bot.say("That's not a valid URL.")
return
else:
url = "[SEARCH:]" + url url = "[SEARCH:]" + url
self._clear_queue(server) elif not self._valid_playable_url(url):
await self.bot.say("That's not a valid URL.")
return
self._stop_player(server) self._stop_player(server)
self._clear_queue(server)
self._add_to_queue(server, url) self._add_to_queue(server, url)
@commands.command(pass_context=True, no_pm=True) @commands.command(pass_context=True, no_pm=True)
@ -1108,19 +1104,6 @@ class Audio:
else: else:
await self.bot.say("Not playing anything on this server.") await self.bot.say("Not playing anything on this server.")
@commands.command(pass_context=True, no_pm=True)
async def sing(self, ctx):
"""Makes Red sing one of her songs"""
ids = ("zGTkAVsrfg8", "cGMWL8cOeAU", "vFrjMq4aL-g", "WROI5WYBU_A",
"41tIUr_ex3g", "f9O2Rjn1azc")
url = "https://www.youtube.com/watch?v={}".format(choice(ids))
await self.play.callback(self, ctx, url)
@commands.command(name="yt", pass_context=True, no_pm=True)
async def yt_search(self, ctx, *, search_terms: str):
"""Searches and plays a video from YouTube"""
await self.play.callback(self, ctx, search_terms)
@commands.group(pass_context=True, no_pm=True) @commands.group(pass_context=True, no_pm=True)
async def playlist(self, ctx): async def playlist(self, ctx):
"""Playlist management/control.""" """Playlist management/control."""
@ -1360,6 +1343,14 @@ class Audio:
else: else:
await self.bot.say("Can't skip if I'm not playing.") await self.bot.say("Can't skip if I'm not playing.")
@commands.command(pass_context=True, no_pm=True)
async def sing(self, ctx):
"""Makes Red sing one of her songs"""
ids = ("zGTkAVsrfg8", "cGMWL8cOeAU", "vFrjMq4aL-g", "WROI5WYBU_A",
"41tIUr_ex3g", "f9O2Rjn1azc")
url = "https://www.youtube.com/watch?v={}".format(choice(ids))
await self.play.callback(self, ctx, url)
@commands.command(pass_context=True, no_pm=True) @commands.command(pass_context=True, no_pm=True)
async def song(self, ctx): async def song(self, ctx):
"""Info about the current song.""" """Info about the current song."""
@ -1385,6 +1376,12 @@ class Audio:
self._stop(server) self._stop(server)
@commands.command(name="yt", pass_context=True, no_pm=True)
async def yt_search(self, ctx, *, search_terms: str):
"""Searches and plays a video from YouTube"""
await self.bot.say('This got broken. Will be fixed soon.')
# await self.play.callback(self, ctx, search_terms)
def is_playing(self, server): def is_playing(self, server):
if not self.voice_connected(server): if not self.voice_connected(server):
return False return False