as

Settings
Sign out
Notifications
Alexa
亚马逊应用商店
AWS
文档
Support
Contact Us
My Cases
开发
测试
应用发布
盈利
用户参与
设备规格
资源

Example Recipe Configuration for XML iTunes Feed

Example Recipe Configuration for XML iTunes Feed

This example shows a recipe configuration for a feed that conforms to the iTunes RSS tags specification.

Feed:

https://amzndevresources.com/fire-app-builder/feeds/feed1.xml

Category recipe:

{
  "cooker": "DynamicParser",
  "format": "xml",
  "model": "com.amazon.android.model.content.ContentContainer",
  "translator": "ContentContainerTranslator",
  "modelType": "array",
  "query": "/rss/channel/item//*[name()='itunes:category']",
  "queryResultType": "[]$",
  "matchList": [
    "#attributes/text@mName"
  ],
  "keyDataType":"#attributes/text@keyDataPath"
}

Contents recipe:

{
  "cooker": "DynamicParser",
  "format": "xml",
  "model": "com.amazon.android.model.content.Content",
  "translator": "ContentTranslator",
  "modelType": "array",
  "query": "//item[./*[name()='itunes:category'][@text='$$par0$$']]",
  "matchList": [
    "title/#text@mTitle",
    "guid/#text@mId",
    "description/#text@mDescription",
    "enclosure/#attributes/url@mUrl",
    "itunes:image/#attributes/href@mCardImageUrl",
    "itunes:image/#attributes/href@mBackgroundImageUrl"
  ]
}

BasicFileBasedUrlGeneratorConfig.json:

{
  "url_file": "urlFile_xmlfeed1.json"
}

urlFile_xmlfeed1.json

{
  "urls": [
    "https://amzndevresources.com/fire-app-builder/feeds/feed1.xml"
  ]
}

Navigator.java

...
public static final String NAVIGATOR_FILE = "Navigator_xmlfeed1.json";
...

Navigator_xmlfeed1.json

{
  "config": {
    "showRelatedContent": true,
    "useCategoryAsDefaultRelatedContent": true,
    "searchAlgo": "basic",
    "enableCEA608": false,
    "enableRecentRow": true,
    "maxNumberOfRecentItems": 5
  },
  "branding": {
    "globalTheme": "AppTheme",
    "lightFont" : "Roboto Light",
    "boldFont" : "Roboto Bold",
    "regularFont" : "Roboto Regular"
  },
  "globalRecipes": [
    {
      "categories": {
        "dataLoader": "recipes/xmlfeed1_DataLoaderRecipe0.json",
        "dynamicParser": "recipes/xmlfeed1_CategoriesRecipe.json"
      },
      "contents": {
        "dataLoader": "recipes/xmlfeed1_DataLoaderRecipe0.json",
        "dynamicParser": "recipes/xmlfeed1_ContentsRecipe.json"
      }
    }
  ],
  "graph": {
    "com.amazon.android.tv.tenfoot.ui.activities.SplashActivity": {
      "verifyScreenAccess": false,
      "verifyNetworkConnection": true,
      "onAction": "CONTENT_SPLASH_SCREEN"
    },
    "com.amazon.android.tv.tenfoot.ui.activities.ContentBrowseActivity": {
      "verifyScreenAccess": false,
      "verifyNetworkConnection": true,
      "onAction": "CONTENT_HOME_SCREEN"
    },
    "com.amazon.android.tv.tenfoot.ui.activities.ContentDetailsActivity": {
      "verifyScreenAccess": false,
      "verifyNetworkConnection": true,
      "onAction": "CONTENT_DETAILS_SCREEN"
    },
    "com.amazon.android.tv.tenfoot.ui.activities.ContentSearchActivity": {
      "verifyScreenAccess": false,
      "verifyNetworkConnection": true,
      "onAction": "CONTENT_SEARCH_SCREEN"
    },
    "com.amazon.android.uamp.ui.PlaybackActivity": {
      "verifyScreenAccess": false,
      "verifyNetworkConnection": true,
      "onAction": "CONTENT_RENDERER_SCREEN"
    }
  }
}

xmlfeed1_DataLoaderRecipe0.json

{
  "task": "load_data",
  "url_generator": {
    "url_index": "0"
  }
}

Last updated: 2018年8月3日