/// <summary> /// Get genre instances from combo box /// </summary> /// <returns>List of genres that are selected</returns> public GenreCollection GetSelectedGenres(out bool filterEnable) { // Get all genres GenreCollection allGenres = Organization.GetAllGenres(this.contentType); // Get selection string if (this.SelectedGenreFilter == null) { filterEnable = false; return(allGenres); } // Return all if selected if (this.SelectedGenreFilter.StartsWith("All")) { filterEnable = false; return(allGenres); } // Return single select genre as list GenreCollection genres = new GenreCollection(this.contentType); foreach (string genre in allGenres) { if (this.SelectedGenreFilter == genre) { genres.Add(genre); break; } } filterEnable = true; return(genres); }
public async Task <Mediafile> CreateMediafile(Stream stream) { var Mediafile = new Mediafile(); ID3v2 Data = new ID3v2(true, stream); Mediafile._id = LiteDB.ObjectId.NewObjectId(); Mediafile.Path = Path; Mediafile.Title = GetStringForNullOrEmptyProperty((await GetTextFrame(Data, "TIT2")), System.IO.Path.GetFileNameWithoutExtension(Path)); Mediafile.LeadArtist = GetStringForNullOrEmptyProperty(await GetTextFrame(Data, "TPE1"), "Unknown Artist"); Mediafile.Album = GetStringForNullOrEmptyProperty(await GetTextFrame(Data, "TALB"), "Unknown Album"); Mediafile.State = PlayerState.Stopped; Mediafile.Genre = (await GetTextFrame(Data, "TCON")).Remove(0, (await GetTextFrame(Data, "TCON")).IndexOf(')') + 1); Mediafile.Date = DateTime.Now.Date.ToString("dd/MM/yyyy"); if (Mediafile.Genre != null && Mediafile.Genre != "NaN") { Mediafile.Playlists.Add(new Playlist() { Name = "Hello" }); GenreCollection.Add(Mediafile.Genre); } if (Data.AttachedPictureFrames.Count > 0) { Mediafile.Playlists.Add(new Playlist() { Name = "Top Songs" }); //Mediafile.AttachedPicture = Data.AttachedPictureFrames[0].Picture; //SaveImages(Data); GC.Collect(); } return(Mediafile); }
/// <summary> /// Gallery/Genre/Subject/Reviews repeater nested within 'parentRptSingleWork_ItemDataBound' /// </summary> protected void parentRptSingleWork_ItemDataBound(Object Sender, RepeaterItemEventArgs e) { //Gallery Repeater: Child Repeater innerRptGallery = (Repeater)e.Item.FindControl("rptGallery"); GalleryCollection gl = new GalleryCollection(false); gl.FetchForId(ac[0].GalleryID); innerRptGallery.DataSource = gl; innerRptGallery.DataBind(); //Genre Repeater: Child Repeater innerRptGenre = (Repeater)e.Item.FindControl("rptGenre"); GenreCollection _gCol = new GenreCollection(false); _gCol.FetchByArtWorkID(artWorkId); innerRptGenre.DataSource = _gCol; innerRptGenre.DataBind(); //Second Genre Repeater (For Related Artworks in Accordian): Child Repeater innerRptRelatedArt = (Repeater)e.Item.FindControl("rptRelatedArt"); GenreCollection _gCol2 = new GenreCollection(false); _gCol2.FetchByArtWorkID(artWorkId); innerRptRelatedArt.DataSource = _gCol2; innerRptRelatedArt.DataBind(); //Subject Repeater: Child Repeater innerRptSubject = (Repeater)e.Item.FindControl("rptSubject"); SubjectCollection _sCol = new SubjectCollection(false); _sCol.FetchByArtWorkId(artWorkId); innerRptSubject.DataSource = _sCol; innerRptSubject.DataBind(); //Sales Repeater (Using date created---> Order/OrderDetails) Repeater innerRptOrders = (Repeater)e.Item.FindControl("rptSalesDateCreatedList"); OrdersCollection _ordCol = new OrdersCollection(); _ordCol.FetchByArtworkID(artWorkId); innerRptOrders.DataSource = _ordCol; innerRptOrders.DataBind(); //Getting the Reviews artReview.FetchReviewsByArtWorkId(artWorkId); if (!artReview.IsEmpty) { rptReview.DataSource = artReview; rptReview.DataBind(); } else { emptyReview.Text = "There is no review for this artwork "; } }
public Genre() { GenreCollection GenreCollection = new GenreCollection(); foreach (var genre in GenreCollection.GetGenreByFilmId(2)) { Console.WriteLine(genre.GenreName); } }
private void FillDropDown() { var genreCollection = new GenreCollection(); genreCollection.FilterGenre(""); foreach (var genre in genreCollection.Genres) { ddlGenre.Items.Add(new ListItem(genre.Description, genre.GenreCode)); } }
/// <summary> /// Set up Genre repeater, all genres, not top ten /// </summary> protected void SetGenreNav() { GenreCollection genres = new GenreCollection(true); if (genres.Count > 0) { genresTopTen.DataSource = genres; genresTopTen.DataBind(); } }
public void Dispose() { Database.Dispose(); TracksCollection.Clear(); RecentlyPlayedCollection.Clear(); ShellVM.PlaylistsItems.Clear(); OldItems = null; PlaylistCollection.Clear(); OptionItems.Clear(); GenreCollection.Clear(); }
public TVEpisodeMainPage(string html, URL request, URL response, MovieId id, GenreCollection genreCollection) : base(html, request, response, id, genreCollection) { AirDate = new ParsedInfo<DateTime>(html, parseDate); Episode = new ParsedInfo<int>(html, parseEpisode); Season = new ParsedInfo<int>(html, parseSeason); this.EpisodeTitle = new ParsedInfo<string>(html, parseEpisodeTitle); this.SeriesTitle = new ParsedInfo<string>(html, parseSeriesTitle); seriesID = parseSeries(html); }
public void Reset() { LibraryService.Dispose(); LibraryService = null; TracksCollection.Clear(); RecentlyPlayedCollection.Clear(); GenreFlyout?.Items.Clear(); PlaylistsItems?.Clear(); OldItems = null; PlaylistCollection.Clear(); OptionItems.Clear(); GenreCollection.Clear(); SongCount = -1; }
/// <summary> /// Grabs the Genre List repeater of artworks according to GenreId query string. /// </summary> private void SetUpRepeaterGenres(int genreID) { GenreCollection gc = null; if (genreID == -1) { gc = new GenreCollection(true); } else { gc = new GenreCollection(false); gc.FetchById(genreID); } rptGenres.DataSource = gc; rptGenres.DataBind(); }
public MainPage(string html, URL request, URL response, MovieId id, GenreCollection genreCollection) : base(html, request, response, id) { this.Title = new ParsedInfo<string>(html, parseTitle); this.Year = new ParsedInfo<int>(html, parseYear); this.PosterURL = new ParsedInfo<URL>(html, parsePosterURL); this.IMDbRating = new ParsedInfo<Rating>(html, parseIMDBRating); this.MetacriticRating = new ParsedInfo<Rating>(html, parseMetacriticRating); this.Tagline = new ParsedInfo<string>(html, parseTagline); this.Plot = new ParsedInfo<string>(html, parsePlot); this.Runtime = new ParsedInfo<TimeSpan>(html, parseRuntime); this.Genres = new ParsedInfo<GenreSet>(html, (input) => parseGenres(input, genreCollection)); }
IEnumerator WaitForGenres(WWW www) { yield return(www); if (www.error == null) { genreCollections = JsonUtility.FromJson <GenreCollection> (www.text); foreach (Genre g in genreCollections.genres) { Button b = Instantiate(buttonPrefab); Text title = b.GetComponentInChildren <Text> (); title.text = g.name; AddListener(b, g); b.transform.SetParent(genreCanvas.transform, false); } } }
private void FillDropDown() { ddlGenre.Items.Clear(); txtGenreDescription.Text = ""; var idGen = new IdGenerator(); var genreCollection = new GenreCollection(); genreCollection.FilterGenre(""); var newGenreCode = idGen.GenreId(); ddlGenre.Items.Add(new ListItem("...new Genre", newGenreCode)); foreach (var genre in genreCollection.Genres) { ddlGenre.Items.Add(new ListItem(genre.Description, genre.GenreCode)); } txtGenreCode.Text = ddlGenre.SelectedValue; }
/// <summary> /// Assembles a string with the movie genres. /// </summary> /// <returns>String with the comma-separated genre names.</returns> private string GetGenreCollectionString() { string ret = null; if (GenreCollection?.Count() > 0) { ret = string.Join(", ", GenreCollection.Select(x => x.Name)); } else if (GenreIdCollection?.Count() > 0 && Sing.GenreCollection?.Count() > 0) { var collection = Sing.GenreCollection .Where(x => GenreIdCollection.Any(y => y == x.Id)); ret = string.Join(", ", collection.Select(x => x.Name)); } return(ret); }
protected void HanlderSaveUpdateGenre(object sender, EventArgs e) { var genres = new GenreCollection(); var genre = genres.Genre; genre.GenreCode = txtGenreCode.Text; genre.Description = txtGenreDescription.Text; if (ddlGenre.SelectedIndex == 0) { if (txtGenreDescription.Text.Trim() != "") { genres.Add(); FillDropDown(); } } else { genres.Update(); FillDropDown(); } }
/// <summary> /// Updates contents from Organization based on selected folder. /// </summary> public void UpdateContent() { // Save current selection from listview Content currentSel = this.SelectedContent; // Get selected folder ContentRootFolder folderName = this.SelectedFolder; // Get root folders bool recursive; List <ContentRootFolder> selRootFolders = GetFilteredRootFolders(out recursive); bool genreFilterEnable; GenreCollection genreFilter = GetSelectedGenres(out genreFilterEnable); // Set contents for listview List <Content> contents = Organization.GetContentFromRootFolders(selRootFolders, recursive, genreFilterEnable, genreFilter, this.YearFilterEnable, this.YearFilterStart, this.YearFilterStop, this.NameFilter); Contents.Clear(); foreach (Content content in contents) { this.Contents.Add(content); } }
/// <summary> /// Builds a list of content matching filter that is contained within a root folder /// </summary> /// <param name="genre">Filter for genre type - use "All" to disable filter</param> /// <param name="contents">List to add content to</param> /// <param name="yearFilter">Enables year filtering</param> /// <param name="minYear">Minimum for year filter</param> /// <param name="maxYear">Maximum for year filter</param> /// <param name="nameFilter">String that must be contained in content name - empty string disables filter</param> public void GetContent(bool recursive, bool genreEnable, GenreCollection genre, List<Content> contents, bool yearFilter, int minYear, int maxYear, string nameFilter) { // Go through all movies ContentCollection contentCollection = GetContentCollection(); lock (contentCollection.ContentLock) { //Console.WriteLine(contentCollection.ToString() + " lock get"); foreach (Content content in contentCollection) { // Apply genre filter bool genreMatch = false; if (content.DatabaseGenres != null && !genreMatch) foreach (string contentGenre in content.DatabaseGenres) if (genre.Contains(contentGenre)) { genreMatch = true; break; } // Apply year filter bool yearMatch = !yearFilter || (content.DatabaseYear >= minYear && content.DatabaseYear <= maxYear); // Apply text filter bool nameMatch = string.IsNullOrEmpty(nameFilter) || content.DatabaseName.ToLower().Contains(nameFilter.ToLower()); // Check if movie is in the folder if (ContainsContent(content, recursive) && ApplyContentFilter(content, genreEnable, genre, yearFilter, minYear, maxYear, nameFilter)) contents.Add(content); } } //Console.WriteLine(contentCollection.ToString() + " release get"); }
public GenreSet ReadIMDbGenres(GenreCollection collection) { return ReadGenreSet(FrameIdentifier.IMDbGenresIdentifier, collection); }
public GenreSet ReadGenreSet(FrameIdentifier identifier, GenreCollection collection) { if (!SeekToFrame(identifier)) throw new ArgumentException(identifier.Value + " Frame not found."); GenreSet g = new GenreSet(identifier.Value.Substring(1), collection); int c = fs.Frames[identifier].DataLength; for (int i = 0; i < c; i++) g.Add(collection.GetGenre(input.ReadByte())); return g; }
public MovieMainPage(string html, URL request, URL response, MovieId id, GenreCollection genreCollection) : base(html, request, response, id, genreCollection) { }
/// <summary> /// Get genre instances from combo box /// </summary> /// <returns>List of genres that are selected</returns> public GenreCollection GetSelectedGenres(out bool filterEnable) { // Get all genres GenreCollection allGenres = Organization.GetAllGenres(this.contentType); // Get selection string if (this.SelectedGenreFilter == null) { filterEnable = false; return allGenres; } // Return all if selected if (this.SelectedGenreFilter.StartsWith("All")) { filterEnable = false; return allGenres; } // Return single select genre as list GenreCollection genres = new GenreCollection(this.contentType); foreach (string genre in allGenres) if (this.SelectedGenreFilter == genre) { genres.Add(genre); break; } filterEnable = true; return genres; }
public void setSongList(MediaLibrary library) { genreCollection = library.Genres; }
/// <summary> /// Gets the list of content matching a set of filters that are contained within root folder(s) /// </summary> /// <param name="folders">Root folders to look for content</param> /// <param name="genreFilter">Filter for genre type of movie - use "All" to disable filter</param> /// <param name="yearFilter">Enables year filtering</param> /// <param name="minYear">Minimum for year filter</param> /// <param name="maxYear">Maximum for year filter</param> /// <param name="nameFilter">String that must be contained in movie name - empty string disables filter</param> /// <returns>List of movies from root folder that match filters</returns> public static List<Content> GetContentFromRootFolders(List<ContentRootFolder> folders, bool recursive, bool genreEnable, GenreCollection genreFilter, bool yearFilter, int minYear, int maxYear, string nameFilter) { // Initialize movies list List<Content> folderMovies = new List<Content>(); // Go through each content folder and get movie from folders that match name foreach (ContentRootFolder folder in folders) folder.GetContent(recursive, genreEnable, genreFilter, folderMovies, yearFilter, minYear, maxYear, nameFilter); // Returns list of movies return folderMovies; }
private GenreSet parseGenres(string input, GenreCollection collection) { List<Genre> genres = new List<Genre>(); input = input.CutToFirst("<h4 class=\"inline\">Genres:</h4>", CutDirection.Left, true); input = input.CutToFirst("</div>", CutDirection.Right, true); while (input.Contains("<a")) { Genre g = collection.GetGenre(decodeHTML(input.CutToTag("a", true).ToString())); if (g != null) genres.Add(g); input = input.CutToFirst("</a>", CutDirection.Left, false, 1); } return new GenreSet("IMDb", collection, genres); }
/// <summary> /// Puts a single content item through filtering /// </summary> /// <param name="content">Content to filter</param> /// <param name="genre">Genre content must belong to</param> /// <param name="yearFilter">Enable for year filter</param> /// <param name="minYear">Minimum for year filter</param> /// <param name="maxYear">Maximum for year filter</param> /// <param name="nameFilter">String that must be contained in content name - empty string disables filter</param> /// <returns></returns> public bool ApplyContentFilter(Content content, bool genreEnable, GenreCollection genre, bool yearFilter, int minYear, int maxYear, string nameFilter) { // Apply genre filter bool genreMatch = !genreEnable; if (content.DatabaseGenres != null && !genreMatch) foreach (string contentGenre in content.DatabaseGenres) if (genre.Contains(contentGenre)) { genreMatch = true; break; } // Apply year filter bool yearMatch = !yearFilter || (content.DatabaseYear >= minYear && content.DatabaseYear <= maxYear); // Apply text filter bool nameMatch = string.IsNullOrEmpty(nameFilter) || content.DatabaseName.ToLower().Contains(nameFilter.ToLower()); bool test = genreMatch && yearMatch && nameMatch; if (!test) test = true; // Check if movie is in the folder return genreMatch && yearMatch && nameMatch; }
/// <summary> /// Update Genres in combo box based on what genres are actually in the content displayed /// </summary> private void UpdateGenresComboBox() { // Save current selection string selGenre = this.SelectedGenreFilter; // Get selected folder ContentRootFolder selFolder = this.SelectedFolder; if (selFolder == null) { return; } // Add all available genres GenreCollection genres = null; switch (this.contentType) { case ContentType.Movie: if (selFolder.FullPath == "All") { genres = Organization.AllMovieGenres; } else { genres = selFolder.GetGenres(); } break; case ContentType.TvShow: if (selFolder.FullPath == "All") { genres = Organization.AllTvGenres; } else { genres = selFolder.GetGenres(); } break; default: throw new Exception("Unknown content type"); } // Check if genres haves changes bool changed = genres.Count != this.GenreFilters.Count; if (!changed) { foreach (string genre in genres) { if (!this.GenreFilters.Contains(genre)) { changed = true; break; } } } // Add genres to combo box if (changed) { this.GenreFilters.Clear(); this.GenreFilters.Add("All Genres"); lock (genres.AccessLock) foreach (string genre in genres) { this.GenreFilters.Add(genre); } // Set default selection if needed if (!string.IsNullOrEmpty(selGenre) && this.GenreFilters.Contains(selGenre)) { this.SelectedGenreFilter = selGenre; } else { this.SelectedGenreFilter = this.GenreFilters[0]; } } }
public TVSeriesMainPage(string html, URL request, URL response, MovieId id, GenreCollection genreCollection) : base(html, request, response, id, genreCollection) { LastYear = new ParsedInfo<int>(html, parseYear); }
/// <summary> /// Get available genres from content /// </summary> /// <param name="contents"></param> /// <returns></returns> public GenreCollection GetGenres() { GenreCollection genres = new GenreCollection(this.ContentType); switch (this.ContentType) { case ContentType.Movie: for(int i=0;i<Organization.Movies.Count;i++) foreach (string genre in Organization.Movies[i].DatabaseGenres) if (!genres.Contains(genre)) genres.Add(genre); break; case ContentType.TvShow: for (int i = 0; i < Organization.Shows.Count; i++) foreach (string genre in Organization.Shows[i].DatabaseGenres) if (!genres.Contains(genre)) genres.Add(genre); break; } return genres; }