Ejemplo n.º 1
0
 protected static void LoadBase(JObject iJSON, FilterBase iFilter)
 {
     iFilter.Enabled = iJSON["Enabled"].Value<Boolean>();
     iFilter.FilterCount = iJSON["FilterCount"].Value<Int32>();
 }
Ejemplo n.º 2
0
 public Boolean IsFiltered(SpotifyAPI.Local.Models.Track iTrack, out FilterBase oFilter)
 {
     oFilter = null;
     if (TrackFilters.ContainsKey(iTrack.TrackResource.Uri))
     {
         //we matched a specific track in the filters
         oFilter = TrackFilters[iTrack.TrackResource.Uri];
         return (true);
     }
     else
     {
         //it's not a track filter so let's see if it's an artist uri filter
         if(ArtistFilters.ContainsKey(iTrack.ArtistResource.Uri))
         {
             //we matched a specific artist in the filters
             oFilter = ArtistFilters[iTrack.ArtistResource.Uri];
             return (true);
         }
         else
         {
             //it's not a specific artist filter so let's look for a name match
             foreach (ArtistFilter curArtistFilter in ArtistFilters.Values)
             {
                 if(curArtistFilter.Field == ArtistFilter.FilterField.name)
                 {
                     if (iTrack.ArtistResource.Name.IndexOf(curArtistFilter.Value, StringComparison.InvariantCultureIgnoreCase) > -1)
                     {
                         //we matched the track by artist name in the filters
                         oFilter = curArtistFilter;
                         return (true);
                     }
                 }
             }
         }
     }
     //this track isn't filtered
     return (false);
 }
Ejemplo n.º 3
0
 public async Task RemoveFilter(FilterBase iFilter)
 {
     AllFilters.Remove(iFilter);
     if(iFilter is ArtistFilter)
     {
         ArtistFilters.Remove(iFilter.ToArtistFilter().Value);
     }
     else if(iFilter is TrackFilter)
     {
         TrackFilters.Remove(iFilter.ToTrackFilter().URI);
     }
     await Save();
 }
Ejemplo n.º 4
0
 public async Task AddFilter(FilterBase iFilter)
 {
     AllFilters.Add(iFilter);
     if(iFilter is ArtistFilter)
     {
         ArtistFilter pAFrFilter = (ArtistFilter)iFilter;
         ArtistFilters.Add(pAFrFilter.Value, pAFrFilter);
     }
     else if(iFilter is TrackFilter)
     {
         TrackFilter pTFrFilter = (TrackFilter)iFilter;
         TrackFilters.Add(pTFrFilter.URI, pTFrFilter);
     }
     await Save();
 }
Ejemplo n.º 5
0
 private async void PFTeType_TrackClicked(object sender, EventArgs e)
 {
     Filter = new TrackFilter(FilterTrack.TrackResource.Uri, 
         await FilterTrack.GetAlbumArtAsync(SpotifyAPI.Local.Enums.AlbumArtSize.Size160),
         String.Format("{0}|{1}", FilterTrack.ArtistResource.Name, FilterTrack.TrackResource.Name));
     DialogResult = DialogResult.OK;
 }
Ejemplo n.º 6
0
 private async void butOK_Click(object sender, EventArgs e)
 {
     ArtistFilterConfig pAFCConfig = (ArtistFilterConfig)cDicControls["artistfilterconfig"];
     Filter = new ArtistFilter(pAFCConfig.Field,
         pAFCConfig.Value,
         await FilterTrack.GetAlbumArtAsync(SpotifyAPI.Local.Enums.AlbumArtSize.Size160),
         FilterTrack.ArtistResource.Name);
     DialogResult = DialogResult.OK;
 }