-
Notifications
You must be signed in to change notification settings - Fork 3
/
MKGoogleVideoSearch.j
75 lines (61 loc) · 2.03 KB
/
MKGoogleVideoSearch.j
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* MKGoogleVideoSearch.j
* MediaKit
*
* Created by Ross Boucher.
* Copyright 2009, 280 North, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import <Foundation/CPObject.j>
@import "MKMediaPanel.j"
@implementation MKGoogleVideoSearchDelegate : CPObject
{
}
+ (CPString)URL
{
return "http://ajax.googleapis.com/ajax/services/search/video?v=1.0&rsz=large&q=" + MKMediaPanelQueryReplacementString + "&callback=" + CPJSONPCallbackReplacementString;
}
+ (CPString)identifier
{
return "GoogleVideoSearch";
}
+ (CPString)description
{
return "Google Video";
}
- (CPArray)mediaObjectsForIdentifier:(CPString)anIdentifier data:(Object)data
{
if (data.responseStatus !== 200)
return [];
var results = data.responseData.results,
count = results.length;
for (var i = 0; i < count; i++)
{
var object = results[i];
object.title = object.titleNoFormatting;
object.source = [[self class] description];
object.contentSize = CGSizeMake(object.width, object.height);
object.thumbnailSize = CGSizeMake(object.tbWidth, object.tbHeight);
object.thumbnailURL = object.tbUrl;
object.mediaType = MKMediaTypeVideo;
object.url = object.playUrl;
}
return results;
}
- (void)mediaSearchWithIdentifier:(CPString)anIdentifier failedWithError:(CPString)anError
{
}
@end