public Dictionary <string, string> MetaManual(object obj) { List <string> TagList = new List <string>(); if (obj.GetType() == typeof(Media)) { Media m = (Media)obj; Dictionary <string, string> meta = new Dictionary <string, string>(); meta.Add("File name", m.GetFileName()); meta.Add("Format", ""); meta.Add("Duration HH:MM:SS", ""); if (m.GetType() == typeof(Song)) { Song s = (Song)m; SongMetadata sm = (SongMetadata)s.GetMetadata(); meta.Add("Name", sm.GetName()); meta.Add("Artist", sm.GetArtist()); meta.Add("Album", sm.GetAlbum()); meta.Add("Genre", sm.GetGenre()); meta.Add("Release Year", sm.GetPublicationYear().ToString()); meta.Add("Label", sm.GetLabel()); meta.Add("Lyrics", sm.GetLyrics());; } else if (m.GetType() == typeof(Video)) { VideoMetadata vm = (VideoMetadata)((Video)m).GetMetadata(); meta.Add("Name", vm.GetName()); meta.Add("Creator", vm.GetCreator()); meta.Add("Genre", vm.GetGenre());; meta.Add("Category", vm.GetCategory()); string actors = ""; foreach (string item in vm.GetActors()) { actors += item; actors += ", "; } actors = actors.Substring(0, actors.Length - 2); actors += "."; meta.Add("Actors", actors); meta.Add("Director", vm.GetDirector()); meta.Add("Studio", vm.GetStudio()); meta.Add("Release Year", vm.GetPubYear().ToString()); meta.Add("Description", vm.GetDescription()); meta.Add("Resolution", vm.GetResolution()); meta.Add("Aspect Ratio", vm.GetAspectRatio()); } return(meta); } return(null); }
public void AddMedia(Media media) { if (PList.Count == 0) { PList.Add(media); } else if (PList.Count != 0 && media.GetType() == PList[0].GetType()) { PList.Add(media); } }
public void LikeMedia(Media media) { if (Likes.Contains(media)) { media.AddLike(false); Likes.Remove(media); if (media.GetType() == typeof(Song)) { Song s = (Song)media; FavoriteMusic.Remove(s); } else if (media.GetType() == typeof(Video)) { Video v = (Video)media; FavoriteVideos.Remove(v); } } else { media.AddLike(true); Likes.Add(media); if (media.GetType() == typeof(Song)) { Song s = (Song)media; FavoriteMusic.Add(s); } else if (media.GetType() == typeof(Video)) { Video v = (Video)media; FavoriteVideos.Add(v); } } HashSet <Song> songs = new HashSet <Song>(FavoriteMusic); FavoriteMusic = songs.ToList(); HashSet <Video> videos = new HashSet <Video>(FavoriteVideos); FavoriteVideos = videos.ToList(); }
public static void Main(string[] args) { Console.CursorVisible = false; RegexUtilities.LoadingScreen(); Thread.Sleep(3000); List<string> start = new List<string>() { "Hello, and welcome to Spotflix!", "Log In" , "Register" ,"Admin Log In", "Exit"}; List<string> mainMenu = new List<string>() { "Menu", "Search", "Profile", "play", "Log out" }; List<string> searchMenu = new List<string>() {"Search: ", "Filters", "Go!", "Back" }; Console.Clear(); while (true) { RegexUtilities.LoadingScreen(); string selectedMenuItem = RegexUtilities.GetMenu(start); if (selectedMenuItem == "Log In") { Console.Clear(); RegexUtilities.LoadingScreen(); string username = Spotflix.LogIn(); if (username != "") { User activeUser = Spotflix.GetUserDB[username]; while (true) { Console.Clear(); RegexUtilities.LoadingScreen(); selectedMenuItem = RegexUtilities.GetMenu(mainMenu); if (selectedMenuItem == "Log out") { username = ""; break; } else if (selectedMenuItem == "Search") { while (true) { Console.Clear(); RegexUtilities.LoadingScreen(); selectedMenuItem = RegexUtilities.GetMenu(searchMenu); string searchKey = ""; if (selectedMenuItem == searchMenu[0]) { Console.Clear(); RegexUtilities.LoadingScreen(); searchMenu[0] = searchMenu[0].Substring(0, 8); searchKey = RegexUtilities.WriteData(searchMenu[0]); searchMenu[0] += searchKey; Console.Clear(); } else if (selectedMenuItem == searchMenu[2]) { Filter fil = new Filter(); List<Media> results = fil.Search(searchKey); if (results.Count > 0) { List<string> lsSe = new List<string>(); foreach (Media media in results) { lsSe.Add(media.GetMetadata().GetName()); } lsSe.Add("Back"); while (true) { string selectMedia = RegexUtilities.GetMenu(lsSe); if (selectMedia != "" && selectMedia != "Back") { int ind = lsSe.IndexOf(selectMedia); Media media = results[ind]; if (media.GetType() == typeof(Song)) { //display info media.Play(); } } else if (selectMedia == "Back") { break; } } } } else if (selectedMenuItem == searchMenu[3]) { Console.Clear(); break; } } } else if (selectedMenuItem == "play") { //SoundPlayer player = new SoundPlayer(); //player.SoundLocation = "CSI.wav"; //player.Play(); //Player player = new Player(); //player.Open("CSI.wav"); //Thread.Sleep(30000); //player.End(); } } } } else if (selectedMenuItem == "Register") { Console.Clear(); RegexUtilities.LoadingScreen(); Spotflix.Register(); Save(Spotflix.GetUserDB , Spotflix.GetMediaDB, Spotflix.GetPeopleDB, fileName); } else if (selectedMenuItem == "Admin Log In") { Console.Clear(); RegexUtilities.LoadingScreen(); string adm = Spotflix.AdminLogIn(); if (adm != "") { User administrator = Spotflix.GetUserDB[adm]; List<string> admMenu = new List<string>() { "Add Media", "a", "b", "c", "Log out" }; while (true) { Console.Clear(); selectedMenuItem = RegexUtilities.GetMenu(admMenu); if (selectedMenuItem == "Add Media") { Console.Clear(); RegexUtilities.LoadingScreen(); administrator.AddMedia(); Save(Spotflix.GetUserDB, Spotflix.GetMediaDB, Spotflix.GetPeopleDB, fileName); Console.WriteLine("Ready"); Thread.Sleep(1000); Console.Clear(); } else if (selectedMenuItem == "Log out") { adm = ""; break; } else if (selectedMenuItem == "a") { } Save(Spotflix.GetUserDB, Spotflix.GetMediaDB, Spotflix.GetPeopleDB, fileName); } } else { Console.Clear(); RegexUtilities.LoadingScreen(); Console.WriteLine("You are not an administrator."); break; } Save(Spotflix.GetUserDB, Spotflix.GetMediaDB, Spotflix.GetPeopleDB, fileName); } else if (selectedMenuItem == "Exit") { Save(Spotflix.GetUserDB, Spotflix.GetMediaDB, Spotflix.GetPeopleDB, fileName); Environment.Exit(0); } Console.Clear(); }
public static void Main(string[] args) { Console.CursorVisible = false; RegexUtilities.LoadingScreen(); Thread.Sleep(3000); List <string> start = new List <string>() { "Hello, and welcome to Spotflix!", "Log In", "Register", "Admin Log In", "Exit" }; List <string> mainMenu = new List <string>() { "Menu", "Search", "Profile", "play", "Log out" }; List <string> searchMenu = new List <string>() { "Search: ", "Filters", "Go!", "Back" }; Console.Clear(); while (true) { RegexUtilities.LoadingScreen(); string selectedMenuItem = RegexUtilities.GetMenu(start); if (selectedMenuItem == "Log In") { Console.Clear(); RegexUtilities.LoadingScreen(); string username = Spotflix.LogIn(); if (username != "") { User activeUser = Spotflix.GetUserDB[username]; while (true) { Console.Clear(); RegexUtilities.LoadingScreen(); selectedMenuItem = RegexUtilities.GetMenu(mainMenu); if (selectedMenuItem == "Log out") { username = ""; break; } else if (selectedMenuItem == "Search") { while (true) { Console.Clear(); RegexUtilities.LoadingScreen(); selectedMenuItem = RegexUtilities.GetMenu(searchMenu); string searchKey = ""; if (selectedMenuItem == searchMenu[0]) { Console.Clear(); RegexUtilities.LoadingScreen(); searchMenu[0] = searchMenu[0].Substring(0, 8); searchKey = RegexUtilities.WriteData(searchMenu[0]); searchMenu[0] += searchKey; Console.Clear(); } else if (selectedMenuItem == searchMenu[2]) { Filter fil = new Filter(); List <Media> results = fil.Search(searchKey); if (results.Count > 0) { List <string> lsSe = new List <string>(); foreach (Media media in results) { lsSe.Add(media.GetMetadata().GetName()); } lsSe.Add("Back"); while (true) { string selectMedia = RegexUtilities.GetMenu(lsSe); if (selectMedia != "" && selectMedia != "Back") { int ind = lsSe.IndexOf(selectMedia); Media media = results[ind]; if (media.GetType() == typeof(Song)) { //display info media.Play(); } } else if (selectMedia == "Back") { break; } } } } else if (selectedMenuItem == searchMenu[3]) { Console.Clear(); break; } } } else if (selectedMenuItem == "play") { //SoundPlayer player = new SoundPlayer(); //player.SoundLocation = "CSI.wav"; //player.Play(); //Player player = new Player(); //player.Open("CSI.wav"); //Thread.Sleep(30000); //player.End(); } } } } else if (selectedMenuItem == "Register") { Console.Clear(); RegexUtilities.LoadingScreen(); Spotflix.Register(); Save(Spotflix.GetUserDB, Spotflix.GetMediaDB, Spotflix.GetPeopleDB, fileName); } else if (selectedMenuItem == "Admin Log In") { Console.Clear(); RegexUtilities.LoadingScreen(); string adm = Spotflix.AdminLogIn(); if (adm != "") { User administrator = Spotflix.GetUserDB[adm]; List <string> admMenu = new List <string>() { "Add Media", "a", "b", "c", "Log out" }; while (true) { Console.Clear(); selectedMenuItem = RegexUtilities.GetMenu(admMenu); if (selectedMenuItem == "Add Media") { Console.Clear(); RegexUtilities.LoadingScreen(); administrator.AddMedia(); Save(Spotflix.GetUserDB, Spotflix.GetMediaDB, Spotflix.GetPeopleDB, fileName); Console.WriteLine("Ready"); Thread.Sleep(1000); Console.Clear(); } else if (selectedMenuItem == "Log out") { adm = ""; break; } else if (selectedMenuItem == "a") { } Save(Spotflix.GetUserDB, Spotflix.GetMediaDB, Spotflix.GetPeopleDB, fileName); } } else { Console.Clear(); RegexUtilities.LoadingScreen(); Console.WriteLine("You are not an administrator."); break; } Save(Spotflix.GetUserDB, Spotflix.GetMediaDB, Spotflix.GetPeopleDB, fileName); } else if (selectedMenuItem == "Exit") { Save(Spotflix.GetUserDB, Spotflix.GetMediaDB, Spotflix.GetPeopleDB, fileName); Environment.Exit(0); } Console.Clear(); } /* * * string ans = Console.ReadLine(); * * if (ans == "new") * { * Spotflix.Register(); * } * * else if (ans == "returning") * { * Console.WriteLine("Please write your username and password"); * Console.WriteLine("Username: "******"Password: "******"What do you want to do?"); * Console.WriteLine("a) Search for music or videos"); * Console.WriteLine("b) Go to playlists"); * Console.WriteLine("c) Look for other profiles"); * Console.WriteLine(""); * Console.WriteLine("d) Exit"); * * string Ans = Console.ReadLine(); * * if (Ans == "a") * { * Console.WriteLine("Please write the name of the song or video that you are looking for"); * string search = Console.ReadLine(); * * Console.WriteLine("Do you wish to apply any filters? y/n"); * string a = Console.ReadLine(); * * if (a == "y") * { * Console.WriteLine("Please choose one or more of the following filters:"); * Console.WriteLine("For songs:"); * Console.WriteLine("1) Name"); * Console.WriteLine("2) Artist"); * Console.WriteLine("3) Album"); * Console.WriteLine("4) Genre"); * Console.WriteLine(""); * Console.WriteLine("For videos:"); * Console.WriteLine("5) Name"); * Console.WriteLine("6) Creator"); * Console.WriteLine("7) Genre"); * Console.WriteLine("8) Category"); * Console.WriteLine("9) Director"); * Console.WriteLine("10) Studio"); * * Console.WriteLine("Please type the numbers next to the desired filters"); * List<int> FilterList = new List<int>(); * * string b1 = "y"; * * while (b1 == "y") * { * Console.WriteLine("Filter:"); * * int f1 = Convert.ToInt32(Console.ReadLine()); * FilterList.Add(f1); * * Console.WriteLine("Do you wish to add another filter? y/n"); * b1 = Console.ReadLine(); * * if (FilterList.Count >= 9) //Security measure, so that nobody can write filters forever. * { * b1 = "n"; * } * } * * Filter f2 = new Filter(); * * foreach(object o in f2.FilteredSearch(FilterList, a)) * { * Console.WriteLine(o); * } * } * * * else if (a == "n") * { * Filter f2 = new Filter(); * * foreach(object o in f2.Search(a)) * { * Console.WriteLine(o); * } * } * * * Console.WriteLine("What do you want to search for?"); * string a1 = Console.ReadLine(); * * Filter f = new Filter(); * List<object> filtered = f.Search(a1); * * foreach (object o in filtered) * { * Console.WriteLine(o); * } * } * * * else if (Ans == "B" || Ans == "b") * { * User u = Spotflix.GetUserDB[userN]; * Console.WriteLine("Do you wish to:"); * Console.WriteLine("A) Access your existing playlists?"); * Console.WriteLine("B) Create a new one?"); * string a1 = Console.ReadLine(); * * if (a1 == "A" || a1 == "a") * { * foreach(Playlist p in u.GetPlaylist()) * { * Console.WriteLine(p); * } * * } * * else if(a1 == "B" || a1 == "b") * { * u.NewPlaylist(); * } * * else * { * Console.WriteLine("Invalid answer"); * } * * } * * else if (Ans == "C" || Ans == "c") * { * Console.WriteLine("Please state the name of the user you are looking for"); * string userSearch = Console.ReadLine(); * User u2 = Spotflix.GetUserDB[userSearch]; * * try * { * u2 = Spotflix.GetUserDB[userSearch]; * * } * * catch(Exception e) * { * Console.WriteLine("User not found"); * Console.WriteLine(e.Message); * } * * Console.WriteLine("Here's the public info in the account"); * Console.WriteLine(" "); * * Console.WriteLine("Account name: "); * Console.Write(u2.GetUsername()); * Console.WriteLine(" "); * * Console.WriteLine("List of playlists: "); * Console.Write(u2.GetPlaylist()); * Console.WriteLine(" "); * * Console.WriteLine("List of people who follow this account: "); * Console.Write(u2.GetFollowers()); * Console.WriteLine(" "); * * Console.WriteLine("List of people that this account follows: "); * Console.WriteLine(u2.GetFollowing()); * Console.WriteLine(" "); * } * * else * { * Console.WriteLine("Invalid Answer"); * } * * } * * * else * { * Console.WriteLine("Wrong password"); * } * } * * * else * { * Console.WriteLine("User not found"); * } * * } * */ }