Beispiel #1
0
def main():
    """ Main Program wrapper """
    # configure the log file
    # Create arguments
    parser = ArgumentParser(description='Process Client parameters')
    create_arguments(parser)
    args = parser.parse_args()
    globals().update(vars(args))
    configure_log_file(playback_type=PLAYBACK.lower())
    config_client.JSON_HANDLE['playback_type'] = PLAYBACK.lower()
    if not MPD:
        print "ERROR: Please provide the URL to the MPD file. Try Again.."
        return None
    config_client.LOG.info('Downloading MPD file %s' % MPD)
    # Retrieve the MPD files for the video
    mpd_opener = get_opener()
    mpd_file = get_mpd(MPD, mpd_opener)
    domain = get_domain_name(MPD)
    # Reading the MPD file created
    dp_object = read_mpd.read_mpd(mpd_file)
    config_client.LOG.info("The DASH media has %d video representations" % len(dp_object.video))
    if LIST:
        # Print the representations and EXIT
        print_representations(dp_object)
        return None
    else:
        config_client.LOG.critical("Started DASH Playback")
        start_playback(dp_object, domain, "BASIC", DOWNLOAD)
def main():
    """ Main Program wrapper """
    # configure the log file
    # Create arguments
    parser = ArgumentParser(description='Process Client parameters')
    create_arguments(parser)
    args = parser.parse_args()
    globals().update(vars(args))
    configure_log_file(playback_type=PLAYBACK.lower())
    config_dash.JSON_HANDLE['playback_type'] = PLAYBACK.lower()
    if QUIC:
        config_dash.JSON_HANDLE['transport'] = 'quic'
    else:
        config_dash.JSON_HANDLE['transport'] = 'tcp'
    if MP:
        config_dash.JSON_HANDLE['scheduler'] = SCHEDULER
    else:
        config_dash.JSON_HANDLE['scheduler'] = 'singlePath'
    if not MPD:
        print "ERROR: Please provide the URL to the MPD file. Try Again.."
        return None

    glueConnection.setupPM(QUIC, MP, not NO_KEEP_ALIVE, SCHEDULER)

    config_dash.LOG.info('Downloading MPD file %s' % MPD)
    # Retrieve the MPD files for the video
    mpd_file = get_mpd(MPD)
    domain = get_domain_name(MPD)
    dp_object = DashPlayback()

    # Reading the MPD file created
    dp_object, video_segment_duration = read_mpd.read_mpd(mpd_file, dp_object)

    config_dash.LOG.info("The DASH media has %d video representations" %
                         len(dp_object.video))
    if LIST:
        # Print the representations and EXIT
        print_representations(dp_object)
        return None
    if "all" in PLAYBACK.lower():
        if mpd_file:
            config_dash.LOG.critical("Start ALL Parallel PLayback")
            start_playback_all(dp_object, domain)
    elif "basic" in PLAYBACK.lower():
        config_dash.LOG.critical("Started Basic-DASH Playback")
        start_playback_smart(dp_object, domain, "BASIC", DOWNLOAD,
                             video_segment_duration)
    elif "sara" in PLAYBACK.lower():
        config_dash.LOG.critical("Started SARA-DASH Playback")
        start_playback_smart(dp_object, domain, "SMART", DOWNLOAD,
                             video_segment_duration)
    elif "netflix" in PLAYBACK.lower():
        config_dash.LOG.critical("Started Netflix-DASH Playback")
        start_playback_smart(dp_object, domain, "NETFLIX", DOWNLOAD,
                             video_segment_duration)
    else:
        config_dash.LOG.error("Unknown Playback parameter {}".format(PLAYBACK))
        return None
def main():
    """ Main Program wrapper """
    # configure the log file
    # Create arguments
    parser = ArgumentParser(description='Process Client parameters')
    create_arguments(parser)
    args = parser.parse_args()
    globals().update(vars(args))
    configure_log_file(playback_type=PLAYBACK.lower())
    config_dash.JSON_HANDLE['playback_type'] = PLAYBACK.lower()
    if not MPD:
        print("ERROR: Please provide the URL to the MPD file. Try Again..")
        return None
    config_dash.LOG.info('Downloading MPD file %s' % MPD)
    # Retrieve the MPD files for the video
    mpd_file = get_mpd(MPD)
    domain = get_domain_name(MPD)
    dp_object = DashPlayback()
    # Reading the MPD file created
    dp_object, video_segment_duration = read_mpd.read_mpd(mpd_file, dp_object)
    config_dash.LOG.info("The DASH media has %d video representations" %
                         len(dp_object.video))
    if LIST:
        # Print the representations and EXIT
        print_representations(dp_object)
        return None
    if "all" in PLAYBACK.lower():
        if mpd_file:
            config_dash.LOG.critical("Start ALL Parallel PLayback")
            start_playback_all(dp_object, domain)
    elif "basic" in PLAYBACK.lower():
        config_dash.LOG.critical("Started Basic-DASH Playback")
        start_playback_smart(dp_object, domain, "BASIC", DOWNLOAD,
                             video_segment_duration, RETRANS)
    elif "sara" in PLAYBACK.lower():
        config_dash.LOG.critical("Started SARA-DASH Playback")
        start_playback_smart(dp_object, domain, "SMART", DOWNLOAD,
                             video_segment_duration, RETRANS)
    elif "netflix" in PLAYBACK.lower():
        config_dash.LOG.critical("Started Netflix-DASH Playback")
        start_playback_smart(dp_object, domain, "NETFLIX", DOWNLOAD,
                             video_segment_duration, RETRANS)
    elif "vlc" in PLAYBACK.lower():
        config_dash.LOG.critical("Started Basic2-DASH Playback")
        start_playback_smart(dp_object, domain, "VLC", DOWNLOAD,
                             video_segment_duration, RETRANS)
    elif "empirical" in PLAYBACK.lower():
        config_dash.LOG.critical("Started Hello-DASH Playback")
        start_playback_smart(dp_object, domain, "EMPIRICAL", DOWNLOAD,
                             video_segment_duration, RETRANS)

    else:
        config_dash.LOG.error("Unknown Playback parameter {}".format(PLAYBACK))
        return None
Beispiel #4
0
def main():
    """ Main Program wrapper """
    # configure the log file
    # Create arguments

    parser = ArgumentParser(description='Process Client parameters')
    create_arguments(parser)
    args = parser.parse_args()
    globals().update(vars(args))
    configure_log_file(playback_type=PLAYBACK.lower())
    config_dash.JSON_HANDLE['playback_type'] = PLAYBACK.lower()

    print("after configure log file")
    if not MPD:
        print "ERROR: Please provide the URL to the MPD file. Try Again.."
        return None

    #initialize the dash event logger, after the MPD is parsed



    config_dash.LOG.info('Downloading MPD file %s' % MPD)
    # Retrieve the MPD files for the video
    mpd_file = get_mpd(MPD)
    domain = get_domain_name(MPD, mpd_file)
    dp_object = DashPlayback()
    # Reading the MPD file created
    dp_object, video_segment_duration = read_mpd.read_mpd_v2(mpd_file, dp_object)
    config_dash.LOG.info("The DASH media has %d video representations" % len(dp_object.video))
    if LIST:
        # Print the representations and EXIT
        print_representations(dp_object)
        return None
    if "all" in PLAYBACK.lower():
        if mpd_file:
            config_dash.LOG.critical("Start ALL Parallel PLayback")
            start_playback_all(dp_object, domain)
    elif "basic" in PLAYBACK.lower():
        config_dash.LOG.critical("Started Basic-DASH Playback")
        start_playback_smart(dp_object, domain, "BASIC", DOWNLOAD, video_segment_duration)
    elif "sara" in PLAYBACK.lower():
        config_dash.LOG.critical("Started SARA-DASH Playback")
        start_playback_smart(dp_object, domain, "SMART", DOWNLOAD, video_segment_duration)
    elif "netflix" in PLAYBACK.lower():
        config_dash.LOG.critical("Started Netflix-DASH Playback")
        start_playback_smart(dp_object, domain, "NETFLIX", DOWNLOAD, video_segment_duration)
    else:
        config_dash.LOG.error("Unknown Playback parameter {}".format(PLAYBACK))
        return None
