当前位置: 首页>>代码示例>>Java>>正文


Java Photo类代码示例

本文整理汇总了Java中com.flickr4java.flickr.photos.Photo的典型用法代码示例。如果您正苦于以下问题:Java Photo类的具体用法?Java Photo怎么用?Java Photo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Photo类属于com.flickr4java.flickr.photos包,在下文中一共展示了Photo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: FlickrSearchResultsEvent

import com.flickr4java.flickr.photos.Photo; //导入依赖的package包/类
/**
 * The boolean argument preserved in a member variable to flag that some
 * sort of filter is applied (in addition to any keyword search), and thus
 * that the result set may have thereby been reduced.
 * 
 * @param results
 * @param filterApplied
 */
public FlickrSearchResultsEvent(SearchResults<Photo> results, boolean filterApplied)
{
	this.results = results;
	if( filterApplied )
	{
		filteredOut = Integer.MIN_VALUE;
	}
	else
	{
		filteredOut = 0;
	}
	String errorMessage = results.getErrorMessage();
	if( !Check.isEmpty(errorMessage) )
	{
		setErrored(true);
		setErrorMessage(errorMessage);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:27,代码来源:FlickrSearchResultsEvent.java

示例2: invokeService

import com.flickr4java.flickr.photos.Photo; //导入依赖的package包/类
private PhotoList<Photo> invokeService(SectionInfo info, FlickrSearchEvent searchEvent) throws FlickrException
{
	FlickrSearchParameters params = searchEvent.getParams();
	PhotoList<Photo> photoList = null;
	int srchOffset = searchEvent.getOffset();
	// Offset is a zero-based logic but flickr uses ordinal page numbers
	// (ie, lowest is "1")
	int pagerCurrentPage = (srchOffset / FlickrUtils.PAGER_PER_PAGE) + 1;

	FlickrSettings flickrSettings = flickrHandler.getFlickrSettings();

	photoList = flickrService.searchOnParams(params, pagerCurrentPage, FlickrUtils.PAGER_PER_PAGE,
		flickrSettings.getApiKey(), flickrSettings.getApiSharedSecret());

	return photoList;
}
 
开发者ID:equella,项目名称:Equella,代码行数:17,代码来源:FlickrSearchResultsSection.java

示例3: setUp

import com.flickr4java.flickr.photos.Photo; //导入依赖的package包/类
@Before
public void setUp() throws ServiceException, FlickrException {

    //spy the flickrService so that we can take control over single calls of methods without touching the rest
    flickrService = Mockito.spy(flickrService);

    //add some testdata
    int dummyId = 93838;
    int dummySecret = 45353454;
    int dummyOriSecret = 654567;
    for(int i=0; i<4; i++){
        Photo photo = new Photo();
        photo.setId(String.valueOf(dummyId+i));
        photo.setFarm("1");
        photo.setServer("459");
        photo.setOriginalFormat("jpg");
        photo.setSecret(String.valueOf(dummySecret+i));
        photo.setOriginalSecret(String.valueOf(dummyOriSecret+i));
        Mockito.doNothing().when(flickrService).downloadTempPhoto(eq(buildOriFlickrUrl(photo)), eq(photo.getId()+"_o"),
                eq(photo.getOriginalFormat()));
        Mockito.doNothing().when(flickrService).downloadTempPhoto(eq(buildFlickrUrl(photo)), eq(photo.getId()),
                eq(photo.getOriginalFormat()));
        Mockito.doReturn(geoData).when(flickrService).getLocation(photo.getId());
        flickrPhotos.add(photo);
    }
}
 
开发者ID:travelimg,项目名称:travelimg,代码行数:27,代码来源:FlickrServiceTest.java

示例4: testNoPhotosToDownloadProgressShouldBe100

import com.flickr4java.flickr.photos.Photo; //导入依赖的package包/类
@Test
public void testNoPhotosToDownloadProgressShouldBe100(){
    List<Photo> photos = new ArrayList<>();
    TestPhotoConsumer testPhotoConsumer = new TestPhotoConsumer();
    TestProgressConsumer testProgressConsumer = new TestProgressConsumer();
    TestErrorHandler testErrorHandler = new TestErrorHandler();

    Cancelable downloadTask = flickrService.downloadPhotos(photos, testPhotoConsumer, testProgressConsumer,
            testErrorHandler);
    awaitCompletion(downloadTask);

    //make sure no exceptions occurred
    assertFalse(testErrorHandler.exceptionOccurred());

    //make sure that no photo was downloaded
    assertThat(testPhotoConsumer.getAccepted(),empty());

    //make sure accept method was called only once and the progress value was 1.0
    assertThat(testProgressConsumer.getAccepted().size(),is(1));
    assertThat(testProgressConsumer.getAccepted().get(0), is(1.0));
}
 
开发者ID:travelimg,项目名称:travelimg,代码行数:22,代码来源:FlickrServiceTest.java

示例5: flickrProcess

import com.flickr4java.flickr.photos.Photo; //导入依赖的package包/类
@Override
protected PhotoList<Photo> flickrProcess(String path) {
	try {
		final CollectionsInterface collectionsInterface = flickr.getCollectionsInterface();
		final Matcher matcher = r.matcher(path);
		matcher.find();
		final String userName = matcher.group(1);
		final String collectionsId = matcher.group(2);

		final List<Collection> collections = collectionsInterface.getTree(collectionsId, userName);

		final PhotoList<Photo> pl = new PhotoList<Photo>();
		for (final Collection c : collections)
			pl.addAll(c.getPhotos());

		return pl;
	} catch (final Exception e) {
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:22,代码来源:FlickrWebpageImageCollection.java

示例6: iterator

import com.flickr4java.flickr.photos.Photo; //导入依赖的package包/类
@Override
public Iterator<IMAGE> iterator() {
	return new Iterator<IMAGE>() {
		Iterator<Photo> internal = photos.iterator();

		@Override
		public boolean hasNext() {
			return internal.hasNext();
		}

		@Override
		public IMAGE next() {
			return read(internal.next());
		}

		@Override
		public void remove() {
			internal.remove();
		}
	};
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:22,代码来源:FlickrImageDataset.java

示例7: resolveLargestSize

import com.flickr4java.flickr.photos.Photo; //导入依赖的package包/类
private void resolveLargestSize(Photo photo) {
    if(photo.getLarge1600Size() != null) {
        this.setFullsizeUrl(photo.getLarge1600Size().getSource());
    }
    else if(photo.getLargeSize() != null) {
        this.setFullsizeUrl(photo.getLargeSize().getSource());
    }
    else if(photo.getLarge2048Size() != null) {
        this.setFullsizeUrl(photo.getLarge2048Size().getSource());
    }
    else if(photo.getMedium800Size() != null) {
        this.setFullsizeUrl(photo.getMedium800Size().getSource());
    }
    else if(photo.getMediumSize() != null) {
        this.setFullsizeUrl(photo.getMediumSize().getSource());
    }
    else {
        this.setFullsizeUrl(photo.getOriginalSize().getSource());
    }
}
 
开发者ID:eriklupander,项目名称:hipstacaster,代码行数:21,代码来源:PhotoDTO.java

示例8: search

import com.flickr4java.flickr.photos.Photo; //导入依赖的package包/类
public List<PhotoDTO> search(String tags, Integer page, Integer perPage) throws HipstaException {
    List<PhotoDTO> list = new ArrayList<>();
    SearchParameters params = new SearchParameters();
    params.setTags(toArray(tags));
    params.setExtras(extras);

    try {
        long start = System.currentTimeMillis();
        PhotoList<Photo> searchResult = photoInterface.search(params, perPage, page);
        log.info("Reading 20 photos over interface took {} ms", (System.currentTimeMillis() - start));
        toTinyPhotoDTOs(list, searchResult);
        return list;
    } catch (FlickrException e) {
        throw new HipstaException(e.getMessage());
    }
}
 
开发者ID:eriklupander,项目名称:hipstacaster,代码行数:17,代码来源:FlickrController.java

示例9: download

import com.flickr4java.flickr.photos.Photo; //导入依赖的package包/类
@Override
protected void download(Flickr flickr, Element setXml) throws IOException, SAXException, FlickrException {
	int pageNum = 1;
	int retrievedPhotos = 0;
	int totalPhotos = 0;
	do {
		PhotoList photos = flickr.getPhotosetsInterface().getPhotos(getSetId(), 500, pageNum++);

		totalPhotos = photos.getTotal();

		for (int i = 0; i < photos.size(); i++) {
			retrievedPhotos++;
			Photo photo = (Photo) photos.get(i);
               Logger.getLogger(Set.class).info("Processing photo " + retrievedPhotos + " of " + totalPhotos + ": " + photo.getUrl());
			processPhoto(photo, flickr, setXml);
		}
	} while (retrievedPhotos < totalPhotos);		
}
 
开发者ID:masneyb,项目名称:flickrdownload,代码行数:19,代码来源:Set.java

示例10: displaySizes

import com.flickr4java.flickr.photos.Photo; //导入依赖的package包/类
public void displaySizes(Photo photo) {
    out.println("---Sizes----");
    Collection<Size> sizes = photo.getSizes();
    for (Size size : sizes) {
        out.println(size.getLabel());
    }
}
 
开发者ID:PacktPublishing,项目名称:Machine-Learning-End-to-Endguide-for-Java-developers,代码行数:8,代码来源:FindPicture.java

示例11: processResults

import com.flickr4java.flickr.photos.Photo; //导入依赖的package包/类
@Override
public void processResults(SectionInfo info, FlickrSearchResultsEvent resultsEvent)
{
	SearchResults<Photo> sersults = resultsEvent.getResults();
	List<Photo> lobjex = sersults.getResults();
	if( lobjex != null )
	{
		for( Photo photo : lobjex )
		{
			FlickrListEntry flePhoto = new FlickrListEntry(photo);
			itemList.addListItem(info, flePhoto);
		}
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:15,代码来源:FlickrSearchResultsSection.java

示例12: doSearch

import com.flickr4java.flickr.photos.Photo; //导入依赖的package包/类
protected SearchResults<Photo> doSearch(SectionInfo info, FlickrSearchEvent searchEvent)
{
	// Remove any selections on new search
	results.setSelectedStringValues(info, null);
	SimpleSearchResults<Photo> searchResults = null;
	try
	{
		PhotoList<Photo> photoList = invokeService(info, searchEvent);

		int queryTotal = 0, photoListSize = 0;

		if( photoList != null )
		{
			photoListSize = photoList.size();
			queryTotal = photoList.getTotal();
			searchResults = new SimpleSearchResults<Photo>(photoList, photoListSize, searchEvent.getOffset(),
				queryTotal);
		}
	}
	catch( FlickrException e )
	{
		searchResults = new SimpleSearchResults<Photo>(null, 0, 0, 0);
		String errorMessage = e.getMessage();
		searchResults.setErrorMessage(CurrentLocale.get(SEARCH_ERROR));
		LOGGER.error(errorMessage);
	}

	return searchResults;
}
 
开发者ID:equella,项目名称:Equella,代码行数:30,代码来源:FlickrSearchResultsSection.java

示例13: FlickrResultOption

import com.flickr4java.flickr.photos.Photo; //导入依赖的package包/类
public FlickrResultOption(Photo photo)
{
	this.photo = photo;
	this.value = photo.getId();
	this.description = photo.getDescription();
	this.disabled = false;
}
 
开发者ID:equella,项目名称:Equella,代码行数:8,代码来源:FlickrSearchResultsSection.java

示例14: searchPhotos

import com.flickr4java.flickr.photos.Photo; //导入依赖的package包/类
@Override
public Cancelable searchPhotos(String tags[], double latitude, double longitude,
        boolean useGeoData, Consumer<Photo> callback,
        Consumer<Double> progressCallback, ErrorHandler<ServiceException> errorHandler){
    if (i == 0) {
        searcher = new AsyncSearcher(tags, latitude, longitude, useGeoData, callback, progressCallback, errorHandler);
    }
    executor.submit(searcher);
    return searcher;
}
 
开发者ID:travelimg,项目名称:travelimg,代码行数:11,代码来源:FlickrServiceImpl.java

示例15: downloadPhotos

import com.flickr4java.flickr.photos.Photo; //导入依赖的package包/类
@Override
public Cancelable downloadPhotos(List<Photo> photos, Consumer<Photo> callback, Consumer<Double> progressCallback,
        ErrorHandler<ServiceException> errorHandler){
    AsyncDownloader downloader = new AsyncDownloader(photos, callback, progressCallback, errorHandler);
    executor.submit(downloader);
    return downloader;
}
 
开发者ID:travelimg,项目名称:travelimg,代码行数:8,代码来源:FlickrServiceImpl.java


注:本文中的com.flickr4java.flickr.photos.Photo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。