• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ContentDirectoryErrorCode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: browse

import org.fourthline.cling.support.contentdirectory.ContentDirectoryErrorCode; //导入依赖的package包/类
@Override
public BrowseResult browse(String objectID, BrowseFlag browseFlag, String filter, long firstResult, long maxResults, SortCriterion[] orderby) throws ContentDirectoryException {
    String address = Utils.getIPAddress(true);
    String serverUrl = "http://" + address + ":" + JettyResourceServer.JETTY_SERVER_PORT;

    //Create container by id
    Container resultBean = ContainerFactory.createContainer(objectID, serverUrl);
    DIDLContent content = new DIDLContent();

    for (Container c : resultBean.getContainers())
        content.addContainer(c);

    for (Item item : resultBean.getItems())
        content.addItem(item);

    int count = resultBean.getChildCount();
    String contentModel = "";
    try {
        contentModel = new DIDLParser().generate(content);
    } catch (Exception e) {
        throw new ContentDirectoryException(
                ContentDirectoryErrorCode.CANNOT_PROCESS, e.toString());
    }

    return new BrowseResult(contentModel, count, count);
}
 
开发者ID:kevinshine,项目名称:BeyondUPnP,代码行数:27,代码来源:BeyondContentDirectoryService.java


示例2: browse

import org.fourthline.cling.support.contentdirectory.ContentDirectoryErrorCode; //导入依赖的package包/类
@Override
public BrowseResult browse(String objectId, BrowseFlag browseFlag, String filter, long firstResult,
        long maxResults, SortCriterion[] orderby) throws ContentDirectoryException {

    LOG.info("UPnP request - objectId: " + objectId + ", browseFlag: " + browseFlag + ", filter: " + filter +
            ", firstResult: " + firstResult + ", maxResults: " + maxResults);

    // maxResult == 0 means all.
    if (maxResults == 0) {
        maxResults = Integer.MAX_VALUE;
    }

    try {
        if (CONTAINER_ID_ROOT.equals(objectId)) {
            return browseFlag == BrowseFlag.METADATA ? browseRootMetadata() : browseRoot(firstResult, maxResults);
        }
        if (CONTAINER_ID_PLAYLIST_ROOT.equals(objectId)) {
            return browseFlag == BrowseFlag.METADATA ? browsePlaylistRootMetadata() : browsePlaylistRoot(firstResult, maxResults);
        }
        if (objectId.startsWith(CONTAINER_ID_PLAYLIST_PREFIX)) {
            int playlistId = Integer.parseInt(objectId.replace(CONTAINER_ID_PLAYLIST_PREFIX, ""));
            Playlist playlist = playlistService.getPlaylist(playlistId);
            return browseFlag == BrowseFlag.METADATA ? browsePlaylistMetadata(playlist) : browsePlaylist(playlist, firstResult, maxResults);
        }

        int mediaFileId = Integer.parseInt(objectId.replace(CONTAINER_ID_FOLDER_PREFIX, ""));
        MediaFile mediaFile = mediaFileService.getMediaFile(mediaFileId);
        return browseFlag == BrowseFlag.METADATA ? browseMediaFileMetadata(mediaFile) : browseMediaFile(mediaFile, firstResult, maxResults);

    } catch (Throwable x) {
        LOG.error("UPnP error: " + x, x);
        throw new ContentDirectoryException(ContentDirectoryErrorCode.CANNOT_PROCESS, x.toString());
    }
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:35,代码来源:FolderBasedContentDirectory.java


示例3: browse

import org.fourthline.cling.support.contentdirectory.ContentDirectoryErrorCode; //导入依赖的package包/类
@Override
public BrowseResult browse(String objectId, BrowseFlag browseFlag, String filter, long firstResult,
        long maxResults, SortCriterion[] orderby) throws ContentDirectoryException {

    if (!settingsService.getLicenseInfo().isLicenseOrTrialValid()) {
        LOG.warn("UPnP/DLNA media server not available. Please upgrade to Subsonic Premium.");
        throw new ContentDirectoryException(ContentDirectoryErrorCode.CANNOT_PROCESS, "Please upgrade to Subsonic Premium");
    }

    LOG.info("UPnP request - objectId: " + objectId + ", browseFlag: " + browseFlag + ", filter: " + filter +
            ", firstResult: " + firstResult + ", maxResults: " + maxResults);

    // maxResult == 0 means all.
    if (maxResults == 0) {
        maxResults = Integer.MAX_VALUE;
    }

    try {
        if (CONTAINER_ID_ROOT.equals(objectId)) {
            return browseFlag == BrowseFlag.METADATA ? browseRootMetadata() : browseRoot(firstResult, maxResults);
        }
        if (CONTAINER_ID_PLAYLIST_ROOT.equals(objectId)) {
            return browseFlag == BrowseFlag.METADATA ? browsePlaylistRootMetadata() : browsePlaylistRoot(firstResult, maxResults);
        }
        if (objectId.startsWith(CONTAINER_ID_PLAYLIST_PREFIX)) {
            int playlistId = Integer.parseInt(objectId.replace(CONTAINER_ID_PLAYLIST_PREFIX, ""));
            Playlist playlist = playlistService.getPlaylist(playlistId);
            return browseFlag == BrowseFlag.METADATA ? browsePlaylistMetadata(playlist) : browsePlaylist(playlist, firstResult, maxResults);
        }

        int mediaFileId = Integer.parseInt(objectId.replace(CONTAINER_ID_FOLDER_PREFIX, ""));
        MediaFile mediaFile = mediaFileService.getMediaFile(mediaFileId);
        return browseFlag == BrowseFlag.METADATA ? browseMediaFileMetadata(mediaFile) : browseMediaFile(mediaFile, firstResult, maxResults);

    } catch (Throwable x) {
        LOG.error("UPnP error: " + x, x);
        throw new ContentDirectoryException(ContentDirectoryErrorCode.CANNOT_PROCESS, x.toString());
    }
}
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:40,代码来源:FolderBasedContentDirectory.java


示例4: browse

import org.fourthline.cling.support.contentdirectory.ContentDirectoryErrorCode; //导入依赖的package包/类
@Override
public BrowseResult browse(String objectId, BrowseFlag browseFlag, String filter, long firstResult,
        long maxResults, SortCriterion[] orderby) throws ContentDirectoryException {

    if (!settingsService.getLicenseInfo().isLicenseOrTrialValid()) {
        LOG.warn("UPnP/DLNA media server not available. Please upgrade to Subsonic Premium.");
        throw new ContentDirectoryException(ContentDirectoryErrorCode.CANNOT_PROCESS, "Please upgrade to Subsonic Premium");
    }

    LOG.info("UPnP request - objectId: " + objectId + ", browseFlag: " + browseFlag + ", filter: " + filter +
            ", firstResult: " + firstResult + ", maxResults: " + maxResults);

    // maxResult == 0 means all.
    if (maxResults == 0) {
        maxResults = Integer.MAX_VALUE;
    }

    try {
        if (CONTAINER_ID_ROOT.equals(objectId)) {
            return browseFlag == BrowseFlag.METADATA ? browseRootMetadata() : browseRoot(firstResult, maxResults);
        }
        if (CONTAINER_ID_PLAYLIST_ROOT.equals(objectId)) {
            return browseFlag == BrowseFlag.METADATA ? browsePlaylistRootMetadata() : browsePlaylistRoot(firstResult, maxResults);
        }
        if (objectId.startsWith(CONTAINER_ID_PLAYLIST_PREFIX)) {
            int playlistId = Integer.parseInt(objectId.replace(CONTAINER_ID_PLAYLIST_PREFIX, ""));
            Playlist playlist = playlistService.getPlaylist(playlistId);
            return browseFlag == BrowseFlag.METADATA ? browsePlaylistMetadata(playlist) : browsePlaylist(playlist, firstResult, maxResults);
        }

        MediaFile mediaFile = mediaFileService.getMediaFile(Integer.parseInt(objectId));
        return browseFlag == BrowseFlag.METADATA ? browseMediaFileMetadata(mediaFile) : browseMediaFile(mediaFile, firstResult, maxResults);

    } catch (Throwable x) {
        LOG.error("UPnP error: " + x, x);
        throw new ContentDirectoryException(ContentDirectoryErrorCode.CANNOT_PROCESS, x.toString());
    }
}
 
开发者ID:FutureSonic,项目名称:FutureSonic-Server,代码行数:39,代码来源:FolderBasedContentDirectory.java


示例5: browse

import org.fourthline.cling.support.contentdirectory.ContentDirectoryErrorCode; //导入依赖的package包/类
@Override
public BrowseResult browse(String objectId, BrowseFlag browseFlag,
                           String filter, long firstResult,
                           long maxResults, SortCriterion[] orderBy)
    throws ContentDirectoryException {

    LOG.info("UPnP request - objectId: " + objectId + ", browseFlag: " + browseFlag + ", filter: " + filter + ", firstResult: " + firstResult + ", maxResults: " + maxResults);

    if (objectId == null)
        throw new ContentDirectoryException(ContentDirectoryErrorCode.CANNOT_PROCESS, "objectId is null");

    // maxResult == 0 means all.
    if (maxResults == 0) {
        maxResults = Long.MAX_VALUE;
    }

    BrowseResult returnValue = null;
    try {
        String[] splitId = objectId.split(SEPARATOR);
        String browseRoot = splitId[0];
        String itemId = splitId.length == 1 ? null : splitId[1];

        UpnpContentProcessor processor = findProcessor(browseRoot);
        if (processor == null) {
            // if it's null then assume it's a file, and that the id
            // is all that's there.
            itemId = browseRoot;
            processor = getMediaFileProcessor();
        }

        if (itemId == null) {
            returnValue = browseFlag == BrowseFlag.METADATA ? processor.browseRootMetadata() : processor.browseRoot(filter, firstResult, maxResults, orderBy);
        } else {
            returnValue = browseFlag == BrowseFlag.METADATA ? processor.browseObjectMetadata(itemId) : processor.browseObject(itemId, filter, firstResult, maxResults, orderBy);
        }
        return returnValue;
    } catch (Throwable x) {
        LOG.error("UPnP error: " + x, x);
        throw new ContentDirectoryException(ContentDirectoryErrorCode.CANNOT_PROCESS, x.toString());
    }
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:42,代码来源:DispatchingContentDirectory.java


示例6: browse

import org.fourthline.cling.support.contentdirectory.ContentDirectoryErrorCode; //导入依赖的package包/类
@Override
public BrowseResult browse(String objectID, BrowseFlag browseFlag, String s1, long l, long l1,
                           SortCriterion[] sortCriterions) throws ContentDirectoryException {
    try {

        DIDLContent didl = new DIDLContent();

        ContentNode contentNode = ContentTree.getNode(objectID);

        Log.d(TAG, "someone's browsing id: " + objectID);

        if (contentNode == null) { // 没有共享资源
            return new BrowseResult("", 0, 0);
        }

        if (contentNode.isItem()) { // 是文件
            didl.addItem(contentNode.getItem());

            Log.v(TAG, "returing item: " + contentNode.getItem().getTitle());

            return new BrowseResult(new DIDLParser().generate(didl), 1, 1);

        } else { // 是文件夹
            if (browseFlag == BrowseFlag.METADATA) {
                didl.addContainer(contentNode.getContainer());

                Log.v(TAG, "returning metadata of container: " + contentNode.getContainer().getTitle());

                return new BrowseResult(new DIDLParser().generate(didl), 1, 1);

            } else {
                for (Container container : contentNode.getContainer().getContainers()) {
                    didl.addContainer(container);

                    Log.v(TAG, "getting child container: " + container.getTitle());
                }
                for (Item item : contentNode.getContainer().getItems()) {
                    didl.addItem(item);

                    Log.v(TAG, "getting child item: " + item.getTitle());
                }
                return new BrowseResult(new DIDLParser().generate(didl),
                        contentNode.getContainer().getChildCount(),
                        contentNode.getContainer().getChildCount());
            }

        }

    } catch (Exception e) {
        throw new ContentDirectoryException(
                ContentDirectoryErrorCode.CANNOT_PROCESS, e.toString());
    }
}
 
开发者ID:hezhubo,项目名称:HPlayer,代码行数:54,代码来源:ContentDirectoryService.java


示例7: browse

import org.fourthline.cling.support.contentdirectory.ContentDirectoryErrorCode; //导入依赖的package包/类
@Override
public BrowseResult browse(String objectID, BrowseFlag browseFlag,
		String filter, long firstResult, long maxResults,
		SortCriterion[] orderby) throws ContentDirectoryException {
	// TODO Auto-generated method stub
	try {

		DIDLContent didl = new DIDLContent();

		ContentNode contentNode = ContentTree.getNode(objectID);
		
		Log.v(LOGTAG, "someone's browsing id: " + objectID);

		if (contentNode == null)
			return new BrowseResult("", 0, 0);

		if (contentNode.isItem()) {
			didl.addItem(contentNode.getItem());
			
			Log.v(LOGTAG, "returing item: " + contentNode.getItem().getTitle());
			
			return new BrowseResult(new DIDLParser().generate(didl), 1, 1);
		} else {
			if (browseFlag == BrowseFlag.METADATA) {
				didl.addContainer(contentNode.getContainer());
				
				Log.v(LOGTAG, "returning metadata of container: " + contentNode.getContainer().getTitle());
				
				return new BrowseResult(new DIDLParser().generate(didl), 1,
						1);
			} else {
				for (Container container : contentNode.getContainer()
						.getContainers()) {
					didl.addContainer(container);
					
					Log.v(LOGTAG, "getting child container: " + container.getTitle());
				}
				for (Item item : contentNode.getContainer().getItems()) {
					didl.addItem(item);
					
					Log.v(LOGTAG, "getting child item: " + item.getTitle());
				}
				return new BrowseResult(new DIDLParser().generate(didl),
						contentNode.getContainer().getChildCount(),
						contentNode.getContainer().getChildCount());
			}

		}

	} catch (Exception ex) {
		throw new ContentDirectoryException(
				ContentDirectoryErrorCode.CANNOT_PROCESS, ex.toString());
	}
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:55,代码来源:ContentDirectoryService.java


示例8: browse

import org.fourthline.cling.support.contentdirectory.ContentDirectoryErrorCode; //导入依赖的package包/类
@Override
  public BrowseResult browse(String objectId, BrowseFlag browseFlag, String filter, long firstResult,
          long maxResults, SortCriterion[] orderby) throws ContentDirectoryException {

      if (!settingsService.getLicenseInfo().isLicenseOrTrialValid()) {
          LOG.warn("UPnP/DLNA media server not available. Please upgrade to Subsonic Premium.");
          throw new ContentDirectoryException(ContentDirectoryErrorCode.CANNOT_PROCESS, "Please upgrade to Subsonic Premium");
      }

      LOG.info("UPnP request - objectId: " + objectId + ", browseFlag: " + browseFlag + ", filter: " + filter +
              ", firstResult: " + firstResult + ", maxResults: " + maxResults);

      // maxResult == 0 means all.
      if (maxResults == 0) {
          maxResults = Integer.MAX_VALUE;
      }

      try {
          if (CONTAINER_ID_ROOT.equals(objectId)) {
              return browseFlag == BrowseFlag.METADATA ? browseRootMetadata() : browseRoot(firstResult, maxResults);
          }
          if (CONTAINER_ID_PLAYLIST_ROOT.equals(objectId)) {
              return browseFlag == BrowseFlag.METADATA ? browsePlaylistRootMetadata() : browsePlaylistRoot(firstResult, maxResults);
          }
          if (objectId.startsWith(CONTAINER_ID_PLAYLIST_PREFIX)) {
              int playlistId = Integer.parseInt(objectId.replace(CONTAINER_ID_PLAYLIST_PREFIX, ""));
              Playlist playlist = playlistService.getPlaylist(playlistId);
              return browseFlag == BrowseFlag.METADATA ? browsePlaylistMetadata(playlist) : browsePlaylist(playlist, firstResult, maxResults);
          }

      //  MediaFile mediaFile = mediaFileService.getMediaFile(Integer.parseInt(objectId));
//	MediaFile mediaFile = mediaFileService.getMediaFile(Integer.parseInt(objectId.replace(CONTAINER_ID_FOLDER_PREFIX, "")));

          int mediaFileId = Integer.parseInt(objectId.replace(CONTAINER_ID_FOLDER_PREFIX, ""));
          MediaFile mediaFile = mediaFileService.getMediaFile(mediaFileId);
	
          return browseFlag == BrowseFlag.METADATA ? browseMediaFileMetadata(mediaFile) : browseMediaFile(mediaFile, firstResult, maxResults);

      } catch (Throwable x) {
          LOG.error("UPnP error: " + x, x);
          throw new ContentDirectoryException(ContentDirectoryErrorCode.CANNOT_PROCESS, x.toString());
      }
  }
 
开发者ID:MadMarty,项目名称:madsonic-server-5.1,代码行数:44,代码来源:FolderBasedContentDirectory.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OCSPResponse类代码示例发布时间:2022-05-22
下一篇:
Java DbxAuthFinish类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap