public LocalSong(MusicProperties musicProps) { Title = CleanText(musicProps.Title); AlbumName = CleanText(musicProps.Album); AlbumArtist = CleanText(musicProps.AlbumArtist); ArtistName = CleanText(musicProps.Artist); BitRate = (int)musicProps.Bitrate; Duration = musicProps.Duration; Genre = musicProps.Genre.FirstOrDefault(); TrackNumber = (int)musicProps.TrackNumber; if (!string.IsNullOrEmpty(ArtistName) || !string.IsNullOrEmpty(AlbumArtist)) { ArtistId = Convert.ToBase64String(Encoding.UTF8.GetBytes((AlbumArtist ?? ArtistName).ToLower())); } if (!string.IsNullOrEmpty(AlbumName)) { AlbumId = Convert.ToBase64String(Encoding.UTF8.GetBytes(AlbumName.ToLower())); } if (!string.IsNullOrEmpty(Title)) { Id = Convert.ToBase64String(Encoding.UTF8.GetBytes(Title.ToLower())) + ArtistId + AlbumId; } if (musicProps.Rating > 1) { HeartState = HeartState.Like; } }
public virtual IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { // model-level validation if (SongName == "blah" && AlbumName == "meh") { yield return(new ValidationResult("Combined song name and album name cannot be blah and meh")); yield return(new ValidationResult("*", new[] { "SongName", "AlbumName" })); } else { // model-level validation if (SongName[0] != AlbumName[0]) { yield return(new ValidationResult("Song name and album name must start with same letter")); yield return(new ValidationResult("*", new[] { "AlbumName", "SongName" })); } // inline style if (!SongName.ToUpper().Contains("LOVE")) { yield return(new ValidationResult("Song name must have a word love", new[] { "SongName" })); } // property, but asterisk style if (!AlbumName.ToUpper().Contains("GREAT")) { yield return(new ValidationResult("Album name must have a word great")); yield return(new ValidationResult("*", new[] { "AlbumName" })); } } }
public LocalSong(string title, string artist, string album, string albumArtist, string radioId, string cloudid) { Title = CleanText(title); ArtistName = CleanText(artist); AlbumName = CleanText(album); AlbumArtist = CleanText(albumArtist); if (!string.IsNullOrEmpty(radioId)) { RadioId = int.Parse(radioId); } if (!string.IsNullOrEmpty(cloudid)) { CloudId = cloudid; } if (!string.IsNullOrEmpty(ArtistName) || !string.IsNullOrEmpty(AlbumArtist)) { ArtistId = Convert.ToBase64String(Encoding.UTF8.GetBytes((AlbumArtist ?? ArtistName).ToLower())); } if (!string.IsNullOrEmpty(AlbumName)) { AlbumId = Convert.ToBase64String(Encoding.UTF8.GetBytes(AlbumName.ToLower())); } if (!string.IsNullOrEmpty(Title)) { Id = Convert.ToBase64String(Encoding.UTF8.GetBytes(Title.ToLower())) + ArtistId + AlbumId; } }
private void OnChooseAlbumDirectory() { var directory = _dialogsService.ChooseDirectory("Choose a directory in which to set the album name"); if (directory == null) { return; } Directory.EnumerateFiles(directory, $"*{MP3AudioSplitter.Mp3Extension}", SearchOption.AllDirectories).ForEach(mp3File => { var tagLibFile = TagLib.File.Create(mp3File); tagLibFile.Tag.Album = AlbumName.IsNotNullOrEmpty() ? AlbumName : new FileInfo(mp3File).Directory.Name; tagLibFile.Save(); }); ShowInfoBox(InfoBoxType.Success, $"Successfully set album {(AlbumName.IsNotNullOrEmpty() ? $"({AlbumName}) " : "")}to files within the given directory!"); }
public void DisplayAlbum(Album album, bool actionMode, string genreText) { // Save the default colour if not already done so if (albumNameColour == Color.Fuchsia) { albumNameColour = new Color(AlbumName.CurrentTextColor); } AlbumName.Text = album.Name; AlbumName.SetTextColor((album.Played == true) ? Color.Black : albumNameColour); ArtistName.Text = (album.ArtistName.Length > 0) ? album.ArtistName : "Unknown"; Year.Text = (album.Year > 0) ? album.Year.ToString() : " "; // Display the genres. Replace any spaces in the genres with non-breaking space characters. This prevents a long genres string with a // space near the start being broken at the start, It just looks funny. Genre.Text = genreText.Replace(' ', '\u00a0'); }
public override int GetHashCode() { int hash = 1; if (AlbumName.Length != 0) { hash ^= AlbumName.GetHashCode(); } if (Label.Length != 0) { hash ^= Label.GetHashCode(); } if (Year.Length != 0) { hash ^= Year.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public void DisplayAlbum(ArtistAlbum artistAlbum, bool actionMode) { // Save the default colour if not already done so if (albumNameColour == Color.Fuchsia) { albumNameColour = new Color(AlbumName.CurrentTextColor); } AlbumName.Text = artistAlbum.Name; AlbumName.SetTextColor((artistAlbum.Album.Played == true) ? Color.Black : albumNameColour); // A very nasty workaround here. If action mode is in effect then remove the AlignParentLeft from the album name. // When the Checkbox is being shown then the album name can be positioned between the checkbox and the album year, // but when there is no checkbox this does not work and the name has to be aligned with the parent. // This seems to be too complicated for static layout ((RelativeLayout.LayoutParams)AlbumName.LayoutParameters).AddRule(LayoutRules.AlignParentLeft, (actionMode == true) ? 0 : 1); // Set the year text Year.Text = (artistAlbum.Album.Year > 0) ? artistAlbum.Album.Year.ToString() : " "; // Display the genres. Replace any spaces in the genres with non-breaking space characters. This prevents a long genres string with a // space near the start being broken at the start, It just looks funny. Genre.Text = artistAlbum.Album.Genre.Replace(' ', '\u00a0'); }
public override int GetHashCode() { return(AlbumName.GetHashCode()); }