Skip to content

Commit

Permalink
* added new properties to video and social models
Browse files Browse the repository at this point in the history
* added "order" parameter to search and coordinate functions
  • Loading branch information
JohnnyTheTank committed Jan 26, 2016
1 parent 98e1337 commit 7f03527
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 19 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ Sample requests:
|----------|---------|---------|---------|---------|
| **`search`** | `music` | | The `search` parameter specifies the query term to search for. Your request can also use the Boolean NOT (-) and OR (|) operators to exclude videos or to find videos that are associated with one of several search terms. For example, to search for videos matching either "boating" or "sailing", set the `search` parameter value to boating|sailing. Similarly, to search for videos matching either "boating" or "sailing" but not "fishing", set the `search` parameter value to boating|sailing -fishing | no |
| **`items`** | `20` | `5` | Items per request (`0`-`50`) | yes |
| **`order`** | `rating` | `date` | The order parameter specifies the method that will be used to order resources in the API response. Use `date`, `rating`, `relevance`, `title`, `videoCount` or `viewCount` | yes |
| **`lat`** | `-13.163333` | | Defines a circular geographic area and also restricts a search to videos that specify, in their metadata, a geographic location that falls within that area. | yes |
| **`lng`** | `-72.545556` | | Defines a circular geographic area and also restricts a search to videos that specify, in their metadata, a geographic location that falls within that area. | yes |
| **`distance`** | `1km` | `5000m` | The parameter value must be a floating point number followed by a measurement unit. Valid measurement units are `m`, `km`, `ft`, and `mi`. (valid values: `1500m`, `5km`, `10000ft`, and `0.75mi`) The API does not support values larger than 1000 kilometers. | yes |
Expand All @@ -160,6 +161,7 @@ Sample requests:
| **`lat`** | `-13.163333` | | Defines a circular geographic area and also restricts a search to videos that specify, in their metadata, a geographic location that falls within that area. | no |
| **`lng`** | `-72.545556` | | Defines a circular geographic area and also restricts a search to videos that specify, in their metadata, a geographic location that falls within that area. | no |
| **`distance`** | `1km` | `5000m` | The parameter value must be a floating point number followed by a measurement unit. Valid measurement units are `m`, `km`, `ft`, and `mi`. (valid values: `1500m`, `5km`, `10000ft`, and `0.75mi`) The API does not support values larger than 1000 kilometers. | yes |
| **`order`** | `rating` | `date` | The order parameter specifies the method that will be used to order resources in the API response. Use `date`, `rating`, `relevance`, `title`, `videoCount` or `viewCount` | yes |
| **`items`** | `20` | `5` | Items per request (`0`-`50`) | yes |

Sample requests:
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"authors": [
"Jonathan Hornung <jonathan.hornung@gmail.com>"
],
"version": "0.7.6",
"version": "0.7.7",
"description": "Youtube plugin for apiNG",
"main": "dist/angular-plugin-youtube.min.js",
"moduleType": [],
Expand Down
27 changes: 19 additions & 8 deletions dist/aping-plugin-youtube.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
@name: aping-plugin-youtube
@version: 0.7.6 (24-01-2016)
@version: 0.7.7 (26-01-2016)
@author: Jonathan Hornung <jonathan.hornung@gmail.com>
@url: https://github.com/JohnnyTheTank/apiNG-plugin-youtube
@license: MIT
Expand Down Expand Up @@ -72,6 +72,10 @@ angular.module("jtt_aping_youtube", ['jtt_youtube'])

} else if (request.search || (request.lat && request.lng)) { //search for searchterm and or location

if (request.order) {
requestObject.order = request.order;
}

if (request.search) {
requestObject.q = request.search;
}
Expand Down Expand Up @@ -142,12 +146,12 @@ angular.module("jtt_aping_youtube").service('apingYoutubeHelper', ['apingModels'
if (_data.data.items) {
angular.forEach(_data.data.items, function (value, key) {
var tempResult;
if(_helperObject.getNativeData === true || _helperObject.getNativeData === "true") {
if (_helperObject.getNativeData === true || _helperObject.getNativeData === "true") {
tempResult = value;
} else {
tempResult = _this.getItemByJsonData(value, _helperObject.model);
}
if(tempResult) {
if (tempResult) {
requestResults.push(tempResult);
}
});
Expand Down Expand Up @@ -179,7 +183,7 @@ angular.module("jtt_aping_youtube").service('apingYoutubeHelper', ['apingModels'
$.extend(true, socialObject, {
blog_name: _item.snippet.channelTitle || undefined,
blog_id: _item.snippet.channelId || undefined,
blog_link: this.getThisPlatformLink()+"channel/" + _item.snippet.channelId,
blog_link: this.getThisPlatformLink() + "channel/" + _item.snippet.channelId,
intern_type: _item.id.kind,
intern_id: _item.id.videoId || _item.snippet.resourceId.videoId,
timestamp: apingTimeHelper.getTimestampFromDateString(_item.snippet.publishedAt, 1000, 7200),
Expand All @@ -201,8 +205,13 @@ angular.module("jtt_aping_youtube").service('apingYoutubeHelper', ['apingModels'
socialObject.type = "video";
socialObject.position = _item.snippet.position;
}

socialObject.source = '<iframe width="1280" height="720" src="https://www.youtube.com/embed/' + socialObject.intern_id + '?rel=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>';

socialObject.img_url = this.getYoutubeImageFromId(socialObject.intern_id);
socialObject.post_url = this.getThisPlatformLink()+"watch?v=" + socialObject.intern_id;
socialObject.thumb_url = this.getYoutubeImageFromId(socialObject.intern_id, 'default');
socialObject.native_url = this.getYoutubeImageFromId(socialObject.intern_id, 'maxresdefault');
socialObject.post_url = this.getThisPlatformLink() + "watch?v=" + socialObject.intern_id;
return socialObject;
};

Expand All @@ -211,7 +220,7 @@ angular.module("jtt_aping_youtube").service('apingYoutubeHelper', ['apingModels'
$.extend(true, videoObject, {
blog_name: _item.snippet.channelTitle || undefined,
blog_id: _item.snippet.channelId || undefined,
blog_link: this.getThisPlatformLink()+"channel/" + _item.snippet.channelId,
blog_link: this.getThisPlatformLink() + "channel/" + _item.snippet.channelId,
intern_type: _item.id.kind,
intern_id: _item.id.videoId || _item.snippet.resourceId.videoId,
timestamp: apingTimeHelper.getTimestampFromDateString(_item.snippet.publishedAt, 1000, 7200),
Expand All @@ -228,9 +237,11 @@ angular.module("jtt_aping_youtube").service('apingYoutubeHelper', ['apingModels'
}
}
videoObject.img_url = this.getYoutubeImageFromId(videoObject.intern_id);
videoObject.post_url = this.getThisPlatformLink()+"watch?v=" + videoObject.intern_id;
videoObject.thumb_url = this.getYoutubeImageFromId(videoObject.intern_id, 'default');
videoObject.native_url = this.getYoutubeImageFromId(videoObject.intern_id, 'maxresdefault');
videoObject.post_url = this.getThisPlatformLink() + "watch?v=" + videoObject.intern_id;
videoObject.position = _item.snippet.position;
videoObject.markup = '<iframe width="1280" height="720" src="https://www.youtube.com/embed/'+videoObject.intern_id+'?rel=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>';
videoObject.markup = '<iframe width="1280" height="720" src="https://www.youtube.com/embed/' + videoObject.intern_id + '?rel=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>';

return videoObject;
};
Expand Down
Loading

0 comments on commit 7f03527

Please sign in to comment.