Esempio n. 1
0
    def run(self):
        ipaddr = self.parseargs().ipaddr

        # If IP not specified, use Roku discovery and let user choose
        if ipaddr:
            self.roku = Roku(ipaddr)
        else:
            self.roku = discover_roku()

        if not self.roku:
            return

        print(usage_menu)

        cmd_func_map = {
            ';': self.roku.back,
            'u': self.roku.back,
            'b': self.roku.back,
            'KEY_DELETE': self.roku.back,
            'g': self.roku.home,
            'G': self.roku.home,
            'h': self.roku.left,
            'KEY_LEFT': self.roku.left,
            'j': self.roku.down,
            'KEY_DOWN': self.roku.down,
            'k': self.roku.up,
            'KEY_UP': self.roku.up,
            'l': self.roku.right,
            'KEY_RIGHT': self.roku.right,
            'o': self.roku.select,
            'KEY_ENTER': self.roku.select,
            'i': self.roku.replay,
            'R': self.roku.replay,
            'm': self.roku.info,
            's': self.roku.info,
            'r': self.roku.reverse,
            'H': self.roku.reverse,
            'f': self.roku.forward,
            'L': self.roku.forward,
            'p': self.roku.play,
            ' ': self.roku.play,
            '/': self.text_entry
        }

        # Main interactive loop
        with self.term.cbreak():
            val = ''
            while val.lower() != 'q':
                val = self.term.inkey()
                if not val:
                    continue
                if val.is_sequence:
                    val = val.name
                if val in cmd_func_map:
                    try:
                        cmd_func_map[val]()
                    except:
                        print('Unable to communicate with roku at ' +
                              str(self.roku.host) + ':' + str(self.roku.port))
                        sys.exit(1)
 def setUp(self):
     self.roku = Mock(Roku('127.0.0.1'))
     self.roku.left = Mock()
     self.roku.right = Mock()
     self.roku.up = Mock()
     self.roku.down = Mock()
     self.roku.select = Mock()
     self.yt = YouTubeKeyboardController(self.roku, 'A')
Esempio n. 3
0
    def __init__(self, host):
        """Initialize the Roku device."""
        from roku import Roku

        self.roku = Roku(host)
        self.ip_address = host
        self.channels = []
        self.current_app = None
        self._device_info = {}
Esempio n. 4
0
def get_roku_data(host: str) -> dict:
    """Retrieve a Roku instance and version info for the device."""
    roku = Roku(host)
    roku_device_info = roku.device_info

    return {
        DATA_CLIENT: roku,
        DATA_DEVICE_INFO: roku_device_info,
    }
Esempio n. 5
0
    def __init__(self, host):
        """Initialize the Roku device."""

        self.roku = Roku(host)
        self.ip_address = host
        self.channels = []
        self.current_app = None
        self._device_info = {}
        self._power_state = "Unknown"
def main():
    # Locate the roku device
    printing("Finding roku device ...")
    rokus = Roku.discover()
    printing("Done finding roku device ...")

    # IF no devices found ...
    if len(rokus) == 0:
        print("No rokus found")
        sys.exit(-1)
    # Otherwise, get the ip and port of the device
    else:
        roku_ip_address = rokus[0].host
        roku_port = rokus[0].port

    # Setup API object to make requests to the roku device
    print("Connecting ...")
    roku = Roku(host=roku_ip_address, port=roku_port)
    print("Done connecting ...")

    # Find youtube app
    print("Finding youtube app ...")
    youtube_app = [a for a in roku.apps if 'youtube' in a.name.lower()][0]
    print("Done finding youtube app ...")

    # Wait for the app to start
    print("Starting youtube app ...")
    APP_LAUNCH_TIMEOUT = 15
    youtube_app.launch()
    time.sleep(APP_LAUNCH_TIMEOUT)
    print("Done starting youtube app ...")

    # Series of remote clicks to get to youtube Watch Later playlist
    # TODO: sleeps may not be needed
    roku.left()
    time.sleep(1)
    roku.left()
    time.sleep(1)
    roku.down()
    time.sleep(1)
    roku.down()
    time.sleep(1)
    roku.right()
    time.sleep(1)
    roku.down()
    time.sleep(1)
    roku.down()
    time.sleep(1)
    roku.right()
    time.sleep(1)
    roku.select()
