public void addVideoToPlaylist() { Console.Write("Enter playlist name: "); String playlistName = Console.ReadLine(); try { Playlist playlist = this.playlists[playlistName]; Console.Write("Enter video title: "); String videoTitle = Console.ReadLine(); try { YouTubeVideo video = this.videos[videoTitle]; playlist.addVideo(video); } catch (KeyNotFoundException) { Console.WriteLine("Video of given title does not exist!"); } } catch (KeyNotFoundException) { Console.WriteLine("Playlist of given name does not exist!"); } }
public void playVideo() { Console.Write("Enter video title: "); String videoTitle = Console.ReadLine(); try { YouTubeVideo video = this.videos[videoTitle]; this.playAlghoritm.play(video); } catch (KeyNotFoundException) { Console.WriteLine("This channel do not have video with given title!"); } }
public void createNewVideo() { Console.Write("Enter title: "); String title = Console.ReadLine(); Console.Write("Enter description: "); String description = Console.ReadLine(); String link = this.createNewLink(); Console.Write("Enter length: "); int length = Convert.ToInt32(Console.ReadLine()); YouTubeVideo newVideo = new YouTubeVideo(title, description, link, length); this.videos.Add(title, newVideo); Console.WriteLine("Channel " + this.name + " created video " + newVideo.Title + " ( " + newVideo.Length + " ) "); this.notifyObservers(new Notification(newVideo.Title, newVideo.Link, this.name)); }
public void addVideo(YouTubeVideo video) { this.videos.Add(video.Title, video); }