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


Java Flickr.getPhotosInterface方法代码示例

本文整理汇总了Java中com.flickr4java.flickr.Flickr.getPhotosInterface方法的典型用法代码示例。如果您正苦于以下问题:Java Flickr.getPhotosInterface方法的具体用法?Java Flickr.getPhotosInterface怎么用?Java Flickr.getPhotosInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.flickr4java.flickr.Flickr的用法示例。


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

示例1: searchImages

import com.flickr4java.flickr.Flickr; //导入方法依赖的package包/类
@Override
public List<Image> searchImages(String query) throws ImageSearchException {

    Flickr flickr = new Flickr(key, secret, new REST());

    PhotosInterface photosInterface = flickr.getPhotosInterface();

    HashSet<String> extras = new HashSet<String>();
    extras.add(Extras.URL_L);
    SearchParameters searchParameters = new SearchParameters();
    searchParameters.setText(query);
    searchParameters.setExtras(extras);
    searchParameters.setTagMode("all");

    List<Image> images = new ArrayList<Image>();
    try {
        PhotoList photoList = photosInterface.search(searchParameters, 5, 0);
        for (Photo photo : (List<Photo>) photoList) {
            Image image = new Image();
            image.setSource("flickr");
            image.setTitle(photo.getTitle());
            image.setUrl(photo.getLargeUrl());
            images.add(image);
        }
    } catch (FlickrException e) {
        throw new ImageSearchException(e.getMessage(), e.getCause());
    }

    return images;
}
 
开发者ID:jmoennich,项目名称:bilderbuch,代码行数:31,代码来源:FlickrImageSearch.java

示例2: init

import com.flickr4java.flickr.Flickr; //导入方法依赖的package包/类
@PostConstruct
public void init() {

    Transport transport = new REST();
    f = new Flickr(apiKey, sharedSecret, transport);

    photoInterface = f.getPhotosInterface();
}
 
开发者ID:eriklupander,项目名称:hipstacaster,代码行数:9,代码来源:FlickrController.java

示例3: searchOnParams

import com.flickr4java.flickr.Flickr; //导入方法依赖的package包/类
/**
 * the expanded class FlickrSearchParameters is queried to determine what
 * fine-tuning of the search parameters is required before submitting to the
 * flickr service API. If a tag search has been requested, the tags will be
 * tokenised on commas if any are present, otherwise on spaces. If a value
 * has been set for a flickr user string, that string is examined to see if
 * it is an email, a flick user-id or (failing either) a flickr user-name.
 */
@Override
public PhotoList<Photo> searchOnParams(FlickrSearchParameters params, int pageToGet, int queryLimit,
	String apiKey,
	String apiSharedSecret) throws FlickrException
{
	Flickr flickr = getFlickr(apiKey, apiSharedSecret);

	// From the unparsed user input, see if there's either a flick userid
	// already provided; otherwise get the flickr id by specialised flickr
	// query
	/* boolean sendingFlickrUserId = */
	extractUserSearchString(flickr, params);

	if( params.getSearchRawText() != null )
	{
		String rawText = params.getSearchRawText().trim();
		if( rawText.length() > 0 )
		{
			if( params.isTagsNotText() )
			{
				if( rawText.contains(",") )
				{
					params.setTags(rawText.split(","));
				}
				else
				{
					params.setTags(rawText.split(" "));
				}
				if( params.isTagsAll() )
				{
					params.setTagMode(ALL);
				}
				else
				{
					params.setTagMode(ANY);
				}
			}
			else
			{
				params.setText(rawText);
			}
		}
	}

	// The various extras flags (to specify level of detail retrieved)
	params.setExtras(EXTRAS_SET);

	PhotosInterface photosInterface = flickr.getPhotosInterface();

	try
	{
		PhotoList<Photo> photoList = photosInterface.search(params, queryLimit, pageToGet);
		return photoList;
	}
	catch( FlickrException fe ) // NOSONAR
	{
		throw fe;
	}
	catch( Exception e )
	{
		throw Throwables.propagate(e);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:72,代码来源:FlickrServiceImpl.java


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