Beispiel #1
0
def on_agent_ready():
    try:
        # now = datetime.now()
        # now_string = now.strftime( "%d%b%Y = %H:%M:%S.%f" )
        # redis = redis_connect()
        # last_agent_ready_time = redis.get( "STATE.WEBSITES.DISNEY_PLUS.NOW_PLAYING.LAST_AGENT_READY_TIME" )
        # if last_agent_ready_time is None:
        # 	last_agent_ready_time = now_string
        # else:
        # 	last_agent_ready_time = str( last_agent_ready_time , 'utf-8' )
        # last_agent_ready_time = datetime.strptime( last_agent_ready_time , "%d%b%Y = %H:%M:%S.%f" )
        # seconds_difference = math.floor( ( now - last_agent_ready_time ).total_seconds() )
        # redis.set( "STATE.WEBSITES.DISNEY_PLUS.NOW_PLAYING.LAST_AGENT_READY_TIME" , now_string )
        # time.sleep( 3 )
        # print( "Seconds Difference = " + str( seconds_difference ) )
        # if seconds_difference == 0 or seconds_difference > 25:
        # 	xdotool.press_keyboard_key( "Ctrl+r" )

        # chrome_stuff = get_chrome_on_disney_player()
        # chrome = chrome_stuff[0]
        # tab = chrome_stuff[1]
        # time.sleep( 3 )
        # chrome.xdotool.move_mouse( chrome.geometry["center"]["x"] , chrome.geometry["center"]["y"] )
        #time.sleep( .2 )
        #chrome.xdotool.left_click()
        # requests.post( "http://127.0.0.1:10081/broadcast" , json={
        # 		"message": {
        # 			"channel": "disney_plus" ,
        # 			"message": "agent_acknowledge"
        # 		}
        # 	})
        redis = redis_connect()
        video = redis_circular_list.current(
            redis, "STATE.WEBSITES.DISNEY_PLUS.LIBRARY.VIDEOS")
        video = json.loads(video)
        pprint(video)
        chrome = ChromeRDPWrapper()
        chrome.attach_xdo_tool("Disney+ | Video Player")
        if video["playback_state"] == "playing":
            chrome.xdotool.press_keyboard_key("F11")
        else:
            time.sleep(10)
            for i in range(0, 6):
                cnee_check_time()
        print("done with on_agent_ready()")
    except Exception as e:
        print(e)
        return False
Beispiel #2
0
def on_first_play():
    try:
        for i in range(0, 2):
            cnee_check_time()
            time.sleep(2)
        redis = redis_connect()
        video = redis_circular_list.current(
            redis, "STATE.WEBSITES.DISNEY_PLUS.LIBRARY.VIDEOS")
        video = json.loads(video)
        pprint(video)
        chrome = ChromeRDPWrapper()
        chrome.attach_xdo_tool("Disney+ | Video Player")
        if video["playback_state"] == "playing":
            chrome.xdotool.press_keyboard_key("F11")
        else:
            chrome.xdotool.press_keyboard_key("Ctrl+r")
    except Exception as e:
        print(e)
        return False
Beispiel #3
0
def get_chrome_on_disney_player():
    try:
        for i in range(0, 10):
            try:
                chrome = ChromeRDPWrapper()
                chrome.attach_xdo_tool("Disney+ | Video Player")
                # chrome.xdotool = XDoToolWrapper()
                # chrome.xdotool.attach_via_name( "Disney+ | Video Player" , 30 , 1 )
                # chrome.geometry = chrome.xdotool.get_window_geometry()
                tab = chrome_get_disney_tab()
                time.sleep(1)
                if chrome.xdotool.window_id is not None and chrome.xdotool.window_id is not False:
                    return [chrome, tab]
            except Exception as e:
                PrintException()
                return False
    except Exception as e:
        PrintException()
        return False
Beispiel #4
0
def playback_stop():
    try:
        # 1.) Manual Get Time Update
        chrome = ChromeRDPWrapper()
        chrome.xdotool = XDoToolWrapper()
        chrome.xdotool.attach_via_name("Disney+ | Video Player", 3, .3)
        time.sleep(1)
        chrome.xdotool.left_click()
        cnee_check_time()
        time.sleep(2)

        # 2.) Close all Other Tabs
        chrome.xdotool.press_keyboard_key("F11")
        time.sleep(2)
        chrome.open_solo_url(
            "https://www.windy.com/-Thunderstorms-thunder?thunder,39.838,-84.111,5"
        )
    except Exception as e:
        print(e)
        PrintException()
        return False
Beispiel #5
0
def playback_previous():
    try:
        chrome = ChromeRDPWrapper()
        chrome.attach_xdo_tool("Disney+ | Video Player")
        tab = chrome_get_disney_tab()
        time.sleep(1)
        cnee_check_time()
        chrome.close_tab_id(tab["id"])
    except Exception as e:
        PrintException()
        return False
Beispiel #6
0
def playback_play():
    try:
        video = update_current_video_time_info()
        if video["over"] == True:
            redis = redis_connect()
            video = redis_circular_list.next(
                redis, "STATE.WEBSITES.DISNEY_PLUS.LIBRARY.VIDEOS")
            video = json.loads(video)
            video = update_current_video_time_info(video)
        #pprint( video )
        chrome = ChromeRDPWrapper()
        chrome.open_solo_url(f"https://www.disneyplus.com/video/{video['id']}")
        chrome.attach_xdo_tool("Disney+ | Video Player")
    except Exception as e:
        PrintException()
        return False
Beispiel #7
0
import time
from chrome_rdp_wrapper import ChromeRDPWrapper

if __name__ == "__main__":
    chrome = ChromeRDPWrapper()
    tab = chrome.open_solo_url(
        "https://www.disneyplus.com/video/8b998fae-f7a6-434a-a8c2-79d853247782"
    )
    chrome.enable_runtime_on_tab(tab)
    chrome.attach_xdo_tool("Disney+ | Video Player")
    time.sleep(10)
    chrome.xdotool.press_keyboard_key("F11")
    # chrome.xdotool.move_mouse( chrome.geometry["center"]["x"] , chrome.geometry["center"]["y"] )
    # chrome.xdotool.left_click()
    # time.sleep( 1 )
    # chrome.xdotool.press_keyboard_key( "f" )
    #time.sleep( 200 )
    #chrome.close_tab_id( tab["id"] )