def main():
    """ Main Program wrapper """
    # configure the log file
    # Create arguments
    sumOfTotalDownloaded = 0.0
    sumOfPlaybackTime = 0.0
    program_start_time = datetime.now()
    for runNo in range(1, 11):
        parser = ArgumentParser(description='Process Client parameters')
        create_arguments(parser)
        args = parser.parse_args()
        globals().update(vars(args))

        if QUIC:
            CONNECTION_TYPE_STR = "QUIC_" + str(runNo) + "_" + PLAYBACK
        elif CURL:
            CONNECTION_TYPE_STR = "CURL_" + str(runNo) + "_" + PLAYBACK
        else:
            CONNECTION_TYPE_STR = "URLLIB_" + str(runNo) + "_" + PLAYBACK

        configure_log_file(playback_type=PLAYBACK.lower(),
                           connection_type=CONNECTION_TYPE_STR)
        config_dash.JSON_HANDLE['playback_type'] = PLAYBACK.lower()
        if not MPD:
            print "ERROR: Please provide the URL to the MPD file. Try Again.."
            return None
        config_dash.LOG.info('Downloading MPD file %s' % MPD)

        # Retrieve the MPD files for the video
        mpd_file = None
        while mpd_file == None:
            mpd_file = get_mpd(MPD)
            if mpd_file != None:
                break

        domain = get_domain_name(MPD)

        dp_object = DashPlayback()
        # Reading the MPD file created
        dp_object, video_segment_duration = read_mpd.read_mpd(
            mpd_file, dp_object)
        config_dash.LOG.info("The DASH media has %d video representations" %
                             len(dp_object.video))
        if LIST:
            # Print the representations and EXIT
            print_representations(dp_object)
            return None
        if "all" in PLAYBACK.lower():
            if mpd_file:
                config_dash.LOG.critical("Start ALL Parallel PLayback")
                playbackTime, totalDownloaded = start_playback_all(
                    dp_object, domain)
        elif "basic" in PLAYBACK.lower():
            config_dash.LOG.critical("Started Basic-DASH Playback")
            playbackTime, totalDownloaded = start_playback_smart(
                dp_object, domain, "BASIC", DOWNLOAD, video_segment_duration,
                CONNECTION_TYPE_STR, JUMP_SCENARIO)
        elif "sara" in PLAYBACK.lower():
            config_dash.LOG.critical("Started SARA-DASH Playback")
            playbackTime, totalDownloaded = start_playback_smart(
                dp_object, domain, "SMART", DOWNLOAD, video_segment_duration,
                CONNECTION_TYPE_STR, JUMP_SCENARIO)
        elif "netflix" in PLAYBACK.lower():
            config_dash.LOG.critical("Started Netflix-DASH Playback")
            playbackTime, totalDownloaded = start_playback_smart(
                dp_object, domain, "NETFLIX", DOWNLOAD, video_segment_duration,
                CONNECTION_TYPE_STR, JUMP_SCENARIO)
        else:
            config_dash.LOG.error(
                "Unknown Playback parameter {}".format(PLAYBACK))
            return None

        sumOfTotalDownloaded = sumOfTotalDownloaded + totalDownloaded
        sumOfPlaybackTime = sumOfPlaybackTime + playbackTime

        print "Run No:", runNo, "TOTAL DOWNLOADED: ", totalDownloaded
        print "Run No:", runNo, "PLAYPACK TIME: ", playbackTime
        print "Run No:", runNo, "SUM TOTAL DOWNLOADED: ", sumOfTotalDownloaded
        print "Run No:", runNo, "SUM PLAYPACK TIME: ", sumOfPlaybackTime
        totalDownloaded = 0
        playbackTime = 0

    program_end_time = datetime.now()
    delta = program_end_time - program_start_time
    print CONNECTION_TYPE_STR, "PROGRAM STARTED AT: ", program_start_time
    print CONNECTION_TYPE_STR, "PROGRAM FINISHED AT: ", program_end_time
    print CONNECTION_TYPE_STR, "PROGRAM DURATION: ", delta.total_seconds()
    print CONNECTION_TYPE_STR, "FINAL SUM OF TOTAL DOWNLOADED: ", sumOfTotalDownloaded
    print CONNECTION_TYPE_STR, "FINAL SUM OF PLAYPACK TIME: ", sumOfPlaybackTime
