def save_engine_params(self, engine, **kwargs): """Map validated field values to engine data. Since form widgets may be nested or named differently than the keys in the :attr:`mediacore.lib.storage.StorageEngine._data` dict, it is necessary to manually map field values to the data dictionary. :type engine: :class:`mediacore.lib.storage.StorageEngine` subclass :param engine: An instance of the storage engine implementation. :param \*\*kwargs: Validated and filtered form values. :raises formencode.Invalid: If some post-validation error is detected in the user input. This will trigger the same error handling behaviour as with the @validate decorator. """ StorageForm.save_engine_params(self, engine, **kwargs) ftp = kwargs['ftp'] engine._data[FTP_SERVER] = ftp['server'] engine._data[FTP_USERNAME] = ftp['user'] engine._data[FTP_PASSWORD] = ftp['password'] engine._data[FTP_UPLOAD_DIR] = ftp['upload_dir'] engine._data[FTP_MAX_INTEGRITY_RETRIES] = ftp[ 'upload_integrity_retries'] engine._data[HTTP_DOWNLOAD_URI] = ftp['http_download_uri'] engine._data[RTMP_SERVER_URI] = ftp['rtmp_server_uri']
def save_engine_params(self, engine, **kwargs): """Map validated field values to engine data. Since form widgets may be nested or named differently than the keys in the :attr:`mediacore.lib.storage.StorageEngine._data` dict, it is necessary to manually map field values to the data dictionary. :type engine: :class:`mediacore.lib.storage.StorageEngine` subclass :param engine: An instance of the storage engine implementation. :param \*\*kwargs: Validated and filtered form values. :raises formencode.Invalid: If some post-validation error is detected in the user input. This will trigger the same error handling behaviour as with the @validate decorator. """ StorageForm.save_engine_params(self, engine, **kwargs) rtmp = kwargs.get('rtmp', {}) rtmp_servers = rtmp.get('known_servers', ()) engine._data['rtmp_server_uris'] = [x for x in rtmp_servers if x]
def save_engine_params(self, engine, **kwargs): """Map validated field values to engine data. Since form widgets may be nested or named differently than the keys in the :attr:`mediacore.lib.storage.StorageEngine._data` dict, it is necessary to manually map field values to the data dictionary. :type engine: :class:`mediacore.lib.storage.StorageEngine` subclass :param engine: An instance of the storage engine implementation. :param \*\*kwargs: Validated and filtered form values. :raises formencode.Invalid: If some post-validation error is detected in the user input. This will trigger the same error handling behaviour as with the @validate decorator. """ StorageForm.save_engine_params(self, engine, **kwargs) specifics = kwargs['specifics'] engine._data['path'] = specifics['path'] or None engine._data['rtmp_server_uri'] = specifics['rtmp_server_uri'] or None
def save_engine_params(self, engine, **kwargs): """Map validated field values to engine data. Since form widgets may be nested or named differently than the keys in the :attr:`mediacore.lib.storage.StorageEngine._data` dict, it is necessary to manually map field values to the data dictionary. :type engine: :class:`mediacore.lib.storage.StorageEngine` subclass :param engine: An instance of the storage engine implementation. :param \*\*kwargs: Validated and filtered form values. :raises formencode.Invalid: If some post-validation error is detected in the user input. This will trigger the same error handling behaviour as with the @validate decorator. """ StorageForm.save_engine_params(self, engine, **kwargs) player = kwargs['player'] engine._data['nocookie'] = player['nocookie'] player_params = engine._data['player_params'] for x in self.player_params: player_params[x] = player[x]
def save_engine_params(self, engine, panda, s3, cloudfront, profiles, **kwargs): """Map validated field values to engine data. Since form widgets may be nested or named differently than the keys in the :attr:`mediacore.lib.storage.StorageEngine._data` dict, it is necessary to manually map field values to the data dictionary. :type engine: :class:`mediacore.lib.storage.StorageEngine` subclass :param engine: An instance of the storage engine implementation. :param \*\*kwargs: Validated and filtered form values. :raises formencode.Invalid: If some post-validation error is detected in the user input. This will trigger the same error handling behaviour as with the @validate decorator. """ # The panda client library expects strings. for key in panda: if panda[key] is None: panda[key] = u'' StorageForm.save_engine_params(self, engine, **kwargs) engine._data[PANDA_CLOUD_ID] = panda['cloud_id'] engine._data[PANDA_ACCESS_KEY] = panda['access_key'] engine._data[PANDA_SECRET_KEY] = panda['secret_key'] engine._data[PANDA_API_HOST] = panda['api_host'] engine._data[PANDA_PROFILES] = profiles engine._data[S3_BUCKET_NAME] = s3['bucket_name'] engine._data[CLOUDFRONT_STREAMING_URI] = cloudfront['streaming_uri'] engine._data[CLOUDFRONT_DOWNLOAD_URI] = cloudfront['download_uri'] engine.panda_helper.cache.clear() try: engine.panda_helper().client.get_cloud() except PandaException, e: DBSession.rollback() # TODO: Display this error to the user. raise Invalid(str(e), None, None)
def save_engine_params(self, engine, **kwargs): """Map validated field values to engine data. Since form widgets may be nested or named differently than the keys in the :attr:`mediacore.lib.storage.StorageEngine._data` dict, it is necessary to manually map field values to the data dictionary. :type engine: :class:`mediacore.lib.storage.StorageEngine` subclass :param engine: An instance of the storage engine implementation. :param \*\*kwargs: Validated and filtered form values. :raises formencode.Invalid: If some post-validation error is detected in the user input. This will trigger the same error handling behaviour as with the @validate decorator. """ StorageForm.save_engine_params(self, engine, **kwargs) ftp = kwargs['ftp'] engine._data[FTP_SERVER] = ftp['server'] engine._data[FTP_USERNAME] = ftp['user'] engine._data[FTP_PASSWORD] = ftp['password'] engine._data[FTP_UPLOAD_DIR] = ftp['upload_dir'] engine._data[FTP_MAX_INTEGRITY_RETRIES] = ftp['upload_integrity_retries'] engine._data[HTTP_DOWNLOAD_URI] = ftp['http_download_uri'] engine._data[RTMP_SERVER_URI] = ftp['rtmp_server_uri']
def save_engine_params(self, engine, **kwargs): """Map validated field values to engine data. Since form widgets may be nested or named differently than the keys in the :attr:`mediacore.lib.storage.StorageEngine._data` dict, it is necessary to manually map field values to the data dictionary. :type engine: :class:`mediacore.lib.storage.StorageEngine` subclass :param engine: An instance of the storage engine implementation. :param \*\*kwargs: Validated and filtered form values. :raises formencode.Invalid: If some post-validation error is detected in the user input. This will trigger the same error handling behaviour as with the @validate decorator. """ StorageForm.save_engine_params(self, engine, **kwargs) aws = kwargs['aws'] data = engine._data data['aws_access_key'] = aws['aws_access_key'] data['aws_secret_key'] = aws['aws_secret_key'] data['s3_bucket_name'] = aws['s3_bucket_name'] data['s3_bucket_dir'] = aws['s3_bucket_dir'] data['cf_download_domain'] = aws['cf_download_domain'] data['cf_streaming_domain'] = aws['cf_streaming_domain']