/// <summary> /// Add tag to Genre DB /// </summary> /// <param name="enabled"></param> /// <param name="genre"></param> public static void Add(bool enabled, string genre) { DBGenres r1 = new DBGenres(); r1.Enabled = enabled; r1.Genre = genre; r1.Commit(); }
/// <summary> /// Give total running time for supplied tracklist /// </summary> /// <param name="property"></param> /// <param name="value"></param> private string genreRunningTime(DBGenres genreObject) { List<DBArtistInfo> artistList = new List<DBArtistInfo>(); List<DBArtistInfo> artistFullList = DBArtistInfo.GetAll(); try { TimeSpan tt = TimeSpan.Parse("00:00:00"); foreach (DBArtistInfo artistInfo in artistFullList) { if (tagMatched(facadeLayout.SelectedListItem.Label, artistInfo) || artistInfo.Genre.Equals(facadeLayout.SelectedListItem.Label,StringComparison.OrdinalIgnoreCase)) { if (!artistList.Contains(artistInfo)) artistList.Add(artistInfo); } } _genreTracks = 0; foreach (DBArtistInfo artist in artistList) { List<DBTrackInfo> artistTracks = DBTrackInfo.GetEntriesByArtist(artist); foreach (DBTrackInfo track in artistTracks) { _genreTracks++; try { tt += TimeSpan.Parse(track.PlayTime); } catch { } } } DateTime dt = new DateTime(tt.Ticks); string cTime = String.Format("{0:HH:mm:ss}", dt); if (cTime.StartsWith("00:")) return cTime.Substring(3); else return cTime; } catch { return "00:00:00"; } }