Get all App IDs of all installed Apps on LG webOS TV - television

i am trying to get some information about LG webOS TVs. For some home automation i would need these two information. Maybe someone can tell me where I should look for that or how to get these information:
1) I would need all the app ids from all apps which are installed on the tv. I do have some already but not all of them.
2) I also would need all the button bindings of the remote. Same as for the app ids, i know a few but not all.
Please have a look at the codes. It would be really nice if someone can provide a list or tell me how to get these.
Thank you very much!
App ID list:
"com.webos.app.hdmi1" = "HDMI-1",
"com.webos.app.hdmi2" = "HDMI-2",
"com.webos.app.hdmi3" = "HDMI-3",
"com.webos.app.hdmi4" = "HDMI-4",
"com.webos.app.today" = "Heute",
"lovefilm.de" = "Amazon Prime Video",
"googleplaymovieswebos" = "Google Play Filme",
"youtube.leanback.v4" = "YouTube",
"com.webos.app.browser" = "Webbrowser",
"com.webos.app.connectionwizard" = "Geräteanschluss",
"com.webos.app.smartshare" = "SmartShare",
"com.webos.app.miracast" = "Screen Share",
"com.webos.app.notificationcenter" = "Benachrichtigungen",
"com.palm.app.settings" = "Einstellungen",
"com.webos.app.softwareupdate" = "Software-Update",
"de.2kit.castbrowserlg" = "TV Cast"]
"com.webos.app.livetv"="TV",
"com.webos.app.tvguide"="TV Guide",
"youtube.leanback.v4" = "Youtube",
"googleplay" = "googleplay"
Commands:
audioStatus
audioVolume
closeApp appid
getTVChannel
input3DOff
input3DOn
inputChannelDown
inputChannelUp
inputMediaFastForward
inputMediaPause
inputMediaPlay
inputMediaRewind
inputMediaStop
listApps
listChannels
listInputs
listServices
mute muted
notification message
off
on
openAppWithPayload payload
openBrowserAt url
openYoutubeId videoid
openYoutubeURL url
setInput input_id
setTVChannel channel
setVolume level
startApp appid
swInfo
volumeDown
volumeUp

Assuming you have a websocket port 3000 open on your TV, you can list apps using LGWebOSRemote:
$ lgtv listApps | jq '.payload.launchPoints[] | .id + ": " + .title'
"com.webos.app.hdmi3: HDMI 3 - PC"
"youtube.leanback.v4: YouTube"
... or simply run lgtv listApps for unfiltered JSON.
Tested on an LG UK6750PLD with webOS 4.1.0.
In the libraries i've seen, button codes were hard-coded as commands.

Related

Link content type to funtion on Telebot Python

I am building a Telegram Bot using telebot with python. I ask users to updload a picture, for which I created a command "foto". When they do /foto, I ask them to updload a content type "photo". However, they can upload pictures regardless of the command; they just click on upload a picture and that's it. How can I link the "upoload photo" to the command, so that they can only upload a picture after writing "/foto"?
#bot.message_handler(commands=['foto']) def send_welcome(message,
chat_id):
chat_id = message.chat.id
send = bot.send_message(message.from_user.id, 'Subí tu foto.')
bot.register_next_step_handler(send, photo())
return
#bot.message_handler(content_types=["photo"]) def photo(message):
fileID = message.photo[-1].file_id
logger.info("User_id, fileID", message.from_user.id, fileID)
file_info = bot.get_file(fileID)
#print('file.file_path =', file_info.file_path)
downloaded_file = bot.download_file(file_info.file_path)
with open(f"./images/{fileID}.jpg", 'wb') as new_file:
new_file.write(downloaded_file)
send = bot.send_message(message.from_user.id, 'Foto recibida, gracias!')
As far as i know you cant restrict users from sending files
what you can do is to capture the files only after the command is used
for more info please read docs

What is a correct way to obtain FOnlineSubsystemSteam instance in c++ code