Esempio n. 7
0
def _setup_roku(hass, hass_config, roku_config):
    """Set up a Roku."""

    host = roku_config[CONF_HOST]

    if host in hass.data[DATA_ROKU]:
        return

    roku = Roku(host)
    r_info = roku.device_info

    hass.data[DATA_ROKU][host] = {ATTR_ROKU: r_info.serial_num}

    discovery.load_platform(hass, "media_player", DOMAIN, roku_config,
                            hass_config)

    discovery.load_platform(hass, "remote", DOMAIN, roku_config, hass_config)
Esempio n. 8
0
    def set_power_state(self, power):
        if self.device_type in [self.PLUG, self.BULB]:
            device = (SmartPlug(self.ip) if self.device_type in [self.PLUG]
                      else SmartBulb(self.ip))

            if power:
                asyncio.run(device.turn_on())
            else:
                asyncio.run(device.turn_off())

            asyncio.run(device.update())

        elif self.device_type in [self.PI, self.LINUX]:
            stdin = b''
            stdout = b''
            stderr = b''
            if not power:
                client = SSHClient()
                client.set_missing_host_key_policy(AutoAddPolicy())
                client.connect(self.ip,
                               port=22,
                               username=self.username,
                               password=self.password)
                stdin_model, stdout_model, stderr_model = client.exec_command(
                    'sudo -S shutdown -h now')
                stdin_model.write('%s\n' % self.password)
                stderr_model.flush()
                # print the results

                if stdin_model.readable():
                    stdin = stdin_model.read()
                if stdout_model.readable():
                    stdout = stdout_model.read()
                if stderr_model.readable():
                    stderr = stderr_model.read()

                client.close()

                return (stdin, stdout, stderr)

        elif self.device_type in [self.ROKU]:
            roku = Roku(self.ip)
            roku.select()
        return (None, None, None)
Esempio n. 9
0
    def roku(self, request, pk=None):
        device = self.get_object()
        roku = Roku(device.ip)

        command = request.data.get('command', None)
        argument = request.data.get('argument', None)

        if command:
            method_to_call = getattr(roku, command)

            if argument:
                method_to_call(argument)
            else:
                method_to_call()

            return Response({}, status=status.HTTP_200_OK)
        else:
            return Response({'message': 'Please submit a command'},
                            status=status.HTTP_400_BAD_REQUEST)
Esempio n. 10
0
def validate_input(data: Dict) -> Dict:
    """Validate the user input allows us to connect.

    Data has the keys from DATA_SCHEMA with values provided by the user.
    """

    try:
        roku = Roku(data["host"])
        device_info = roku.device_info
    except (SocketGIAError, RequestException, RokuException) as exception:
        raise CannotConnect from exception
    except Exception as exception:  # pylint: disable=broad-except
        raise UnknownError from exception

    return {
        "title": data["host"],
        "host": data["host"],
        "serial_num": device_info.serial_num,
    }
Esempio n. 11
0
def launch_app(server_ip: str,
               app_name: str = 'Plex - Free Movies & TV') -> None:
    """Launches the plex app in Roku tv. Powers on roku if it is not on.
    Waits for 3 seconds before returning as it takes some time to 
    launch the app in tv

    Args:
        server_ip (str): IP of the roku tv/stick
        app_name (str, optional): application to launch. Defaults to 'Plex - Stream for Free'.
    """
    logging.info(f'Connecting to Roku server {server_ip}')
    roku = Roku(server_ip)
    current_app = roku.current_app.name
    logging.info(f'current app is {current_app}')
    if current_app != app_name:
        plex = roku[app_name]
        logging.info(f'Launching app {app_name}')
        plex.launch()
    else:
        logging.info(f'The app is already {app_name}')
Esempio n. 12
0
def roku(bot, event, *args):
    try:
        # https://pypi.python.org/pypi/roku/1.0
        admins_list = bot.get_config_suboption(event.conv_id, 'admins') or []
        if event.user_id.chat_id in admins_list:
            ip = bot.user_memory_get(event.user.id_.chat_id, 'roku')
            if ip is None:
                rokuControl = Roku.discover(timeout=10)[0]
                bot.user_memory_set(event.user.id_.chat_id, 'roku', rokuControl.host)
                ip = rokuControl.host
            
            rokuControl = Roku(ip)
            
            
            command = {'up' : rokuControl.up,
                       'down' : rokuControl.down,
                       'left' : rokuControl.left,
                       'right' : rokuControl.right,
                       'select' : rokuControl.select,
                       'home' : rokuControl.home,
                       'back' : rokuControl.back,
                       'play' : rokuControl.play
                       
                       }
            arg = args[0]
            if arg in command:
                command[args[0].lower()]()
            else:
                rokuControl[arg].launch()
            return
        else:
            html_text = "You can't control my roku, you so crazy"
    except:
        html_text = "Unable to control the roku right now"
        logger.exception(html_text)

    yield from bot.coro_send_message(event.conv_id, html_text)
Esempio n. 13
0
from roku import Roku
import time

r = Roku('192.168.1.103')

r.home()
time.sleep(2)
ps_vue = r[93374]
ps_vue.launch()
time.sleep(7)
r.down()
r.select()
time.sleep(8)
r.down()
r.down()
r.down()
r.down()
time.sleep(4)
r.select()
time.sleep(3)
r.select()
Esempio n. 14
0
import discord
from discord.ext import commands
from roku import Roku

roku = Roku("Roku_IP")

bot = commands.Bot(command_prefix='$',
                   status=discord.Status.online,
                   activity=discord.Game('With Roku!'))


@bot.command()
async def home(ctx):
    roku.home()
    await ctx.send('***Command has been sent!***')


@bot.command()
async def stop(ctx):
    await ctx.send('*Stopping* :wave:')
    await bot.logout()


@bot.command()
async def down(ctx):
    roku.down()
    await ctx.send('***Command has been sent!***')


@bot.command()
async def up(ctx):
Esempio n. 15
0
#!/usr/bin/env python3

from roku import Roku
import ssdp
import os

roku = Roku('192.168.11.103')
netflix = roku['Netflix']
plex = roku['Plex']
primevideo = roku['Prime Video']

print('...')

while True:
    actions = input()
    # up
    if(actions == "u"):
        roku.up()
    # down
    elif(actions == "d"):
        roku.down()
    # home
    elif(actions == "h"):
        roku.home()
    # left
    elif(actions == "l"):
        roku.left()
    # right
    elif(actions == "r"):
        roku.right()
    # select
Esempio n. 16
0
 def __init__(self):
     self.roku = Roku(secrets.rokuIP)
Esempio n. 17
0
#!/usr/bin/env python
from roku import Roku
import sys
import os
import subprocess
tmppath = os.path.abspath(
    os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
                 'tmp'))
try:
    os.stat(tmppath)
except:
    os.mkdir(tmppath)
retour = ''
roku = Roku(sys.argv[1])
listapps = roku.apps
for app in listapps:
    retour += app.name + '||' + 'channel' + app.id + ';'
    appli = roku[app.id]
    iconfile = os.path.join(tmppath, app.id + '.png')
    with open(iconfile, 'w') as f:
        f.write(appli.icon)
subprocess.call(['chmod', '-R', '777', tmppath])
print retour[:-1].encode('utf-8')
Esempio n. 18
0
# https://github.com/jcarbaugh/python-roku
import time

from roku import Roku

roku = Roku('192.168.1.214')

roku.poweroff()
Esempio n. 19
0
    def __init__(self, host):
        """Initialize the Roku device."""
        from roku import Roku

        self.roku = Roku(host)
        self.update()
Esempio n. 20
0
    def __init__(self, host):
        """Initialize the Roku device."""

        self.roku = Roku(host)
        self._device_info = {}
Esempio n. 21
0
#Required packages: roku - https://pypi.python.org/pypi/roku
import time
import datetime
import os
from roku import Roku
import json

#Variables
tvIpAddress = '##IP ADDRESS OF TV##'
buttonObjectFilePath = '/home/pi/aws-iot-roku-tv-control/buttonclicktype'
rokutv = Roku(tvIpAddress)
AVinput = rokutv['AV']
HDMITVinput = rokutv['tvinput.hdmi1']

#Give Node-RED enough time to write to buttonclicktype file
time.sleep(.25)

#If it’s a single button click, change the TV input to AV
#If it’s a long button click, change the TV input to HDMI 1
#If it’s a double button click, turn off the TV
buttonClickJSON = open(buttonObjectFilePath)
buttonClickData = json.load(buttonClickJSON)
buttonClickType = buttonClickData["clickType"]
buttonClickJSON.close()

if buttonClickType == 'SINGLE':
	AVinput.launch()
	print str(datetime.datetime.now()) + ": Changing TV Input to AV"
elif buttonClickType == 'LONG':
	HDMITVinput.launch()
	print str(datetime.datetime.now()) + ": Changing TV Input to HDMI 1"
Esempio n. 22
0
 def __init__(self, ro_ip):
     self.ro_ip = ro_ip
     self.roku = Roku(self.ro_ip)
Esempio n. 23
0
def roku_command(remote_command):
    delay = 1

    #connect to roku
    #enter your rokus ip address to test
    roku = Roku('192.168.0.110')

    #remote command is place holder for list of commands from remote to dashboard
    #remote_command=['triangle']

    #if circle shape is registered on remote than launch the most recent episode of a users favorite show.
    #In this case Silicon Valley.
    for i in remote_command:
        if i == 'circle':

            for light in lights:
                light.brightness = 254
                light.xy = [.1, .1]

            hbo = roku["HBO GO"]
            hbo.launch()

            sleep(6 * delay)

            roku.down()
            sleep(delay)

            roku.right()
            sleep(delay)

            roku.right()
            sleep(delay)

            roku.select()
            sleep(3 * delay)

            roku.select()
            sleep(2 * delay)

            roku.select()
            sleep(delay)
            #            roku.up()
            #            sleep(delay)

            #            roku.left()
            #            sleep(delay)

            #            roku.down()
            #            sleep(delay)

            #            roku.left()
            #            sleep(delay)

            #            roku.select()
            #            sleep(2*delay)

            #            roku.right()
            #            sleep(delay)

            #            roku.select()
            #            sleep(2*delay)

            #            roku.select()
            #            sleep(2*delay)

            for light in lights:
                light.brightness = 100

        if i == "left_swipe":
            #move cursor left
            roku.left()

        if i == "up_swipe":
            roku.up()

        if i == "down_swipe":
            roku.down()

        if i == "right_swipe":
            #move curser right
            roku.right()

        if i == "triangle":
            print "test"
            b.set_light([2, 3], 'on', True)

            # Prints if light 1 is on or not
            b.get_light(2, 'on')

            # Set brightness of lamp 1 to max
            b.set_light(2, 'bri', 254)

            # Set brightness of lamp 2 to 50%
            b.set_light(3, 'bri', 254)

            for light in lights:
                light.brightness = 254
                light.xy = [.9, .7]
        #enter search commands
            roku.search()

        if i == "square":
            roku.info()

        if i == 'quad_diagonal_1':
            b.set_light(1, 'on', False)

    return True
Esempio n. 24
0
#!/usr/bin/python3.6 python3
from    roku import Roku
import  time


roku = Roku('192.168.1.107')

app = next((a for a in roku.apps if 'plex' in a.name.lower()), None)
if app:
    app.launch()
    time.sleep(20)
    for i in range(100):
        roku.volume_down()
    for i in range(14):
        roku.volume_up()
    roku.down()
    time.sleep(2)
    roku.select()
    time.sleep(2)
    roku.up()
    time.sleep(1)
    roku.up()
    time.sleep(1)
    roku.right()
    time.sleep(1)
    roku.right()
    time.sleep(1)
    roku.select()
    time.sleep(1)
    roku.down()
    time.sleep(1)
Esempio n. 25
0
from appJar import gui
from roku import Roku
from pynput import keyboard
from pynput.keyboard import Key
import threading

roku = Roku('192.168.1.5')

