コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }