Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify get_apps to return a more meaningful dictionary. #40

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion panasonic_viera/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import asyncio
import aiohttp.web
from http import HTTPStatus
import re
try:
from urllib.request import urlopen, Request, HTTPError, build_opener, HTTPHandler
except:
Expand Down Expand Up @@ -658,7 +659,13 @@ def get_apps(self):
res = self.soap_request(URL_CONTROL_NRC, URN_REMOTE_CONTROL,
'X_GetAppList', None)

return res
apps = res.split("vc_app")[1:]
app_list = {}
for app in apps:
prod_id = re.search('(?<=product_id\=)(.*?)(?=&apos;)', app).group(0)
name = re.search('(?<='+prod_id+'&apos;)(.*?)(?=&apos;)', app).group(0)
app_list[name] = prod_id
return app_list

def get_vector_info(self):
"""Return the vector info on the TV"""
Expand Down