如何在没有 IDE 的情况下构建和部署三星 SmartTV 应用程序(例如:在 Linux 上)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12766653/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to build & deploy a Samsung SmartTV app without the IDE (e.g: on Linux)
提问by David-SkyMesh
Problem:
问题:
I'd like to try building a proof-of-concept app using the Samsung SmartTV SDK 2.5 (I have a 2011 model TV - UA55D8000).
我想尝试使用 Samsung SmartTV SDK 2.5(我有一台 2011 型号的电视 - UA55D8000)构建一个概念验证应用程序。
Unfortunaltely, the SDK comes in two varieties that only seem to work on Microsoft Windows. It's weird because there's no reason it should be the case: the televisions themselves run Linux and applications are written in JavaScript.
不幸的是,SDK 有两种似乎只适用于 Microsoft Windows 的变体。这很奇怪,因为没有理由应该这样:电视本身运行 Linux,应用程序是用 JavaScript 编写的。
This presents two problems:
这带来了两个问题:
As I don't have Microsoft Windows at home, I can't use the build environment (nor the TV emulator) that come with the SDK. (The SDK files themselves are just JavaScript)
Even if I had access to Windows, it's very hard to automate building & testing of the Apps without access to traditional build tools (e.g: Make, Ant, Autotools, etc)
由于我家里没有 Microsoft Windows,因此我无法使用 SDK 附带的构建环境(也无法使用电视模拟器)。(SDK 文件本身只是 JavaScript)
即使我可以访问 Windows,也很难在不访问传统构建工具(例如:Make、Ant、Autotools 等)的情况下自动构建和测试应用程序
How can I build Samsung Smart TV Applications on Linux? (i.e: without using the Windows-based build tools that come with the SDK)
如何在 Linux 上构建三星智能电视应用程序?(即:不使用 SDK 附带的基于 Windows 的构建工具)
What I've figured out so far:
到目前为止我想出了什么:
From what I can gather, a JavaScript-mode application is simply zip file containing an XML config file, one or more JavaScript files (including supplied JavaScript interface libraries for platform SDK functions), and any required assets (HTML, images, etc).
据我所知,JavaScript 模式应用程序只是一个 zip 文件,其中包含一个 XML 配置文件、一个或多个 JavaScript 文件(包括为平台 SDK 功能提供的 JavaScript 接口库)和任何必需的资产(HTML、图像等)。
Also, from what I gather, deployment involves placing the zip file and an XML manifest file on a web-server network accessible to the TV, logging in as 'develop' on the TV and 'syncing' the application to the installed applications on the TV.
此外,据我所知,部署涉及将 zip 文件和 XML 清单文件放置在电视可访问的 Web 服务器网络上,在电视上以“开发”身份登录并将应用程序“同步”到已安装的应用程序上电视。
Could someone point me to a source for the full deployment requirements & app bundle requirements? Or even just a working sample?
有人可以指出我完整部署要求和应用程序包要求的来源吗?或者甚至只是一个工作样本?
采纳答案by Andy E
I've had a reasonable amount of success setting up a development environment on my Ubuntu machine and I'd like to share my methods here for anyone looking to do the same. This answer is intended to be platform independent, so the same advice should work on any fully fledged operating system.
我在我的 Ubuntu 机器上设置开发环境取得了相当大的成功,我想在这里分享我的方法给任何想要做同样事情的人。此答案旨在独立于平台,因此相同的建议应该适用于任何成熟的操作系统。
Introduction
介绍
First off, the question's assumptions regarding app structure are correct. A JavaScript application consists of the following items:
首先,问题对应用程序结构的假设是正确的。JavaScript 应用程序由以下项目组成:
- config.xml, a simple configuration file defining various settings and deployment information. See Writing the config.xml Fileon the official developer site.
- widget.info, a very small file with a few lines used to define the opacity of the application's body. This may not be required for full-screen applications.
- index.html, the main HTML file for your application.
- Images, sounds and other resources.
- config.xml,一个定义各种设置和部署信息的简单配置文件。请参阅官方开发人员站点上的编写 config.xml 文件。
- widget.info,一个非常小的文件,有几行用于定义应用程序主体的不透明度。对于全屏应用程序,这可能不是必需的。
- index.html,应用程序的主要 HTML 文件。
- 图像、声音和其他资源。
You can write these files using your favourite editor. I'm happily using vimwith linting plugins for my JS and CSS.
您可以使用您喜欢的编辑器编写这些文件。我很高兴在我的 JS 和 CSS 中使用带有 linting 插件的vim。
Testing
测试
As of version 4.0 of the SDK, a Linux version of the emulator is now available. This allows you to test your apps as they would appear on 2011-2013 TVs. For older TVs, you can run SDK 1.5's emulator in Wine, but emulators belonging to SDK 2.0 and newer will not run.
从 SDK 4.0 版开始,现在可以使用 Linux 版的模拟器。这使您可以像在 2011-2013 年的电视上一样测试您的应用程序。对于较旧的电视,您可以在 Wine 中运行 SDK 1.5 的模拟器,但属于 SDK 2.0 和更新版本的模拟器将无法运行。
It ispossible to run the emulators in a Windows virtual machine, and, with a little bit of trickery, you can make the emulators use your own application folder to look for apps. This involves sharing your development folders with your virtual machine, then creating a symbolic link to those folders, replacing the "apps" folder inside the SDK's installation directory. A quick overview of this process is available in an article titled, Your Windows IDE sucks? Replace it with Your Favorite Editor on the Mac!
它是可以运行在Windows虚拟机的仿真器,并与挂羊头卖狗肉的一点点,就可以使模拟器使用自己的应用程序文件夹,寻找应用程序。这涉及与虚拟机共享开发文件夹,然后创建指向这些文件夹的符号链接,替换 SDK 安装目录中的“apps”文件夹。标题为“您的 Windows IDE 很烂?在 Mac 上用您最喜欢的编辑器替换它!
Deployment
部署
Samsung Smart TVs have a built-in developer account that allows you to send an application over from your computer for live testing on the television itself. You enter the IP address of your deployment server and the TV will look for a file called widgetlist.xmlon that server. An example of the format is as follows:
三星智能电视有一个内置的开发者帐户,允许您从计算机发送应用程序以在电视上进行实时测试。您输入部署服务器的 IP 地址,电视将在该服务器上查找名为widgetlist.xml的文件。格式示例如下:
<?xml version="1.0" encoding="UTF-8"?>
<rsp stat="ok">
<list>
<widget id="MyTVApp">
<title>MyTVApp</title>
<compression size="3383543" type="zip"/>
<description>A basic application for Samsung TVs</description>
<download>http://192.168.1.83/Widget/MyTVApp_0.1_America_20120709.zip</download>
</widget>
</list>
</rsp>
After that, it will download each app listed using the URL in the <download>
tag. All you have to do is zip up the files, modify the widgetlist.xmlaccordingly and make sure both files are hosted in a web server running on your machine. You can use Apache, lighttpd or anything. I have a small node.js/connect app that will build the widgetlist.xmldynamically based on the zip files I have in a directory labelled deploy.
之后,它将使用<download>
标签中的 URL 下载列出的每个应用程序。您所要做的就是压缩文件,相应地修改widgetlist.xml并确保这两个文件都托管在您机器上运行的 Web 服务器中。你可以使用 Apache、lighttpd 或任何东西。我有一个小的 node.js/connect 应用程序,它将根据我在标签为deploy的目录中的 zip 文件动态构建widgetlist.xml。
So there you have it. Development of Samsung Smart TV apps is not impossible without Windows. In fact, there's quite a few options available. Hooray!
所以你有它。没有 Windows,三星智能电视应用程序的开发并非不可能。事实上,有很多可用的选项。万岁!
回答by arttronics
I've created this Answer for a topic that I know nothing about, but nevertheless I did spot something that threw a red flag in my direction... bountyor not.
我为一个我一无所知的主题创建了这个答案,但是我确实发现了一些向我的方向扔红旗的东西......赏金与否。
First, I looked at your WineHQ Bug Reportto see if this issue was resolved, but it's still pending as of this writing. I noticed that bug report had a reference link to the discussionwhich I clicked and followed.
首先,我查看了您的WineHQ 错误报告以查看此问题是否已解决,但在撰写本文时它仍然悬而未决。我注意到错误报告有一个指向我点击并关注的讨论的参考链接。
Looking at the machine-code generated dump-error
in that discussionproved informative.
望着machine-code generated dump-error
在这一讨论证明信息。
Reference:
参考:
Z:\home\andy.wine\drive_c\Program Files (x86)\Samsung\Samsung TV SDK(3.5.2)\Emulator\Emulator2012_v3.5\bin\Emulator2.exe
Z:\home\andy.wine\drive_c\Program Files (x86)\Samsung\Samsung TV SDK(3.5.2)\Emulator\Emulator2012_v3.5\bin\Emulator2.exe
The above Path
is the location of the file that caused the dump. That path is the red flag I mentioned.
以上Path
是导致转储的文件的位置。那条路就是我提到的红旗。
Let me back up a tiny bit and explain about what I learned about Windows XP SP3
and IE8
which very well may apply here, or you can skip down to the line with the bold text.
让我稍微备份一下并解释一下我学到的知识Windows XP SP3
以及IE8
哪些内容可以很好地应用于这里,或者您可以跳到带有粗体文本的行。
I worked on a webpage project that used a lightbox plugin called Shadowbox
. That project wasn't on a local server, just in a subfolder of a subfolder. It works fine in Firefox and Chrome but IE choked and didn't render any CSSfrom the plugins style sheet. Because I was very familiar with Shadowbox, I was 100% convinced it was not the plugin. So I started to think outside the box, and through trials and tribulationsI discovered the culprit was just the actual path!
我参与了一个网页项目,该项目使用了一个名为Shadowbox
. 该项目不在本地服务器上,只是在子文件夹的子文件夹中。它在 Firefox 和 Chrome 中运行良好,但 IE 阻塞并且没有从插件样式表中呈现任何 CSS。因为我对 Shadowbox 非常熟悉,所以我 100% 确信它不是插件。于是我开始跳出思维定势,历经磨难,我发现罪魁祸首就是真正的道路!
I had created a subfolderfor the project that used /test(v1)/
in the Path
and that's what broke IE8
. Once I removed the parentheses, the CSS was loaded correctly. This same solution was also the cause of a CSS issue for a forum member who used Vista and IE9
, so then it's conceivable these issues lie with Wine as well.
我创造了一个子文件夹为所使用的项目/test(v1)/
中Path
,这就是打破IE8
。一旦我删除了括号,CSS 就会正确加载。同样的解决方案也是使用 的论坛成员的 CSS 问题的原因Vista and IE9
,因此可以想象这些问题也存在于 Wine 中。
What issue is that? It's using illegal characters, the parentheses, in the path name. I will stop short and say the URL name only because it's the file path leading to the index.html
file (and only relative paths were used in coding - parentheses could not be escaped - and base tag failed).
那是什么问题?它在路径名中使用了非法字符,即括号。我将简短地说一下 URL 名称,因为它是指向index.html
文件的文件路径(并且在编码中只使用了相对路径 - 括号无法转义 - 并且基本标记失败)。
Firefox and Chrome were forgiving, but not IE. Even though you may not be using IE, it's possible that this issue extends outside of that.
Firefox 和 Chrome 是宽容的,但不是 IE。即使您可能没有使用 IE,这个问题也可能超出此范围。
My solution is not to use parentheses
or whitespaces
in any portion of your file path. While this may not solve this particular bug, at the very least you will not have sandbox Wine issues for when that file path
becomes a URL path
for whatever requirement (e.g., accessing a SWF object to be used as a video player). If IE browsers are unforgiving, so too can other embedded browsers or programing modules.
我的解决方案是不要在文件路径的任何部分使用parentheses
或whitespaces
。虽然这可能无法解决这个特定的错误,但至少当它file path
成为URL path
任何要求时(例如,访问要用作视频播放器的 SWF 对象),您不会遇到沙箱 Wine 问题。如果 IE 浏览器是无情的,那么其他嵌入式浏览器或编程模块也可以。
Recommended:
受到推崇的:
Z:\home\andy.wine\drive_c\Samsung\Samsung_TV SDK_3.5.2\Emulator\Emulator2012_v3.5\bin\Emulator2.exe
Z:\home\andy.wine\drive_c\Samsung\Samsung_TV SDK_3.5.2\Emulator\Emulator2012_v3.5\bin\Emulator2.exe
Notice the above does not use the Program Files (x86)
folder since that can't be changed per OS requirements. Having such a path will surely reduce, if not eliminate, any unforeseen errors. Cheers!
请注意,上述内容不使用该Program Files (x86)
文件夹,因为无法根据操作系统要求进行更改。拥有这样的路径肯定会减少(如果不能消除)任何不可预见的错误。干杯!
回答by yelmu
They have now released Smart TV SDK 4.0 which includes support for Linux & Mac OS X: http://www.samsungdforum.com/SamsungDForum/NewsView?newsID=27
他们现在发布了智能电视 SDK 4.0,其中包括对 Linux 和 Mac OS X 的支持:http: //www.samsungdforum.com/SamsungDForum/NewsView?newsID=27
"In addition to the Eclipse-based App Editor, a new Linux-based Emulator has been released.
This Emulator executes in an Ubuntu virtual machine that is run in the Virtual Box virtualization tool."
“除了基于 Eclipse 的应用程序编辑器之外,还发布了一个新的基于 Linux 的模拟器。
该模拟器在运行在 Virtual Box 虚拟化工具中的 Ubuntu 虚拟机中执行。”
■ Features for 2013 Platform on Linux (First Release)
■ Linux 上 2013 平台的功能(第一版)
- Apps Framework
- App Engine / WebKit
- UniPlayer
- SEF (Service Extension Framework)
- 应用程序框架
- 应用引擎/WebKit
- 单人播放器
- SEF(服务扩展框架)
You need to register to Samsung D forum and then you can download the SDK from https://www.samsungdforum.com/Devtools/SdkDownload
您需要注册到三星 D 论坛,然后您可以从https://www.samsungdforum.com/Devtools/SdkDownload下载 SDK
回答by Steve
One tip that I have not seen mentioned in any of the answers, is that the TV will attempt to open a socket connection on port 45634 of the machine where the app was downloaded from (the one with the widgetlist.xml).
我在任何答案中都没有提到的一个提示是,电视将尝试在下载应用程序的机器(带有 widgetlist.xml 的机器)的端口 45634 上打开套接字连接。
All debugging (alerts() calls), will be sent over this port, allowing for remote debugging.
所有调试(alerts() 调用)都将通过此端口发送,从而允许远程调试。
I use NetCat to open a port and dump all logs, like so:
我使用 NetCat 打开一个端口并转储所有日志,如下所示:
nc -l 45634
回答by Zach Nicoll
I know it's an old question, but since I'm delving into the process, I figured I'd share some links. Enjoy!
我知道这是一个老问题,但由于我正在深入研究这个过程,我想我会分享一些链接。享受!
Decent quick start guide on developing for the Smart TV platform: http://www.samsungdforum.com/Guide/c02/index.html.
为智能电视平台开发的不错的快速入门指南:http: //www.samsungdforum.com/Guide/c02/index.html。
These are the minimum project requirements and some example files: http://www.samsungdforum.com/Guide/art00011/index.html.
这些是最低项目要求和一些示例文件:http: //www.samsungdforum.com/Guide/art00011/index.html。
回答by yawl
For people who like doing everything with command line, smarttvjs (http://smarttvjs.org) has made it very easy:
对于喜欢用命令行做任何事情的人来说,smarttvjs ( http://smarttvjs.org) 让它变得非常简单:
- $smarttvjs init #create sample project
- ... do some development (IDE is nor required)
- $smarttvjs build samsung (create a package for samsung)
- $smarttvjs run samsung #launch simulator
- $smarttvjs init #创建示例项目
- ...做一些开发(IDE也不是必需的)
- $smarttvjs build samsung(为三星创建一个包)
- $smarttvjs 运行三星 #launch 模拟器