<commit_before>from discord.ext import commands
import discord, pafy
import os, sys, logging

class EmptyPlaylist(Exception):
	pass

class Audio
	"Play music, stream music"
	###############################################
	#
	#	Constructor, must pass in the voice channel
	#
	###############################################
	
	#creating an instance of playlist
	playlist= Playlist();
	
	def __init__(self, voice_channel, client_object):
		self.voice_channel = voice_channel
		self.client_object = client_object
	
	def add_song_to_playlist():
		song_url=input("Please enter a song URL: ")
		try:
			playlist.addsong(song_url)
		except Playlist.DuplicateSongURL:
			print("Song already exists in the playlist")
		except Playlist.NotValidNameOrURL:
			print("Not a valid input, must be a string of a song url")
	
	def play():
		if (playlist.size() == 0):
			raise EmptyPlaylist()
		#play the music
		voice = client_object.join_voice_channel(voice_channel)
		for i in (playlist.size()-1):
			player = voice.create_ytdl_player(playlist.currentsong())
			await player.start()
			playlist.nextsong()
	
	def skipsong():
		playlist.removethsong(0)
		play()
	
	<commit_msg>Updated audio and bot, support for checking url for yt, soundcloud<commit_after>from discord.ext import commands
import discord
import os, sys, logging
import asyncio

class EmptyPlaylist(Exception):
	pass

class Audio
	"Play music, stream music"
	###############################################
	#
	#	Constructor, must pass in the voice channel
	#
	###############################################
	
	#creating an instance of playlist
	playlist= Playlist();
	
	#Constructor, get the client or bot object from bot.py
	def __init__(self, voice_channel, client_object):
		self.voice_channel = voice_channel
		self.client_object = client_object
	
	#adding a new song to playlist
	#
	#	Expected exception:
	#		Playlist.DuplicateSongURL - Song/URL already exists
	#		Playlist.NotValidNameOrURL - Song/URL not in valid format aka String
	def add_song_to_playlist():
		song_url=input("Please enter a song URL: ")
		try:
			playlist.addsong(song_url)
		except Playlist.DuplicateSongURL:
			print("Song already exists in the playlist")
		except Playlist.NotValidNameOrURL:
			print("Not a valid input, must be a string of a song url")
	
	def _create_a_stream(playlist):
		voice = client_object.join_voice_channel(voice_channel)
		player=None
		if "youtube" in playlist.currentsong():
			player= voice.create_ytdl_player(playlist.currentsong())
		elif "soundcloud" in playlist.currentsong():
			player=
		return player
		
	#Take the bot object create a stream to play music from youtube
	# TODO: create one for soundcloud
	def play():
		if (playlist.size() == 0):
			raise EmptyPlaylist()
		#play the music
		for i in (playlist.size()-1):
			player = _create_a_stream(playlist)
			player.start()
			if player.is_done():
				playlist.nextsong()
	def pause():
		
		
	def resume():
		
	
	def skipsong():
		playlist.removethsong(0)
		play()
	
	
{'fraction_non_alphanumeric': 0.14806149732620322, 'fraction_numerical': 0.002005347593582888, 'mean_word_length': 4.615384615384615, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3444944', 'n_tokens_mistral': 1052, 'n_tokens_neox': 918, 'n_words': 274}