public ImageInfo GetImage(MediaFile file) { ImageInfo returnValue = null; ILocalImageProvider localProvider = new LocalDBImageProvider(); returnValue = localProvider.GetImage(file); if (returnValue != null) return returnValue; else { ThreadPool.QueueUserWorkItem(delegate { IImageProvider webProvider = new AmazonAssociatesImageProvider(); returnValue = webProvider.GetImage(file); if (returnValue != null) { localProvider.StoreImages(file.ArtistName, file.AlbumName, new DataList<ImageInfo>(returnValue)); ObjectRepository.RefreshImagesFiles(file.ArtistName, file.AlbumName); } }); } if (returnValue == null) Logging.Debug(typeof(IImageProviderFactory), String.Format("No Picture found for: {0}, {1}, {2}", file.ArtistName, file.AlbumName, file.fileId)); return returnValue; }
public DataList<ImageInfo> GetImages(string artistName, string albumName, Int64? fileId) { DataList<ImageInfo> returnList = new DataList<ImageInfo>(); ILocalImageProvider localProvider = new LocalDBImageProvider(); returnList = localProvider.GetImages(artistName, albumName, fileId); if (returnList.Count > 0) return returnList; else { IImageProvider webProvider = new LocalDBImageProvider(); returnList = webProvider.GetImages(artistName, albumName, fileId); if (returnList.Count > 0) localProvider.StoreImages(artistName, albumName, returnList); } return returnList; }