コード例 #1
0
    def test_client(self, mock_get):
        from ms_client.client import MediaServerClient
        msc = MediaServerClient(local_conf=CONFIG)
        response = msc.api('/')
        self.assertTrue(isinstance(response, dict))
        self.assertEqual(response['mediaserver'], '10.0.0')

        self.assertEqual(len(mock_get.call_args_list), 1)
コード例 #2
0
# -*- coding: utf-8 -*-
'''
Example script that mass moves media into a channel based on a criteria (e.g. here a specific external_ref prefix)
'''
import os
import sys

if __name__ == '__main__':
    sys.path.append(os.path.dirname(os.path.dirname(
        os.path.abspath(__file__))))
    from ms_client.client import MediaServerClient

    local_conf = sys.argv[1] if len(sys.argv) > 1 else None
    msc = MediaServerClient(local_conf)
    # ping
    print(msc.api('/'))

    more = True
    start = ''
    index = 0

    external_ref_prefix = 'examplevalue'
    target_channel_oid = 'c12345678910'

    while more:
        print('//// Making request on latest (start=%s)' % start)
        response = msc.api('latest/',
                           params={
                               'start': start,
                               'content': 'v',
                               'count': 20
コード例 #3
0
#!/usr/bin/env python3
'''
Script to ping a MediaServer.
'''
import os
import sys

if __name__ == '__main__':
    sys.path.append(os.path.dirname(os.path.dirname(
        os.path.abspath(__file__))))
    from ms_client.client import MediaServerClient

    local_conf = sys.argv[1] if len(sys.argv) > 1 else None
    msc = MediaServerClient(local_conf)
    # ping
    annotations = msc.api('/annotations/list/',
                          params={'oid': 'v125f52117974vspq8g1'})

    type_id = None
    annotation_type_name = 'comment'
    for key, val in annotations['types'].items():
        if val['slug'] == annotation_type_name:
            type_id = val['id']
    if type_id is None:
        print(f'Annotation type {annotation_type_name} not found')
        exit(1)

    for annotation in annotations['annotations']:
        # comment
        if annotation['type_id'] == type_id:
            s = '{poster} ({popularity} votes): {content}\n'.format(
                **annotation)
コード例 #4
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Script to ping a MediaServer.
'''
import os
import sys

if __name__ == '__main__':
    sys.path.append(os.path.dirname(os.path.dirname(
        os.path.abspath(__file__))))
    from ms_client.client import MediaServerClient

    local_conf = sys.argv[1] if len(sys.argv) > 1 else None
    msc = MediaServerClient(local_conf)
    # ping
    print(msc.api('/'))