Exemplo n.º 1
0
        public virtual ArtistForSong AddArtist(string name, bool isSupport, ArtistRoles roles)
        {
            ParamIs.NotNullOrEmpty(() => name);

            var link = new ArtistForSong(this, name, isSupport, roles);

            AllArtists.Add(link);

            return(link);
        }
Exemplo n.º 2
0
        public virtual ArtistForUser AddArtist(Artist artist)
        {
            ParamIs.NotNull(() => artist);

            var link = new ArtistForUser(this, artist);

            AllArtists.Add(link);

            return(link);
        }
        private async Task LoadArtistsAndGenres()
        {
            var allArtistsReturned = await _artistService.Get <List <Model.Artist> >(null);

            var allGenres = await _genreService.Get <List <Model.Genre> >(null);

            var allArtistGenre = await _artistGenreService.Get <List <Model.ArtistGenre> >(null);

            foreach (var item in allArtistsReturned)
            {
                var    genres    = allArtistGenre.Where(a => a.ArtistId == item.ArtistId).ToList();
                string genresStr = "Genres: ";
                foreach (var x in genres)
                {
                    genresStr += allGenres.Where(a => a.GenreId == x.GenreId).Select(a => a.GenreName).FirstOrDefault();
                    if (x != genres.ElementAt(genres.Count - 1))
                    {
                        genresStr += ", ";
                    }
                }
                AllArtists.Add(new ArtistHelperVM()
                {
                    ArtistGenresInString = genresStr,
                    ArtistId             = item.ArtistId,
                    ArtistMembers        = item.ArtistMembers,
                    ArtistName           = item.ArtistName,
                    ArtistPhoto          = item.ArtistPhoto
                });
                QueryArtists.Add(new ArtistHelperVM()
                {
                    ArtistGenresInString = genresStr,
                    ArtistId             = item.ArtistId,
                    ArtistMembers        = item.ArtistMembers,
                    ArtistName           = item.ArtistName,
                    ArtistPhoto          = item.ArtistPhoto
                });
            }
            foreach (var item in allGenres)
            {
                AllGenres.Add(item);
                QueryGenres.Add(item);
            }
        }
Exemplo n.º 4
0
        private void Process(List <File> selection, List <File> allFiles)
        {
            string currAlbum     = null;
            string currArtist    = null;
            string currAA        = null;
            string currGenre     = null;
            string currComposer  = null;
            string currConductor = null;
            string currGrouping  = null;
            string currCopyright = null;

            bool set = false;

            foreach (File f in allFiles)
            {
                if (f.Tags.Title != null && f.Tags.Title.Length > 0)
                {
                    AllTitles.Add(f.Tags.Title);
                }
                string fname = Path.GetFileName(f.FileName);
                Match  match = Regex.Match(fname, @"(?:\d+\.?)?(?:[\s_]?-[\s_]?)?(.*?)\.[^\.]+$");
                if (match.Success)
                {
                    string val = match.Groups[1].Value;
                    val = val.Replace('_', ' ');
                    val = val.Replace('.', ' ');
                    val = Regex.Replace(val, @"\s+", " ");
                    val = val.Trim();
                    if (val.Length > 0)
                    {
                        AllTitles.Add(val);
                    }

                    if (f.Tags.Album != null && f.Tags.Album.Length > 0)
                    {
                        AllAlbums.Add(f.Tags.Album);
                    }
                    if (f.Tags.Artists != null && f.Tags.Artists.Length > 0)
                    {
                        AllArtists.Add(f.Tags.Artists);
                    }
                    if (f.Tags.AlbumArtists != null && f.Tags.AlbumArtists.Length > 0)
                    {
                        AllAlbumArtists.Add(f.Tags.AlbumArtists);
                    }
                    if (f.Tags.Genres != null && f.Tags.Genres.Length > 0)
                    {
                        AllGenres.Add(f.Tags.Genres);
                    }
                    if (f.Tags.Composers != null && f.Tags.Composers.Length > 0)
                    {
                        AllComposers.Add(f.Tags.Composers);
                    }
                    if (f.Tags.Conductor != null && f.Tags.Conductor.Length > 0)
                    {
                        AllConductors.Add(f.Tags.Conductor);
                    }
                    if (f.Tags.Grouping != null && f.Tags.Grouping.Length > 0)
                    {
                        AllGroupings.Add(f.Tags.Grouping);
                    }
                    if (f.Tags.Copyright != null && f.Tags.Copyright.Length > 0)
                    {
                        AllCopyrights.Add(f.Tags.Copyright);
                    }
                }
            }

            foreach (File f in selection)
            {
                if (!set)
                {
                    currAlbum     = f.Tags.Album;
                    currArtist    = f.Tags.Artists;
                    currAA        = f.Tags.AlbumArtists;
                    currGenre     = f.Tags.Genres;
                    currComposer  = f.Tags.Composers;
                    currConductor = f.Tags.Conductor;
                    currGrouping  = f.Tags.Grouping;
                    currCopyright = f.Tags.Copyright;
                }
                else
                {
                    if (SameAlbum && currAlbum != f.Tags.Album)
                    {
                        SameAlbum = false;
                    }
                    else
                    {
                        currAlbum = f.Tags.Album;
                    }

                    if (SameArtists && currArtist != f.Tags.Artists)
                    {
                        SameArtists = false;
                    }
                    else
                    {
                        currArtist = f.Tags.Artists;
                    }

                    if (SameAlbumArtists && currAA != f.Tags.AlbumArtists)
                    {
                        SameAlbumArtists = false;
                    }
                    else
                    {
                        currAA = f.Tags.AlbumArtists;
                    }

                    if (SameGenres && currGenre != f.Tags.Genres)
                    {
                        SameGenres = false;
                    }
                    else
                    {
                        currGenre = f.Tags.Genres;
                    }

                    if (SameComposers && currComposer != f.Tags.Composers)
                    {
                        SameComposers = false;
                    }
                    else
                    {
                        currComposer = f.Tags.Composers;
                    }

                    if (SameConductor && currConductor != f.Tags.Conductor)
                    {
                        SameConductor = false;
                    }
                    else
                    {
                        currConductor = f.Tags.Conductor;
                    }

                    if (SameGrouping && currGrouping != f.Tags.Grouping)
                    {
                        SameGrouping = false;
                    }
                    else
                    {
                        currGrouping = f.Tags.Grouping;
                    }

                    if (SameCopyright && currCopyright != f.Tags.Copyright)
                    {
                        SameCopyright = false;
                    }
                    else
                    {
                        currCopyright = f.Tags.Copyright;
                    }
                }
                set = true;
            }
            SetValues(selection);
        }
Exemplo n.º 5
0
 public void Add(Artist artist)
 {
     AllArtists.Add(artist);
 }