Skip to content

Commit

Permalink
refactor tvapps start
Browse files Browse the repository at this point in the history
  • Loading branch information
Jekso committed Feb 1, 2024
1 parent e7fd6b7 commit baa7cc6
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions android_tv_rc/android_tv_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def press_channel_number(self, channel_number: str):



def open_app(self, package: str, activity: str):
def open_app(self, app: AndroidTVApps):
"""
The function starts app with the specified package and activity.
Expand All @@ -195,47 +195,38 @@ def open_app(self, package: str, activity: str):
and try to interpret the output dump to extract the main launcher activity.
Args:
package (str): The package parameter is a string that represents the package name of the
Android application you want to start. This is typically the unique identifier for the app and
is specified in the AndroidManifest.xml file of the app.
activity (str): The "activity" parameter refers to the specific activity or screen within the
Android app that you want to start. An activity represents a single screen with a user
interface, and it is the basic building block of an Android app. Each activity has a unique name
that is specified in the AndroidManifest.xml file
app (AndroidTVApps): The app name in form of package/activity.
"""
package, activity = app.value.split('/')
self.__adb_client.start_app(package, activity)



def open_youtube(self):
"""Opens Youtube TV application"""
app = AndroidTVApps.YOUTUBE.value.split('/')
self.open_app(app[0], app[1])
self.open_app(AndroidTVApps.YOUTUBE)



def open_netflix(self):
"""Opens Netflix application"""
app = AndroidTVApps.NETFLIX.value.split('/')
self.open_app(app[0], app[1])
self.open_app(AndroidTVApps.NETFLIX)




def open_amazon_prime(self):
"""Opens Amazon Prime Video application"""
app = AndroidTVApps.AMAZON_PRIME.value.split('/')
self.open_app(app[0], app[1])
self.open_app(AndroidTVApps.AMAZON_PRIME)



def open_watch_it(self):
"""Opens Watch IT application"""
app = AndroidTVApps.WATCH_IT.value.split('/')
self.open_app(app[0], app[1])
self.open_app(AndroidTVApps.WATCH_IT)



def open_shahid(self):
"""Opens Shahid application"""
app = AndroidTVApps.SHAHID.value.split('/')
self.open_app(app[0], app[1])
self.open_app(AndroidTVApps.SHAHID)

0 comments on commit baa7cc6

Please sign in to comment.