Fix #305
This commit is contained in:
parent
22e2180790
commit
436df375c7
5 changed files with 94 additions and 50 deletions
|
|
@ -1451,6 +1451,14 @@ Channel.prototype.addMedia = function(data, user) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (m.restricted) {
|
||||
user.socket.emit("queueWarn", {
|
||||
msg: "This video is blocked in the following countries: " +
|
||||
m.restricted,
|
||||
link: $util.formatLink(m.id, m.type)
|
||||
});
|
||||
}
|
||||
|
||||
var item = res.item;
|
||||
self.logger.log("### " + user.name + " queued " +
|
||||
item.media.title);
|
||||
|
|
|
|||
|
|
@ -109,9 +109,18 @@ var Getters = {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
var seconds = data.entry.media$group.yt$duration.seconds;
|
||||
var title = data.entry.title.$t;
|
||||
var media = new Media(id, title, seconds, "yt");
|
||||
if (data.entry.media$group.media$restriction) {
|
||||
var rest = data.entry.media$group.media$restriction;
|
||||
if (rest.length > 0) {
|
||||
if (rest[0].relationship === "deny") {
|
||||
media.restricted = rest[0].$t;
|
||||
}
|
||||
}
|
||||
}
|
||||
callback(false, media);
|
||||
} catch(e) {
|
||||
// Gdata version 2 has the rather silly habit of
|
||||
|
|
|
|||
12
lib/user.js
12
lib/user.js
|
|
@ -332,6 +332,18 @@ User.prototype.initCallbacks = function () {
|
|||
});
|
||||
} else {
|
||||
self.channel.search(data.query, function (vids) {
|
||||
if (vids.length === 0) {
|
||||
var searchfn = InfoGetter.Getters.ytSearch;
|
||||
searchfn(data.query.split(" "), function (e, vids) {
|
||||
if (!e) {
|
||||
self.socket.emit("searchResults", {
|
||||
source: "yt",
|
||||
results: vids
|
||||
});
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
self.socket.emit("searchResults", {
|
||||
source: "library",
|
||||
results: vids
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue