Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

Commit

Permalink
v1.1.0.4 Release
Browse files Browse the repository at this point in the history
Fixed bug where channels display videos in the incorrect order
  • Loading branch information
Wassup789 committed Dec 27, 2015
1 parent 6b89dc1 commit 74673ba
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Changelog
## v1.1.0.4 (XX-XX-2015)
* Decreased update interval from every 10 minutes to every 5 minutes
* Fixed channel information not updating properly
* Fixed videos not showing the right video order for notifications and displays
## v1.1.0.3 (10-27-2015)
* Implemented 'Add to YouTube Notifications" button to videos, channels and subscription lists
* Added a first launch screen
Expand Down
12 changes: 10 additions & 2 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ function checkYoutubeStatus(){
}
},
error: function(XMLHttpRequest, textStatus, error) {
if(XMLHttpRequest.statusText != "OK"){
if(XMLHttpRequest.statusText != "OK" && XMLHttpRequest.status != 404){
wyn.isConnected = false;
chrome.extension.sendMessage({type: "createSnackbar", message: wyn.strings.connect_failed});
console.log(wyn.strings.log_color_prefix + wyn.strings.connect_failed, wyn.strings.log_color_green);
Expand Down Expand Up @@ -358,7 +358,7 @@ function checkYoutube(num, refresh, batch) {
wyn.activeCheckings[num] = true;

var channels = JSON.parse(localStorage.getItem("channels"));
var url = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=1&playlistId=" + channels[num].playlistId + "&key=" + wyn.apiKey;
var url = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=5&playlistId=" + channels[num].playlistId + "&key=" + wyn.apiKey;

console.log(wyn.strings.notification_log_check + channels[num].name);
$.ajax({
Expand All @@ -367,6 +367,14 @@ function checkYoutube(num, refresh, batch) {
wyn.activeCheckings[num] = false;
},
success: function(data) {
data.items.sort(function(a, b){
var a = new Date(a.snippet.publishedAt),
b = new Date(b.snippet.publishedAt);
if(a > b) return -1;
if(a < b) return 1;
return 0;
});

var videoId = data.items[0].snippet.resourceId.videoId,
url = "https://www.googleapis.com/youtube/v3/videos?part=statistics,contentDetails&maxResults=1&id=" + videoId + "&key=" + wyn.apiKey,
prevVideoId = channels[num].latestVideo.id;
Expand Down
8 changes: 8 additions & 0 deletions js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,14 @@ function getChannelVideos(){
* @param {object} data The data recived from function: getChannelVideos
*/
function setChannelVideos(data){
data.sort(function(a, b){
var a = a.timestamp,
b = b.timestamp;
if(a > b) return -1;
if(a < b) return 1;
return 0;
});

for(var i = 0; i < data.length; i++) {
var date = new Date(parseInt(data[i].timestamp)*1000);
date = timeSince(date);
Expand Down
2 changes: 2 additions & 0 deletions settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ <h2 class="mdl-card__title-text">Changelog</h2>
<div class="card-header">v1.1.0.4</div>
<ul>
<li>Decreased update interval from every 10 minutes to every 5 minutes</li>
<li>Fixed channel information not updating properly</li>
<li>Fixed videos not showing the right order</li>
</ul>
</div>
<div class="mdl-card__actions mdl-card--border">
Expand Down

0 comments on commit 74673ba

Please sign in to comment.