Beispiel #1
0
    def set_recorder_settings(
            cls, client,
            recorder_id,  # number id (without usual prefix 'm')
            recording_timelimit_in_minutes=360,      # 6h
            recording_sizelimit_in_kbytes=64000000,  # 64G
            output_format='avi',  # or mov, mp4, ts(mpeg-ts)
            user_prefix='',       # prefix for recording file
            afu_enabled='on',     # this means auto-upload disabled!
            upnp_enabled=''):

        #
        # 06jun16 naomi: upnp and afu(automatic file upload) have dependencies
        # that are not treated by this api call (these features must be
        # enabled for the device and configured in 'automatic file upload' and
        # 'UPnP' webui calls)
        # -- to be implemented in epipearl.endpoints.webui_config.
        #

        timelimit = '%d:%02d:00' % (
                recording_timelimit_in_minutes / 60,
                recording_timelimit_in_minutes % 60)

        check_success = [
                {
                    'emsg': 'timelimit expected(%s)' % timelimit,
                    'func': WebUiConfig.check_singlevalue_select(
                        value=timelimit)},
                {
                    'emsg': 'sizelimit expected(%s)' %
                            recording_sizelimit_in_kbytes,
                    'func': WebUiConfig.check_singlevalue_select(
                        value=str(recording_sizelimit_in_kbytes))},
                {
                    'emsg': 'output_format expected(%s)' % output_format,
                    'func': WebUiConfig.check_singlevalue_select(
                        value=output_format)},
                {
                    'emsg': 'user_prefix expected(%s)' % user_prefix,
                    'func': WebUiConfig.check_input_id_value(
                        tag_id='user_prefix', value=user_prefix)}]
        if afu_enabled == 'on':
            check_success.append(
                {
                    'emsg': 'auto file upload expected(OFF)',
                    'func': WebUiConfig.check_singlevalue_checkbox_disabled(
                                tag_id='afu_enabled')})
        else:
            check_success.append(
                {
                    'emsg': 'auto file upload expected(ON)',
                    'func': WebUiConfig.check_singlevalue_checkbox(
                                tag_id='afu_enabled')})
        if upnp_enabled == 'on':
            check_success.append(
                {
                    'emsg': 'share via UPnP expected(ON)',
                    'func': WebUiConfig.check_singlevalue_checkbox(
                                tag_id='upnp_enabled')})
        else:
            check_success.append(
                {
                    'emsg': 'share via UPnP expected(OFF)',
                    'func': WebUiConfig.check_singlevalue_checkbox_disabled(
                                tag_id='upnp_enabled')})
        params = {
                'pfd_form_id': 'rec_settings',
                'timelimit': timelimit,
                'sizelimit': recording_sizelimit_in_kbytes,
                'output_format': output_format,
                'user_prefix': user_prefix,
                'afu_enabled': afu_enabled,
                'upnp_enabled': upnp_enabled}
        path = '/admin/recorder%s/archive' % recorder_id


        assert upnp_enabled == ''

        return WebUiConfig.configuration(
                client=client,
                params=params,
                path=path,
                check_success=check_success)
Beispiel #2
0
    def set_mhpearl_settings(
            cls, client,
            device_name='',       # device name for mh admin
            device_channel='',    # vod recorder id number
            file_search_range_in_seconds='',    # range within which it must
                                                # locate a recording
            admin_server_url='',  # mh admin url
            admin_server_usr='',  # mh digest user
            admin_server_pwd='',  # mh digest pwd
            update_frequency_in_seconds='120',  # freq to poll for schedule
            backup_agent=False):    # if True, does not upload recording to
                                    # mh when done

        check_success = [
                {
                    'emsg': 'device_name expected(%s)' % device_name,
                    'func': WebUiConfig.check_input_id_value(
                        tag_id='ca_name', value=device_name)},
                {
                    'emsg': 'device_username expected(%s)' % client.user,
                    'func': WebUiConfig.check_input_id_value(
                        tag_id='ca_user', value=client.user)},
                {
                    'emsg': 'not the device_password expected',
                    'func': WebUiConfig.check_input_id_value(
                        tag_id='ca_pass', value=client.passwd)},
                {
                    'emsg': 'device_channel expected(%s)' % device_channel,
                    'func': WebUiConfig.check_input_id_value(
                        tag_id='ca_chan', value=device_channel)},
                {
                    'emsg': 'file_search_range expected(%s)' %
                            file_search_range_in_seconds,
                    'func': WebUiConfig.check_input_id_value(
                        tag_id='ca_range',
                        value=str(file_search_range_in_seconds))},
                {
                    'emsg': 'admin_server_url expected(%s)' % admin_server_url,
                    'func': WebUiConfig.check_input_id_value(
                        tag_id='mh_host', value=admin_server_url)},
                {
                    'emsg': 'admin_server_user expected(%s)' %
                            admin_server_usr,
                    'func': WebUiConfig.check_input_id_value(
                        tag_id='mh_user', value=admin_server_usr)},
                {
                    'emsg': 'not the admin_server_passwd expected',
                    'func': WebUiConfig.check_input_id_value(
                        tag_id='mh_pass', value=admin_server_pwd)},
                {
                    'emsg': 'update_frequency expected(%s)' %
                            update_frequency_in_seconds,
                    'func': WebUiConfig.check_input_id_value(
                        tag_id='mh_freq',
                        value=str(update_frequency_in_seconds))}]

        params = {
                'DEVICE_NAME': device_name,
                'DEVICE_USERNAME': client.user,
                'DEVICE_PASSWORD': client.passwd,
                'DEVICE_CHANNEL': device_channel,
                'FILE_SEARCH_RANGE': file_search_range_in_seconds,
                'ADMIN_SERVER_URL': admin_server_url,
                'ADMIN_SERVER_USER': admin_server_usr,
                'ADMIN_SERVER_PASSWD': admin_server_pwd,
                'UPDATE_FREQUENCY': update_frequency_in_seconds}

        if backup_agent:
            params['BACKUP_AGENT'] = 'on'
            check_success.append({
                'emsg': 'backup_agent expected("ON")',
                'func': WebUiConfig.check_singlevalue_checkbox(
                    tag_id='mh_backup')})
        else:
            check_success.append({
                'emsg': 'backup_agent expected("ON")',
                'func': WebUiConfig.
                        check_singlevalue_checkbox_disabled(
                            tag_id='mh_backup')})

        path = '/admin/mhcfg'
        return WebUiConfig.configuration(
                client=client,
                params=params,
                path=path,
                check_success=check_success)