Ejemplo n.º 1
0
 def get_media_for_video(self, videoId=None, video=None):
   # Note to self: Although we *can* access the video content via the Media API
   # (docs: http://support.brightcove.com/en/video-cloud/docs/accessing-video-content-media-api)
   # and it's much easier/flexible, we aren't so as not to arouse suspicion and to future proof the library
   #self.brightcove.find_video_by_id(video.id, fields='length,renditions,FLVURL')
   amfHelper = BrightCoveAMFHelper(PLAYER_KEY, videoId, PAGE_URL, AMF_SEED)
   if amfHelper.data:
     return get_item({'items': amfHelper.data['renditions']}, MediaRenditionItemCollection)
   else:
     return get_item({'items': []}, MediaRenditionItemCollection)
Ejemplo n.º 2
0
 def get_media_for_video(self, videoId=None, video=None):
     # Note to self: Although we *can* access the video content via the Media API
     # (docs: http://support.brightcove.com/en/video-cloud/docs/accessing-video-content-media-api)
     # and it's much easier/flexible, we aren't so as not to arouse suspicion and to future proof the library
     #self.brightcove.find_video_by_id(video.id, fields='length,renditions,FLVURL')
     amfHelper = BrightCoveAMFHelper(PLAYER_KEY, videoId, PAGE_URL,
                                     AMF_SEED)
     if amfHelper.data:
         return get_item({'items': amfHelper.data['renditions']},
                         MediaRenditionItemCollection)
     else:
         return get_item({'items': []}, MediaRenditionItemCollection)
Ejemplo n.º 3
0
 def get_playlists_for_show(self, show):
   resp = self._request(SHOWDATA_URL)
   json_data = json.loads(resp)
   for showSearch in json_data['shows']:
     if showSearch['showName'] == show:
       return get_item({'items': showSearch['playlists']}, PlaylistItemCollection)
   return None
Ejemplo n.º 4
0
 def get_show(self, show):
   resp = self._request(SHOWDATA_URL)
   json_data = json.loads(resp)
   for showSearch in json_data['shows']:
     if showSearch['showName'] == show:
       return get_item(showSearch, Show)
   return None
Ejemplo n.º 5
0
 def get_show(self, show):
     resp = self._request(SHOWDATA_URL)
     json_data = json.loads(resp)
     for showSearch in json_data['shows']:
         if showSearch['showName'] == show:
             return get_item(showSearch, Show)
     return None
Ejemplo n.º 6
0
 def get_playlists_for_show(self, show):
     resp = self._request(SHOWDATA_URL)
     json_data = json.loads(resp)
     for showSearch in json_data['shows']:
         if showSearch['showName'] == show:
             return get_item({'items': showSearch['playlists']},
                             PlaylistItemCollection)
     return None
Ejemplo n.º 7
0
Archivo: api.py Proyecto: yogi81/ru
    def _read_api(self, command, params, cls=None):
        '''Pases the JSON response for a given API command to a constructor of
        the provided cls and returns the result.

        '''
        params.update({'command': command})
        resp = self.read_conn.get_request(READ_API_URL, params)
        _json = json.loads(resp)

        # try, ValueError if not json
        assert 'error' not in _json, 'API Error [%d]: %s' % (_json['code'],
                                                             _json['error'])
        if cls:
            return get_item(_json, cls)
        return _json
Ejemplo n.º 8
0
 def test_get_item_dict(self):
     kwargs = {u'bar': 'bar', u'baz': 'baz'}
     item = get_item(kwargs, self.Bar)
     self.assertEqual(item.bar, 'bar')
     self.assertEqual(item.baz, 'baz')
Ejemplo n.º 9
0
 def get_fallback_media_for_video(self, videoId=None):
   video = self.brightcove.find_video_by_id(videoId, video_fields='FLVFullLength')
   if video.FLVFullLength:
     media = get_item(video.FLVFullLength, AMFRendition)
     return media
Ejemplo n.º 10
0
 def get_fallback_media_for_video(self, videoId=None):
     video = self.brightcove.find_video_by_id(videoId,
                                              video_fields='FLVFullLength')
     if video.FLVFullLength:
         media = get_item(video.FLVFullLength, AMFRendition)
         return media