public static List <OnlineMediaItem> Search(OnlineMediaSource source, OnlineContentSearchParameters searchParams, ManualResetEvent abortEvent) { try { if (searchParams == null) { searchParams = new OnlineContentSearchParameters(); } // Nothing means Everything. if (searchParams.Filter == OnlineContentSearchFilter.None) { searchParams.Filter = OnlineContentSearchFilter.Any; } searchParams.SearchText = searchParams.SearchText.ToLowerInvariant(); OnlineContentSearcher searcher = GetSearcher(source); if (searcher != null) { return(searcher.Search(searchParams, abortEvent)); } } catch (Exception ex) { Logger.LogException(ex); } return(null); }
public static List <OnlinePlaylist> GetMyPlaylists(OnlineMediaSource source, ManualResetEvent abortEvent) { try { OnlineContentSearcher searcher = GetSearcher(source); if (searcher != null) { return(searcher.GetMyPlaylists(abortEvent)); } } catch (Exception ex) { Logger.LogException(ex); } return(null); }
public static bool IsSearchConfigValid(OnlineMediaSource source) { try { OnlineContentSearcher searcher = GetSearcher(source); if (searcher != null) { return(searcher.HasValidConfig); } } catch (Exception ex) { Logger.LogException(ex); } return(false); }
private static OnlineContentSearcher GetSearcher(OnlineMediaSource source) { OnlineContentSearcher searcher = null; switch (source) { case OnlineMediaSource.Deezer: searcher = new DeezerTrackSearcher(); break; case OnlineMediaSource.ShoutCast: searcher = new ShoutcastDirSearcher(); break; case OnlineMediaSource.Internal: default: searcher = new LocalDatabaseSearcher(); break; } return(searcher); }