Exemplo n.º 1
0
class MultiplerConnection(object):
    """View that handles all multipler API connections"""

    def __init__(self, request):
        self.request = request
        file_id = request.matchdict['file_id']
        settings = request.registry.settings
        self.api = MultiplerAPI(settings, file_id=file_id)

    @view_config(route_name='video_view', renderer='json')
    def video_view(self):
        result = self.api.video_view()
        root = ElementTree.XML(result)
        return XmlDictConfig(root)

    @view_config(route_name='video_edit', renderer='json')
    def video_edit(self):
        file_title = self.request.params.get('file_title')
        file_description = self.request.params.get('file_description')
        self.api.video_edit(file_title, file_description)

    @view_config(route_name='video_delete', renderer='json')
    def video_delete(self):
        return self.api.video_delete()
Exemplo n.º 2
0
def update_metadata(file_id, video_title, video_description, settings):
    if not video_title or not video_description:
        return

    api = MultiplerAPI(settings, file_id=file_id)
    return api.video_edit(video_title, video_description)