Beispiel #6
0
def main(mpd, playback, segment_limit, download, directory):
    #CM: input parameters added to main function
    """ Main Program wrapper """
    # configure the log file
    # Create arguments

    #CM: commented out following section
    # parser = ArgumentParser(description='Process Client parameters')
    # create_arguments(parser)
    # args = parser.parse_args()
    # globals().update(vars(args))

    #CM: added alternative lines
    args_updated = dict()
    args_updated['MPD'] = mpd
    args_updated['PLAYBACK'] = playback
    args_updated['SEGMENT_LIMIT'] = segment_limit
    args_updated['DOWNLOAD'] = download
    args_updated['VIDEO_DIRECTORY'] = directory
    globals().update(args_updated)

    config_dash.LOG_FOLDER = "/opt/monroe/astream/"

    configure_log_file(playback_type=PLAYBACK.lower())
    config_dash.JSON_HANDLE['playback_type'] = PLAYBACK.lower()
    if not MPD:
        print "ERROR: Please provide the URL to the MPD file. Try Again.."
        return None
    config_dash.LOG.info('Downloading MPD file %s' % MPD)
    # Retrieve the MPD files for the video
    mpd_file = get_mpd(MPD)
    domain = get_domain_name(MPD)
    dp_object = DashPlayback()

    # Reading the MPD file created
    dp_object, video_segment_duration = read_mpd.read_mpd(mpd_file, dp_object)

    config_dash.LOG.info("The DASH media has %d video representations" %
                         len(dp_object.video))
    if LIST:
        # Print the representations and EXIT
        print_representations(dp_object)
        return None
    if "all" in PLAYBACK.lower():
        if mpd_file:
            config_dash.LOG.critical("Start ALL Parallel PLayback")
            start_playback_all(dp_object, domain)
    elif "basic" in PLAYBACK.lower():
        config_dash.LOG.critical("Started Basic-DASH Playback")
        start_playback_smart(dp_object, domain, "BASIC", DOWNLOAD,
                             video_segment_duration)
    elif "sara" in PLAYBACK.lower():
        config_dash.LOG.critical("Started SARA-DASH Playback")
        start_playback_smart(dp_object, domain, "SMART", DOWNLOAD,
                             video_segment_duration)
    elif "netflix" in PLAYBACK.lower():
        config_dash.LOG.critical("Started Netflix-DASH Playback")
        start_playback_smart(dp_object, domain, "NETFLIX", DOWNLOAD,
                             video_segment_duration)
    else:
        config_dash.LOG.error("Unknown Playback parameter {}".format(PLAYBACK))
        return None
Beispiel #7
0
#!/usr/bin/env python

import os
import re
import platform
import config_dash
from configure_log_file import configure_log_file
"""Module to generate the RTT times of a ping
   This module provides two functions that enable us to get the ping statistics
   of an IP address on any system(Linux, Windows, Mac)

"""

if not config_dash.LOG:
    configure_log_file()

RTT_MATCH_LINUX = r"rtt min/avg/max/mdev = "
RTT_PATTERN_LINUX = r"(\d+.\d+)/(\d+.\d+)/(\d+.\d+)/\d+.\d+ ms"
PING_OPTION_LINUX = '-c'

RTT_MATCH_WINDOWS = r"Minimum = "
#if 'LANG' in os.environ and os.environ['LANG'] == 'FR':
RTT_PATTERN_WINDOWS = (
    r"(\d+)ms, Maximum = (\d+)ms, (?:Moyenne|Average) = (\d+)ms")
#else:
#    RTT_PATTERN_WINDOWS = (
#        r"(\d+)ms, Maximum = (\d+)ms, Average = (\d+)ms")
PING_OPTION_WINDOWS = '-n'

RTT_MATCH_DARWIN = "round-trip min/avg/max/stddev = "
RTT_PATTERN_DARWIN = RTT_PATTERN_LINUX
Beispiel #8
0
from __future__ import with_statement, absolute_import
import os
import re
import platform
import config_dash
from configure_log_file import configure_log_file

"""Module to generate the RTT times of a ping
   This module provides two functions that enable us to get the ping statistics
   of an IP address on any system(Linux, Windows, Mac)

"""


if not config_dash.LOG:
    configure_log_file()

RTT_MATCH_LINUX = r"rtt min/avg/max/mdev = "
RTT_PATTERN_LINUX = r"(\d+.\d+)/(\d+.\d+)/(\d+.\d+)/\d+.\d+ ms"
PING_OPTION_LINUX = "-c"

RTT_MATCH_WINDOWS = r"Minimum = "
# if 'LANG' in os.environ and os.environ['LANG'] == 'FR':
RTT_PATTERN_WINDOWS = r"(\d+)ms, Maximum = (\d+)ms, (?:Moyenne|Average) = (\d+)ms"
# else:
#    RTT_PATTERN_WINDOWS = (
#        r"(\d+)ms, Maximum = (\d+)ms, Average = (\d+)ms")
PING_OPTION_WINDOWS = "-n"

RTT_MATCH_DARWIN = "round-trip min/avg/max/stddev = "
RTT_PATTERN_DARWIN = RTT_PATTERN_LINUX