public ActionResult DirectDownloadAudio([FromRoute] string vid) { if (!ValidateVid(vid)) { return(BadRequest($"'{vid}' is not a valid video ID")); } var info = YoutubeHelper.GetVideoInfo(vid); if (info.DurationSeconds > (Max_Duration_Seconds * 2)) { return(BadRequest($"Cannot process videos longer than {Max_Duration_Seconds * 2} seconds")); } var outputFilePath = $"{Output_Root}/yt/{vid}.mp3"; if (System.IO.File.Exists(outputFilePath)) { return(PhysicalFile(outputFilePath, "audio/mpeg", $"{info.Filename}-{vid}.mp3")); } var audio = YoutubeHelper.DownloadAudioMp3(vid); if (System.IO.File.Exists(audio)) { return(PhysicalFile(audio, "audio/mpeg", $"{info.Filename}-{vid}.mp3")); } return(BadRequest("Video requested was not found")); }
/// <summary> /// Initializes a new instance of the <see cref="PlaylistReader"/> class. /// </summary> /// <param name="url">The url<see cref="string"/></param> /// <param name="videos">The videos<see cref="int[]"/></param> /// <param name="reverse">The reverse<see cref="bool"/></param> public PlaylistReader(string url, int[] videos, bool reverse) { var json_dir = AppEnvironment.GetJsonDirectory(); _playlist_id = YoutubeHelper.GetPlaylistId(url); var range = string.Empty; if (videos != null && videos.Length > 0) { // Make sure the video indexes is sorted, otherwise reversing wont do anything Array.Sort(videos); range = string.Format(CmdPlaylistRange, string.Join(",", videos)); } var reverseS = reverse ? CmdPlaylistReverse : string.Empty; _arguments = string.Format(CmdPlaylistInfo, json_dir, _playlist_id, range, reverseS, url); _url = url; YoutubeDl.LogHeader(_arguments); _youtubeDl = ProcessHelper.StartProcess(YoutubeDl.YouTubeDlPath, _arguments, OutputReadLine, ErrorReadLine, null); _youtubeDl.Exited += delegate { _processFinished = true; YoutubeDl.LogFooter(); }; }
private void TaskOnClick() { var log = new SuperLog(new UnityLog(), false); log.Send(true, Hi.AutoTestNumber); var youVideos = new YoutubeHelper().GetVideos("X1x5crID83c", log); }
public async Task <ActionResult <Video> > PostVideo(URLDTO URL) { String videoId = YoutubeHelper.GetVideoIdFromURL(URL.URL); Video newVideo = YoutubeHelper.GetVideoFromId(videoId); _context.Video.Add(newVideo); await _context.SaveChangesAsync(); TranscriptionsController transcriptionsController = new TranscriptionsController(new youtubeContext()); List <Transcription> transcriptions = YoutubeHelper.GetTranscriptions(videoId); //Go through each transaction and insert it into the database by calling PostTransactions() Task addCaptions = Task.Run(async() => { for (int i = 0; i < transcriptions.Count; i++) { Transcription transcription = transcriptions.ElementAt(i); transcription.VideoId = newVideo.VideoId; await transcriptionsController.PostTranscription(transcription); Console.WriteLine("inserting transcription" + i); } }); return(CreatedAtAction("GetVideo", new { id = newVideo.VideoId }, newVideo)); }
public bool LoadVideoFromYoutube(string URL) { try { // Experimental youtube support var videos = YoutubeHelper.GetVideoURLs(URL); /* * cbVideoStreams.Items.Clear(); * foreach (YoutubeHelperVideoLink l in videos) * { * cbVideoStreams.Items.Add(l.QualityName); * } */ if (videos.Count <= 0) { return(false); } media.SetMedia(new Uri(videos[0].VideoURL)); return(true); } catch { return(false); } }
public ActionResult Download([FromRoute] string format, [FromRoute] string vid, [FromQuery] string sub, [FromQuery] string ext, [FromQuery] bool hf = false) { if (!ValidateVid(vid)) { return(BadRequest($"'{vid}' is not a valid video ID")); } var subFormats = sub?.Split(',', StringSplitOptions.RemoveEmptyEntries).Select(s => s.Trim()).ToList(); if (subFormats != null && !ValidateFormat(format, subFormats)) { return(BadRequest($"'{format}:{string.Join("+", subFormats)}' is not a valid format")); } if (!ValidateExtension(ext)) { return(BadRequest($"'{ext}' is not a valid extension")); } var outputFilename = _processor.GetOutputFileName(vid, format, subFormats, ext, hf); var outputFilePath = $"{Output_Root}/yt/{outputFilename}"; if (System.IO.File.Exists(outputFilePath)) { var info = YoutubeHelper.GetVideoInfo(vid); var contentType = ext == ".mp4" ? "video/mp4" : ext == ".zip" ? "application/zip" : "audio/mpeg"; return(PhysicalFile(outputFilePath, contentType, info.Filename + ext)); } return(Problem($"File {outputFilename} not found")); }
public void GetVideoIdFromUrl_Https_Success() { var id = YoutubeHelper.GetVideoIdFromUrl("https://www.youtube.com/watch?v=VL3jSgR9ySE"); Assert.IsNotNull(id); Assert.IsFalse(id.IsNullOrWhiteSpace()); Assert.IsTrue(id.Length >= 11); }
public void GetVideoIdTest(string url, string videoId) { //Arrange //Act var actual = YoutubeHelper.GetVideoId(url); //Assert actual.Should().Be(videoId); }
public async Task <ActionResult <Video> > PostVideo(VideoBuilder URL) { string videoID = YoutubeHelper.GetVideoLink(URL.URL); Video newVideo = YoutubeHelper.getVideoInfo(videoID); _context.Video.Add(newVideo); await _context.SaveChangesAsync(); return(CreatedAtAction("GetVideo", new { id = newVideo.VideoId }, newVideo)); }
public override void HandlePacket(Dictionary <string, object> data, IWebSocketConnection socket, RemoteConnectionInfo info, Room room, ref List <IWebSocketConnection> allSockets) { string id = data["id"] as string; int startSeconds = 0; if (data.ContainsKey("t")) { startSeconds = (int)(long)data["t"]; } if (room != null) { var videoInfo = room.AddVideo(id, startSeconds); if (YoutubeHelper.VideoExists(id)) { if (YoutubeHelper.CanEmbed(id)) { var title = YoutubeHelper.GetTitle(id); var author = YoutubeHelper.GetAuthor(id); var channelImage = YoutubeHelper.GetChannelImage(id); var totalSeconds = YoutubeHelper.GetTotalTime(id); var totalTimeSpan = TimeSpan.FromSeconds(totalSeconds); var totalTime = string.Format("({0})", totalTimeSpan.ToString()); room.SendAddVideoToAll(videoInfo, title, totalTime, author, channelImage); room.SendChatMessageToAll(info.Name + " added " + title + " to the playlist."); if (room.CurrentPlayingVideo == null) { room.GotoNextVideo(); room.PlayVideo(); room.SendSetVideoToAll(room.CurrentPlayingVideo.VideoID, room.CurrentPlayingVideo.PlayState, (float)room.CurrentPlayingVideo.ElapsedSeconds); } } else { info.SendVideoMessage("Author of video doesn't allow embedding this video."); } } else { info.SendVideoMessage("Video does not exist on youtube."); } } else { info.SendVideoMessage("You need to join a room first."); } }
private async void Login() { if (Sessao.youtube == null) { var youtube = new YoutubeHelper(); var estaLogado = await youtube.Login(); if (estaLogado) { Sessao.youtube = youtube; } } }
private void GetAvailableFormats(object sender, DoWorkEventArgs e) { SVD = YoutubeHelper.GetVideoData((string)e.Argument); //JArray formats = vi.Formats; JArray formats = SVD.AdaptiveFormats; JArray listedFormats = new JArray(); int pg = 0; foreach (var info in formats) { if (info["mimeType"].ToString() != "video/webm; codecs=\"vp9\"") { listedFormats.Add(info); lister.ReportProgress(pg, info); pg++; } } }
public ActionResult DirectDownloadVideo([FromRoute] string vid) { if (!ValidateVid(vid)) { return(BadRequest($"'{vid}' is not a valid video ID")); } var info = YoutubeHelper.GetVideoInfo(vid); if (info.DurationSeconds > (Max_Duration_Seconds * 2)) { return(BadRequest($"Cannot process videos longer than {Max_Duration_Seconds * 2} seconds")); } var video = YoutubeHelper.DownloadVideo(vid, true); if (System.IO.File.Exists(video.VideoFileFullPath)) { return(PhysicalFile(video.VideoFileFullPath, "video/mp4", $"{info.Filename}-{vid}.mp4")); } return(BadRequest("Video requested was not found")); }
static async Task Main(string[] args) { Console.WriteLine("Input Youtube video id or link: "); var idOrLink = Console.ReadLine(); var videoLinks = await YoutubeHelper.GetVideoPlayLinks(idOrLink); if (videoLinks == null || videoLinks.Count == 0) { Console.WriteLine("Error occurred! May be the video is VEVO or age | country restricted"); } else { foreach (var video in videoLinks) { Console.WriteLine($"\n{video.Title} | {video.Link}\n"); } } Console.Read(); }
protected void Page_Load(object sender, EventArgs e) { if (_itemIndex % 2 == 0) { LitSectionTag.Text = String.Format("<section class=\"half-panel {0} clearfix\"> ", "fl"); } else { LitSectionTag.Text = String.Format("<section class=\"half-panel {0} clearfix\"> ", "fr"); } YoutubeHelper youtubeHelper = new YoutubeHelper(); LitYoutubeLink.Text = string.Format( "<iframe width='480' height='300' frameborder='0' src='http://www.youtube.com/embed/{0}?wmode=transparent' wmode='Opaque'></iframe>", youtubeHelper.YoutubeIDGet( _currentVideoItem.YoutubeCode.Url)); LitTextLink.Text = string.Format("<h3><a href=\"{0}\"> {1}</a></h3>", _currentVideoItem.Link.Url, _currentVideoItem.Heading.Rendered); LitSectionEndTag.Text = "</section>"; }
public void IsYoutubeUrl_TooShortVideoId_False() { var result = YoutubeHelper.IsYoutubeUrl("https://www.youtube.com/watch?v=VL5h3"); Assert.IsFalse(result); }
public static void Main(string[] args) { YoutubeHelper.TestProgramme(); //CreateWebHostBuilder(args).Build().Run(); }
public static void Register(CommandService commandService, SoundManager soundManager, SoundBoard soundBoard, DirectoryInfo _songCacheFolder) { #region CommandEvents commandService.CommandErrored += async(s, e) => { if (e.Exception == null) { return; } MyLogger.WriteException(e.Exception, "[CommandErrored]"); await e.Channel.SendMessageEx( $"bundtbot is brokebot, something broke while processing someone's `{e.Command.Text}` command :("); }; commandService.CommandExecuted += (s, e) => { MyLogger.WriteLine("[CommandExecuted] " + e.Command.Text, ConsoleColor.DarkCyan); }; #endregion #region boring commands commandService.CreateCommand("credits") .Description("Prints who made this thing.") .Do(async e => { await e.Channel.SendMessageEx("!owsb <character name> <phrase>" + "\n!yt <youtube search string>" + "\ncreated by @AdenFlorian" + "\nhttps://github.com/AdenFlorian/DiscordSharp_Starter" + "\nhttps://trello.com/b/VKqUgzwV/bundtbot#"); }); commandService.CreateCommand("github") .Alias("git", "🐙 🐱", "🐙🐱") .Description("people tell me i need ot get help.") .Do(async e => { await e.Channel.SendMessageEx("https://github.com/AdenFlorian/DiscordSharp_Starter"); }); commandService.CreateCommand("changelog") .Alias("what's new") .Description("cha cha cha chaaangeeeessss.") .Parameter("number of commits to pull", ParameterType.Optional) .Do(async e => { var arg1 = e.GetArg("number of commits to pull"); if (arg1.IsNullOrWhiteSpace()) { arg1 = "5"; } var numOfCommitsToPull = int.Parse(arg1); if (numOfCommitsToPull > 42) { numOfCommitsToPull = 42; } if (numOfCommitsToPull < 1) { numOfCommitsToPull = 5; } // Get last 5 commit messages from the AdenFlorian/BundtBot github project var client = new GitHubClient(new ProductHeaderValue("AdenFlorian-BundtBot")); var commits = await client.Repository.Commit.GetAll("AdenFlorian", "BundtBot"); var fiveCommits = commits.Take(numOfCommitsToPull).ToList(); var msg = ""; fiveCommits.ForEach(x => msg += "🔹 " + x.Commit.Message + "\n"); var xx = numOfCommitsToPull.ToString().Select(x => x.ToString()).ToList(); var numberEmojiString = ""; xx.ForEach(num => numberEmojiString += ":" + int.Parse(num).ToVerbal() + ":"); await e.Channel.SendMessageEx( $"Last {numberEmojiString} commits from `AdenFlorian/BundtBot` on github:"); await e.Channel.SendMessageEx(msg); }); commandService.CreateCommand("cat") .Alias("kitty", "feline", "Felis_catus", "kitten", "🐱", "🐈") .Description("It's a secret.") .Do(async e => { var rand = new Random(); if (rand.NextDouble() >= 0.5) { try { var cat = await CatDog.Cat(); await e.Channel.SendMessageEx("I found a cat\n" + cat); } catch (Exception ex) { MyLogger.WriteException(ex); await e.Channel.SendMessageEx("there are no cats here, who let them out (random.cat is down :cat: :interrobang:)"); } } else { var dog = await CatDog.Dog(); await e.Channel.SendMessageEx("how about a dog instead" + dog); } }); commandService.CreateCommand("dog") .Alias("doggy", "puppy", "Canis_lupus_familiaris", "🐶", "🐕") .Description("The superior alternaitve to !cat.") .Do(async e => { try { var dog = await CatDog.Dog(); await e.Channel.SendMessageEx("i found a dog" + dog); } catch (Exception ex) { MyLogger.WriteException(ex); await e.Channel.SendMessageEx("there are no dogs here, who let them out (random.dog is down :dog: :interrobang:)"); } }); commandService.CreateCommand("admin") .Alias("administrator") .Description("Find out whose house you're in.") .Do(async e => { string msg; if (e.User.ServerPermissions.Administrator) { msg = "Yes, you are! ┌( ಠ‿ಠ)┘"; } else { msg = "No, you aren't (-_-。), but these people are!"; var admins = e.Server.Users.Where(x => x.ServerPermissions.Administrator).ToList(); admins.ForEach(x => msg += $" | {x.Name} | "); } await e.Channel.SendMessageEx(msg); }); commandService.CreateCommand("mod") .Alias("moderator") .Description("Find out if you are a mod.") .Do(async e => { if (e.User.Roles.Any(x => x.Name.Equals("mod"))) { await e.Channel.SendMessageEx("Yes, you are! ┌( ಠ‿ಠ)┘"); } else { await e.Channel.SendMessageEx("No, you aren't (-_-。)"); } }); commandService.CreateCommand("me") .Alias("mystatus") .Description("Find out you status in life.") .Do(async e => { await e.Channel.SendMessageEx("Voice channel: " + e.User.VoiceChannel?.Name); }); commandService.CreateCommand("invite") .Description("Why wasn't I invited?.") .Do(async e => { await e.Channel.SendMessageEx("Click this link to invite me to your server: " + Constants.InviteLink); }); commandService.CreateCommand("bot") .Description("Why wasn't I invited?.") .Do(async e => { Thread.Sleep(1000); var msg = await e.Channel.SendMessageEx("bundtbot"); Thread.Sleep(2000); await msg.Edit(msg.Text + " is"); Thread.Sleep(3000); var msg2 = await e.Channel.SendMessageEx(":back:"); Thread.Sleep(333); await msg2.Edit(msg2.Text + ":on:"); Thread.Sleep(333); await msg2.Edit(msg2.Text + ":on:" + ":top:"); }); #endregion #region DBCommands commandService.CreateCommand("users") .Do(async e => { await e.Channel.SendMessageEx($"I have {DB.Users.FindAll().Count()} users registered"); }); #endregion #region SoundBoard commandService.CreateCommand("stop") .Alias("shutup", "stfu", "👎", "🚫🎶", "🚫 🎶") .Description("Please don't stop the :notes:.") .Do(async e => { var msg = await e.Channel.SendMessageEx("okay..."); soundManager.Stop(); await msg.Edit(msg.Text + ":zipper_mouth:"); }); commandService.CreateCommand("next") .Alias("skip") .Description("Play the next Track.") .Do(async e => { if (soundManager.IsPlaying == false) { await e.Channel.SendMessageEx("there's nothing to skip"); return; } if (soundManager.HasThingsInQueue == false) { var msg = await e.Channel.SendMessageEx("end of line"); soundManager.Skip(); await msg.Edit(msg.Text + " :stop_button:"); } else { var msg = await e.Channel.SendMessageEx("standby..."); soundManager.Skip(); await msg.Edit(msg.Text + "Track has been terminated, and it's parents have been notified. The next track in line has taken its place. How do you sleep at night."); } }); commandService.CreateCommand("upnext") .Alias("whatsnext", "peek") .Description("look at next track") .Do(async e => { if (soundManager.IsPlaying == false) { await e.Channel.SendMessageEx("there's nothing up next, because nothing is even playing..."); return; } if (soundManager.HasThingsInQueue == false) { await e.Channel.SendMessageEx("nuthin"); } else { var nextSound = soundManager.PeekNext(); if (nextSound == null) { await e.Channel.SendMessageEx("i thought there was something up next, " + "but i may have been wrong, so, umm, sorry?"); } else { await e.Channel.SendMessageEx($"Up Next: **{nextSound.Track.Title}**"); } } }); commandService.CreateCommand("nowplaying") .Do(async e => { if (soundManager.IsPlaying == false) { await e.Channel.SendMessageEx("nothing"); return; } await e.Channel.SendMessageEx($"**{soundManager.CurrentlyPlayingTrackRequest.Track.Title}**"); }); commandService.CreateCommand("like") .Alias("thumbsup", "upvote", "👍") .Description("bundtbot for president 2020") .Do(async e => { // Find out what song is playing var currentSound = soundManager.CurrentlyPlayingTrackRequest; if (currentSound == null) { await e.Channel.SendMessageEx($"what's to like? nothing is playing..."); return; } var user = DB.Users.FindOne(x => x.SnowflakeId == e.User.Id); var track = DB.Tracks.FindById(currentSound.Track.Id); var likes = DB.Likes.Find(x => x.UserId == user.Id); if (likes.Any(x => x.TrackId == track.Id) == false) { DB.Likes.Insert(new Like { UserId = user.Id, TrackId = track.Id }); await e.Channel.SendMessageEx($"i like **{track.Title}** too 😎"); } else { await e.Channel.SendMessageEx($"i already know that you like **{track.Title}**"); } }); commandService.CreateCommand("mylikes") .Do(async e => { var user = DB.Users.FindOne(x => x.SnowflakeId == e.User.Id); var likes = DB.Likes .Find(x => x.UserId == user.Id); var msg = "**Your Likes:**\n"; likes.ToList().ForEach(x => msg += DB.Tracks.FindById(x.TrackId).Title + "\n"); await e.User.SendMessage(msg); }); commandService.CreateCommand("sb") .Alias("owsb") .Description("Sound board. It plays sounds with its mouth.") .Parameter("Sound args", ParameterType.Unparsed) .Do(async e => { // Command should have 3 words separated by spaces // 1. !owsb (or !sb) // 2. actor // 3. the Sound name (can be multiple words) // So, if we split by spaces, we should have at least 3 parts var actorAndSoundString = e.Args[0].ToLower(); List <string> args; try { // Filter out the arguments (words starting with '--') args = SoundBoard.ExtractArgs(ref actorAndSoundString); } catch (Exception ex) { await e.Channel.SendMessageEx($"you're doing it wrong ({ex.Message})"); return; } if (e.User.VoiceChannel == null) { await e.Channel.SendMessageEx(Constants.NotInVoice); return; } var actorAndSoundNames = SoundBoard.ParseActorAndSoundNames(actorAndSoundString); var actorName = actorAndSoundNames.Item1; var soundName = actorAndSoundNames.Item2; FileInfo soundFile; if (soundBoard.TryGetSoundPath(actorName, soundName, out soundFile) == false) { await e.Channel.SendMessageEx("these are not the sounds you're looking for..."); return; } var track = new Track { Path = soundFile.FullName, Title = $"{soundFile.Directory?.Name}: {soundFile.Name}" }; var sound = new Sound.TrackRequest(track, e.Channel, e.User.VoiceChannel, e.User); try { if (args.Count > 0) { SoundBoard.ParseArgs(args, ref sound); } } catch (Exception ex) { await e.Channel.SendMessageEx($"you're doing it wrong ({ex.Message})"); return; } soundManager.EnqueueSound(sound); }); commandService.CreateCommand("youtube") .Alias("yt", "ytr") .Description("It's a tube for you!") .Parameter("search string", ParameterType.Unparsed) .Do(async e => { var unparsedArgsString = e.Args[0]; if (unparsedArgsString.IsNullOrWhiteSpace()) { await e.Channel.SendMessageEx("http://i1.kym-cdn.com/photos/images/original/000/614/523/644.jpg" + "\ndo it liek dis `!yt This Is Gangsta Rap`"); return; } List <string> args; try { args = SoundBoard.ExtractArgs(ref unparsedArgsString); } catch (Exception ex) { await e.Channel.SendMessageEx($"you're doing it wrong ({ex.Message})"); return; } var ytSearchString = unparsedArgsString; var voiceChannel = e.User.VoiceChannel; if (voiceChannel == null) { await e.Channel.SendMessageEx(Constants.NotInVoice); return; } Track track; string youtubeVideoID; if (YoutubeHelper.IsYoutubeUrl(ytSearchString)) { youtubeVideoID = YoutubeHelper.GetVideoIdFromUrl(ytSearchString); } else { youtubeVideoID = await GetYoutubeVideoIdBySearchString(ytSearchString); } if (Track.TryGetTrackByYoutubeId(youtubeVideoID, out track)) { track.AddSearchString(ytSearchString); } if (track == null) { track = await DownloadTrackByYoutubeId(e, youtubeVideoID, _songCacheFolder); if (track == null) { return; } track.AddSearchString(ytSearchString); } else if (File.Exists(track.Path) == false) { await RedownloadTrack(e, track, _songCacheFolder); } var sound = new TrackRequest(track, e.Channel, voiceChannel, e.User) { DeleteAfterPlay = false }; try { // Defaulting youtube volume to 5 because they are long sound.Volume = 0.5f; if (args.Count > 0) { SoundBoard.ParseArgs(args, ref sound); } } catch (Exception ex) { await e.Channel.SendMessageEx($"you're doing it wrong ({ex.Message})"); return; } soundManager.EnqueueSound(sound); }); commandService.CreateCommand("youtube_haiku") .Alias("ythaiku", "ythk") .Description("It's snowing on mt fuji") .Parameter("search string", ParameterType.Unparsed) .Do(async e => { List <string> args; try { // Filter out the arguments (words starting with '--') args = SoundBoard.ExtractArgs(ref e.Args[0]); } catch (Exception ex) { await e.Channel.SendMessageEx($"you're doing it wrong ({ex.Message})"); return; } var voiceChannel = e.User.VoiceChannel; if (voiceChannel == null) { await e.Channel.SendMessageEx("you need to be in a voice channel to hear me roar"); return; } var haikuMsg = await e.Channel.SendMessageEx("☢HAIKU INCOMING☢"); var haikuUrl = await RedditManager.GetYoutubeHaikuUrlAsync(); await haikuMsg.Edit(haikuMsg.Text + $": {haikuUrl.AbsoluteUri}"); var youtubeOutput = await new YoutubeDownloader().YoutubeDownloadAndConvertAsync(e, haikuUrl.AbsoluteUri, _songCacheFolder); var msg = await e.Channel.SendMessageEx("Download finished! Converting audio..."); var outputWAVFile = await new FFMPEG.FFMPEG().FFMPEGConvertToWAVAsync(youtubeOutput); await msg.Edit(msg.Text + "finished!"); if (outputWAVFile.Exists == false) { await e.Channel.SendMessageEx("that haiku didn't work, sorry, try something else"); return; } var youtubeVideoTitle = await new YoutubeVideoName().Get(haikuUrl.AbsoluteUri); var track = new Track { Title = youtubeVideoTitle, Path = outputWAVFile.FullName }; var sound = new Sound.TrackRequest(track, e.Channel, voiceChannel, e.User) { DeleteAfterPlay = true }; try { // Defaulting haikus volume to 8 because they are short sound.Volume = 0.8f; if (args.Count > 0) { SoundBoard.ParseArgs(args, ref sound); } } catch (Exception ex) { await e.Channel.SendMessageEx($"you're doing it wrong ({ex.Message})"); return; } soundManager.EnqueueSound(sound); }); commandService.CreateCommand("volume") .Alias("vol", "🔉") .Description("turn down fer wut (1 to 10, 1 being down, 10 being fer wut).") .Parameter("desired volume") .Do(async e => { try { var desiredVolume = float.Parse(e.Args[0]) / 10f; soundManager.SetVolumeOverride(desiredVolume); await e.Channel.SendMessageEx($"global volume set to {desiredVolume * 10}"); } catch (Exception) { await e.Channel.SendMessageEx("wat did u doo to dah volumez"); throw; } }); commandService.CreateCommand("tempvolume") .Alias("tempvol", "voltemp", "🔉") .Description("turn down fer wut (1 to 10, 1 being down, 10 being fer wut).") .Parameter("desired volume") .Do(async e => { try { var desiredVolume = float.Parse(e.Args[0]) / 10f; soundManager.SetVolumeOfCurrentTrack(desiredVolume); await e.Channel.SendMessageEx("is dat betta?"); } catch (Exception) { await e.Channel.SendMessageEx("wat did u doo to dah volumez"); throw; } }); #endregion }
public void IsYoutubeUrl_Http_True() { var result = YoutubeHelper.IsYoutubeUrl("http://www.youtube.com/watch?v=VL3jSgR9ySE"); Assert.IsTrue(result); }
public void IsYoutubeUrl_Jibberish_False() { var result = YoutubeHelper.IsYoutubeUrl("jibberish"); Assert.IsFalse(result); }
public void IsYoutubeUrl_NotYoutube_False() { var result = YoutubeHelper.IsYoutubeUrl("https://www.utube.com/watch?v=VL3jSgR9ySE"); Assert.IsFalse(result); }
public void GetVideoIdFromUrl_BadUrl_Fail() { YoutubeHelper.GetVideoIdFromUrl("htts:/www.outue.com/wtchv=VL3jgR9yS"); }
public void GetVideoIdFromUrl_ShortId_Fail() { YoutubeHelper.GetVideoIdFromUrl("https://www.youtube.com/watch?v=VL3jSgR9yS"); }
static YoutubeController() { _latestVideosProcessed = YoutubeHelper.GetLatestVideoIds(50); }
public void IsYoutubeUrl_NoQuery_False() { var result = YoutubeHelper.IsYoutubeUrl("https://www.youtube.com/watch"); Assert.IsFalse(result); }
private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) { _Project.Videos = YoutubeHelper.GetVideos((string)e.Argument); }
protected void youtubeHotSpot_DataBound(object Sender, RepeaterItemEventArgs e) { Item item = e.Item.DataItem as Item; HotspotItem hotspot = new HotspotItem(item); YoutubeHelper youtubeHelper = new YoutubeHelper(); string iframe = String.Format("<iframe width=\"335\" height=\"188\" src=\"http://www.youtube.com/embed/{0}?wmode=transparent\" frameborder=\"0\" allowfullscreen></iframe>", youtubeHelper.YoutubeIDGet(hotspot.Videolink.Text)); Literal iframeLiteral = e.Item.FindControl("iframe") as Literal; iframeLiteral.Text = iframe; }