public bool IsArtistRestricted(Artist artist)
        {
            if (artist == null || artist.Name == null) return true;
            char[] comma = { ',' };
            var names = searchRuleSettings.ForbiddenArtistNames.Split(comma);

            if (!names.Any() || (names.Count() == 1 && names.FirstOrDefault() == string.Empty)) return false;

            return searchRuleSettings.ForbiddenTrackNames != string.Empty &&
                   names.Any(s => artist.Name.ToUpper().Contains(s.ToUpper()));
        }
示例#2
0
 public void SetUp()
 {
     IList<Artist> artists = new List<Artist>();
     var artist = new Artist {Name = "test name"};
     artists.Add(artist);
     track = new Track
                 {
                     Name = "Test Track name",
                     Album = new Album {Name = "Test Album name",Artist = artist},
                     Artists = artists,
                     Duration = new TimeSpan(0,0,5,0),
                     DurationMilliseconds = 5,
                     IsAlreadyQueued = false,
                     IsAvailable = true,
                     Link = "/test",
                     MusicProvider = new MusicProviderDescriptor
                             {
                                 Name = "Spotify",
                                 Identifier = "sp"
                             },
                     Popularity = 0,
                     TrackArtworkUrl = "/test"
                 };
 }
 public void SetUp()
 {
     artist = new Artist { Name = "test name" };
 }
示例#4
0
        public IEnumerable<Track> GetTracksByArtist(Artist artist, int maxTracks)
        {
            Login();
            logger.Debug("Track search by Artist started for {0}", artist.Name);
            using (var search = session.Search(artist.Name, 0, maxTracks, 0, 0, 0, 0, 0, 0, sp_search_type.STANDARD))
            {
                search.WaitForCompletion();
                if (!search.IsComplete)
                {
                    logger.Error("Search for tracks by {0} timed out", artist.Name);
                    return null;
                }

                return search.Tracks.Select(a => new TrackMapper().Map(a)).ToArray();
            }
        }