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


Java ContentDirectoryErrorCode.CANNOT_PROCESS属性代码示例

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


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

示例1: browse

@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,代码行数:26,代码来源:BeyondContentDirectoryService.java

示例2: browse

@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,代码行数:34,代码来源:FolderBasedContentDirectory.java

示例3: browse

@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,代码行数:39,代码来源:FolderBasedContentDirectory.java

示例4: browse

@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,代码行数:38,代码来源:FolderBasedContentDirectory.java

示例5: browse

@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,代码行数:41,代码来源:DispatchingContentDirectory.java

示例6: browse

@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,代码行数:53,代码来源:ContentDirectoryService.java

示例7: browse

@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,代码行数:54,代码来源:ContentDirectoryService.java

示例8: browse

@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,代码行数:43,代码来源:FolderBasedContentDirectory.java


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