def press(button):
    if button == "Home":
        roku.home()
    elif button == "Go to Search":
        roku.search()
    elif button == "Back":
        roku.back()
    elif button == "OK":
        roku.select()
    elif button == "Settings":
        roku.home()
        roku.down()
        roku.down()
        roku.down()
        roku.down()
        roku.down()
        roku.down()
        roku.down()
        roku.down()
        roku.select()
    elif button == "Submit":
        userInput = app.getEntry("Send text:")
        roku.literal(userInput)
from roku import Roku
import threading
import time

roku = Roku('192.168.0.132')


def Change_to_ABC():
    '''Switches display to the mode entered as an argument. Works for PC and TV mode.'''
    def Callback():
        print('Switching to ABC')
        youtube = roku['YouTube TV']
        youtube.launch()
        time.sleep(10)
        roku.right()
        time.sleep(1)
        for _ in range(2):
            roku.down()
            time.sleep(.5)
        roku.enter()
        if 'YouTube TV' in str(roku.active_app):
            print('Success')
        else:
            input('Roku Failed to switch to ABC on Youtube TV.')

    ABC = threading.Thread(target=Callback)
    ABC.start()


def Check_If_Youtube_TV(obj):
    '''Set Scene Function.
Esempio n. 27
0
#!/usr/bin/env python

from settings import ROKU_IP
from roku import Roku
import sys
import argparse

roku = Roku(ROKU_IP)


def handle_args():
    parser = argparse.ArgumentParser(
        description='Press the given button on the roku remote.')
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('command', nargs='?', help='the command to run')
    group.add_argument('-c',
                       '--commands',
                       action='store_true',
                       help='list the available commands')
    parser.add_argument('-r',
                        '--repeat',
                        metavar='n',
                        type=int,
                        default=1,
                        help='repeat the command n times')
    return parser.parse_args()


def main():
    args = handle_args()
    if args.commands:
Esempio n. 28
0
    def __init__(self, master, *args, **kwargs):
        super().__init__(master, *args, **kwargs)
        self.master = master

        settings = self.master.settings
        font = settings['font']

        text = settings['colors']['text']
        light = settings['colors']['light']
        dark = settings['colors']['dark']
        power = settings['colors']['power']
        app = settings['colors']['app']

        size = 20

        flat = {
            'relief': 'solid',
            'bd': 1,
            'activebackground': '#ffffff',
            'activeforeground': '#ffffff'
        }
        font = {**flat, 'font': [font, size], 'fg': text, 'bg': dark}
        arrow = {**flat, 'font': [font, size], 'fg': text, 'bg': light}
        app = {**flat, 'font': [font, size], 'fg': text, 'bg': app}
        power = {**flat, 'font': [font, 30], 'fg': text, 'bg': power}

        def set_active_bg(f):
            f['activebackground'] = f['bg']

        [set_active_bg(f) for f in [font, arrow, app, power]]

        self.roku = Roku('192.168.1.144')

        self.master.title('Roku Remote')

        self.pack(fill=tk.BOTH, expand=True)

        config_grids(self, rows=[1, 1, 1, 1, 1, 1], columns=[1, 1, 1, 1])

        self.restart_flag = False

        self.back_button = tk.Button(self,
                                     **font,
                                     text=u'\u2B60',
                                     command=self.roku.back)
        self.back_button.grid(row=0, column=1, sticky='nsew')

        self.up_button = tk.Button(self,
                                   **arrow,
                                   text=u'\u2B9D',
                                   command=self.roku.up)
        self.up_button.grid(row=0, column=2, sticky='nsew')

        self.home_button = tk.Button(self,
                                     **font,
                                     text=u'\u2302',
                                     command=self.roku.home)
        self.home_button.grid(row=0, column=3, sticky='nsew')

        self.left_button = tk.Button(self,
                                     **arrow,
                                     text=u'\u2B9C',
                                     command=self.roku.left)
        self.left_button.grid(row=1, column=1, sticky='nsew')

        self.select_button = tk.Button(self,
                                       **arrow,
                                       text='OK',
                                       command=self.roku.select)
        self.select_button.grid(row=1, column=2, sticky='nsew')

        self.right_button = tk.Button(self,
                                      **arrow,
                                      text=u'\u2B9E',
                                      command=self.roku.right)
        self.right_button.grid(row=1, column=3, sticky='nsew')

        self.replay_button = tk.Button(self,
                                       **font,
                                       text=u'\u27F2',
                                       command=self.roku.replay)
        self.replay_button.grid(row=2, column=1, sticky='nsew')

        self.down_button = tk.Button(self,
                                     **arrow,
                                     text=u'\u2B9F',
                                     command=self.roku.down)
        self.down_button.grid(row=2, column=2, sticky='nsew')

        self.options_button = tk.Button(self,
                                        **font,
                                        text=u'\u273C',
                                        command=self.roku.info)
        self.options_button.grid(row=2, column=3, sticky='nsew')

        self.rewind_button = tk.Button(self,
                                       **font,
                                       text=u'\u23EA',
                                       command=self.roku.reverse)
        self.rewind_button.grid(row=3, column=1, sticky='nsew')

        self.pause_play_button = tk.Button(self,
                                           **font,
                                           text=u'\u25B6\u2758\u2758',
                                           command=self.roku.play)
        self.pause_play_button.grid(row=3, column=2, sticky='nsew')

        self.fast_forward_button = tk.Button(self,
                                             **font,
                                             text=u'\u23E9',
                                             command=self.roku.forward)
        self.fast_forward_button.grid(row=3, column=3, sticky='nsew')

        self.volume_mute_button = tk.Button(self,
                                            **font,
                                            text='MUTE',
                                            command=self.roku.volume_mute,
                                            width=20)
        self.volume_mute_button.grid(row=4, column=1, sticky='nsew')

        self.volume_down_button = tk.Button(self,
                                            **font,
                                            text='VOL-',
                                            command=self.roku.volume_down,
                                            width=20)
        self.volume_down_button.grid(row=4, column=2, sticky='nsew')

        self.volume_up_button = tk.Button(self,
                                          **font,
                                          text='VOL+',
                                          command=self.roku.volume_up,
                                          width=20)
        self.volume_up_button.grid(row=4, column=3, sticky='nsew')

        self.search_button = tk.Button(self,
                                       **font,
                                       text=u'\u2315',
                                       command=self.roku.search,
                                       width=20)
        self.search_button.grid(row=5, column=0, sticky='nsew')

        self.search_var = tk.StringVar()
        self.previous_text = ''
        self.search_var.trace('w', self.send_text)

        self.search_frame = tk.Frame(self, bg='#000000', bd=1)
        #self.search_frame.grid(row=5, column=1, columnspan=2, sticky='nsew')
        config_grids(self.search_frame)

        self.build_search_input()

        self.backspace_button = tk.Button(self,
                                          **font,
                                          text='DEL',
                                          command=self.roku.backspace)
        self.backspace_button.grid(row=5, column=3, sticky='nsew')

        self.power_button = tk.Button(self,
                                      **power,
                                      text=u'\u23FB',
                                      command=self.roku.power)
        self.power_button.grid(row=0, column=0, rowspan=2, sticky='nsew')

        self.computer_button = tk.Button(
            self,
            **app,
            text='PC',
            command=lambda: self.launch_app('computer'))
        self.computer_button.grid(row=2, column=0, sticky='nsew')

        self.plex_button = tk.Button(self,
                                     **app,
                                     text='PLEX',
                                     command=lambda: self.launch_app('plex'))
        self.plex_button.grid(row=3, column=0, sticky='nsew')

        self.ps4_button = tk.Button(
            self,
            **app,
            text='PS4',
            command=lambda: self.launch_app('playstation'))
        self.ps4_button.grid(row=4, column=0, sticky='nsew')

        self.menu_bar = Menubar(self)
        self.master.config(menu=self.menu_bar)

        self.bindings = [
            ('<KeyPress>', self.key_press),
            ('<Left>', self.roku.left),
            ('<Right>', self.roku.right),
            ('<Up>', self.roku.up),
            ('<Down>', lambda *args: click_button(self.down_button)),
            ('<Return>', self.roku.select),
            ('-', self.roku.volume_down),
            ('+', self.roku.volume_up),
            ('=', self.roku.volume_up),
            ('<space>', self.roku.play),
            ('<BackSpace>', self.roku.back),
        ]

        self.bound = False

        self.master.bind('<FocusIn>', self.set_bindings)
        self.master.bind('<FocusOut>', self.set_bindings)

        self.master.geometry(get_geometry(settings))
Esempio n. 29
0
from roku import Roku
rokuls = Roku.discover(timeout=10)
print(rokuls)
ip = input('IP: ')
roku = Roku(ip)
appinput = input('APP (i.e. YouTube): ')
apptolaunch = roku[appinput]
apptolaunch.launch()
Esempio n. 30
0
def deploy(channel_path, roku_ip):
    f = Figlet(font='slant')
    click.echo(f.renderText('RokuPi'))
    current_channel = Channel(channel_path)

    # create config if non-existent
    if current_channel.config_file is None:
        create_config_response = click.prompt('Would like to create config file y/n ', type=str, default='y')

        if handle_yes_no_response(create_config_response):
            handle_yes_no_response(create_config_response)
            click.echo(f'Default structure \n{STANDARD_CHANNEL_STRUCTURE}\nThis can be updated later')
            use_default_channel_structure = click.prompt(
                'Would you like to use default channel structure y/n',
                type=str,
                default='y'
            )
            if handle_yes_no_response(use_default_channel_structure):
                create_config_file(STANDARD_CHANNEL_STRUCTURE, current_channel.channel_path)
            else:
                example = 'manifest, someDir/**, anotherDir/**'
                click.echo(f'please input you channel structure, '
                           f'use unix glob pattern in comma separated values {example}')
                custom_channel_structure = input("Please input your channel structure: ")

                if custom_channel_structure != '':
                    folders = custom_channel_structure.split(',')
                    create_config_file(folders, current_channel.channel_path)
                    current_channel.set_config_file_data()
                else:
                    click.echo(f'please use an array of files {example}')

    # Parse manifest for data
    current_channel.manifest_data = parse_manifest(current_channel.channel_path / 'manifest')
    current_channel.set_config_file_data()

    # Stage channel contents and create archive
    stage_channel_contents(current_channel.channel_path, current_channel.config_data["files"])
    stage_dir_path = current_channel.channel_path / STAGE_DIR
    out_dir = current_channel.channel_path / 'out' / current_channel.__str__()
    archive_staged_content_to_out(stage_dir_path, out_dir)

    # empty stage dir and remove
    empty_dir(str(stage_dir_path))
    stage_dir_path.rmdir()

    # device selection
    if roku_ip is None:
        device_selection_results = None
        # No device defined in config
        if "device" not in current_channel.config_data.keys() or not bool(current_channel.config_data["device"]):
            device_selection_results = device_selection()
            device = device_selection_results["device"]
        # using device defined in config
        else:
            current_channel.set_config_file_data()
            device = current_channel.config_data["device"]
            use_config_roku = click.prompt(f'Would you like to use {device["name"]} @ {device["ip_address"]} y/n',
                                           type=str,
                                           default='y')
            # not using device in config but there is one
            if not handle_yes_no_response(use_config_roku):
                device_selection_results = device_selection()
                device = device_selection_results["device"]
        # scanning/manual input device saving
        if device_selection_results and device_selection_results["write_to_config"]:
            Roku.write_device_data_to_config(device, current_channel.config_file)
            current_channel.set_config_file_data()
    else:
        device = {
            "name": ' ',
            "username": '******',
            "password": '',
            "ip_address": roku_ip
        }
        try:
            # validate ip
            if ipaddress.ip_address(device["ip_address"]):
                device_password = click.prompt('device password', type=str, hide_input=True)
                device["password"] = device_password
            else:
                click.echo("IP address needs to be in IPV4 format")
        except ValueError:
            click.echo("IP address needs to be in IPV4 format")
        # ping device for availability
        data_from_device = query_ip_address_for_device_info(roku_ip)
        if data_from_device is None:
            click.echo("Unable to establish connection with device")
            return
        else:
            device["name"] = data_from_device["value"]["name"]
            save_device = click.prompt('Do you want to save this device y/n',  type=str, default='y')
            if handle_yes_no_response(save_device):
                Roku.write_device_data_to_config(device, current_channel.config_file)
                current_channel.set_config_file_data()

    roku = Roku(device)
    roku.delete_channel()
    roku.deploy_channel(current_channel)