I'm trying to get steam app id and steam user id in my Unreal Engine 4 project in the following way:
if (SteamAPI_Init())
{
IOnlineSubsystem* ossBase = IOnlineSubsystem::Get();
FOnlineSubsystemSteam* oss = Cast<FOnlineSubsystemSteam*>(ossBase);
if (!oss) {
printText(TEXT("Steam Subsystem is down!"), FColor::Red.WithAlpha(255));
return;
}
auto SteamID = FString(std::to_string(SteamUser()->GetSteamID().ConvertToUint64()).c_str());
auto AppID = FString(std::to_string(oss->GetSteamAppId()).c_str());
But it is not possible to convert IOnlineSubsystem to FOnlineSubsystemSteam. So what is a correct way to obtain the instance of FOnlineSubsystemSteam?
The solution is to use static_cast:
FOnlineSubsystemSteam* oss = static_cast<FOnlineSubsystemSteam*>(ossBase);
This one works. It seems obvious to use UE4 Cast, but in this case it does not work.

How to mail a screen captured image using corona SDK

I am new to corona SDK, but I've managed to capture my app scene using the following code:
local function captureArea()
local myCaptureImage = display.captureBounds(display.currentStage.contentBounds, true)
myCaptureImage:removeSelf()
myCaptureImage = nil
end
bg:addEventListener("tap",captureArea)
This works perfectly.
Now I need to send the captured image(with a specific name, say: screen_1.png) to my friend via email. I've used Composing E-mail and SMS for refference, but I fail to understand how I can add this saved image in the attachment field of mail options.
Please give me a proper solution that how can I attach and send the above saved image via email.
display.captureBounds is good for saving the whole screen to the directory. But it usually saves the file with increase in last index. So it may be difficult to read them correctly. So I prefer display.save. But it is not a straight way.
For doing this, you have to:
First create a localgroup.
Then add the screen objects to that group.
Return the display group
Use display.save to save the entire group displayed.
Create mail option and add attachment image from baseDirectory
Call mail Popup
I am giving a sample here:
-- creating the display group --
local localGroup = display.newGroup()
-- creating display objects and adding it to the group --
local bg = display.newRect(0,0,_w,_h)
bg.x = 160
bg.y = 240
bg:setFillColor(150)
localGroup:insert(bg)
local rect = display.newRect(0,0,50,50)
rect.x = 30+math.random(260)
rect.y = 30+math.random(420)
localGroup:insert(rect)
-- Then do as follows --
local function takePhoto_andSendMail()
-- take screen shot to baseDirectory --
local baseDir = system.DocumentsDirectory
display.save( localGroup, "myScreenshot.jpg", baseDir )
-- Create mail options --
local options =
{
to = { "krishnarajsalim#gmail.com",},
subject = "My Level",
body = "Add this...",
attachment =
{
{ baseDir=system.DocumentsDirectory, filename="myScreenshot.jpg", type="image" },
},
}
-- Send mail --
native.showPopup("mail", options)
end
rect:addEventListener("tap",takePhoto_andSendMail)
This will do it...
Keep coding........ :)

Zend Implementing SEO friendly or vanity URLs with router

I have a simple e-commerce web application with product URL's like:
http://www.example.com/product/view/product_id/15
where "Product" is the controller and "view" is the action in the Product Controller
How do I change this URL to show up as:
http://www.example.com/product/view/product_name/iphone-4S-16-gb
where product_id "15" is the primary key in the product table and product_name has the value "iphone 4s 16 gb" without the hyphens
What is the simplest way for me to make this change.
Would really appreciate your help.
Thanks a lot.
resources.router.routes.view-article.type = "Zend_Controller_Router_Route_Regex"
resources.router.routes.view-article.route = "articles/(?!archive)([a-zA-Z\-]+)/(\d+)(?:/(.*))?"
resources.router.routes.view-article.reverse = "articles/%s/%d/%s"
resources.router.routes.view-article.defaults.module = "articles"
resources.router.routes.view-article.defaults.controller = "view"
resources.router.routes.view-article.defaults.action = "view-article"
resources.router.routes.view-article.map.1 = topicSlug
resources.router.routes.view-article.defaults.topicSlug = topicSlug
resources.router.routes.view-article.map.2 = id
resources.router.routes.view-article.defaults.id = 0
resources.router.routes.view-article.map.3 = articleSlug
resources.router.routes.view-article.defaults.articleSlug = articleSlug
links like http://example.com/articles/circus/616/4-marta-vse-za-ruletkami
http://example.com/products/category/product_id/product_name
EDIT 1
this is a setup for default router plugin. shown as articles from my blog module, but easily updates for shop.
parts - http://example.com/ is host :) articles/circus/ => module and controller mapeed.
resources.router.routes.view-article.map.1 = topicSlug is a category. for shop.
616/4-marta-vse-za-ruletkami ID and any slug. product description, for example, 'iphone-4S-16-gb
'
defaults are in config.
another example /{maps2module}/{maps2topicSlug}/{maps2id}/{maps2articleSlug}

Push Notification showing localization constant instead of message

I have a serious problem I have not found any questions about on the net. When I push a localized message it only works for Swedish and not English. I have another that says that it only shows a constant for their Swedish Iphone 4. I have also tested on Iphone 3g and it has the same problem as my iphone 4, works in swedish not in english.
When displaying a popup for Iphone 4 in English, I only get the localization key I supply in my notification from the server.
Here is the string of the notification in C# that I push from a Windows Server. The extra parameters for my iphone app works totally fine in any language so it seems it has nothing to do with the server side part of the push.
int total = notification.AmountScheduledEvent + notification.AmountCourseResult + notification.AmountExam;
string locKey = (total > 1 ? "PushMessageMultiple" : "PushMessageSingle");
string msg = "{\"aps\":{"+
"\"alert\": {"+
"\"loc-key\":\"" + locKey + "\","+
"\"loc-args\":[\"" + total + "\"]},"+
"\"badge\":" + total + ","+
"\"sound\":\"default\"},"+
"\"amountSchedule\":" + notification.AmountScheduledEvent + ","+
"\"amountCourseResult\":" + notification.AmountCourseResult + ","+
"\"amountExam\":" + notification.AmountExam + "}";
In my Localizable.strings in sv.lproj:
/* push stuff */
"PushMessageMultiple" = "%# nya händelser";
"PushMessageSingle" = "1 ny händelse";
In my Localizable.strings in en.lproj:
/* push stuff */
"PushMessageMultiple" = "%# new events";
"PushMessageSingle" = "1 new event";
Here is a picture of the screen with a notification that works (Swedish)
http://img267.imageshack.us/i/img0014b.png/
Here is a picture of the screen with a notification that doesn't work (English)
http://img696.imageshack.us/i/img0015i.png/
Any idea why I get a constant instead of a message?
Try to use:
NSLocalizedString(#"PushMessageMultiple",#"");
This will dynamicaly get the correct string.