mirror of
				https://github.com/KevinMidboe/zoff.git
				synced 2025-10-29 18:00:23 +00:00 
			
		
		
		
	Added by on suggested songs
This commit is contained in:
		@@ -30,6 +30,7 @@ var project_object = {
 | 
				
			|||||||
  duration: 1,
 | 
					  duration: 1,
 | 
				
			||||||
  end: 1,
 | 
					  end: 1,
 | 
				
			||||||
  type: 1,
 | 
					  type: 1,
 | 
				
			||||||
 | 
					  added_by: { $ifNull: ["$added_by", "Anonymous"] },
 | 
				
			||||||
  source: { $ifNull: ["$source", "youtube"] },
 | 
					  source: { $ifNull: ["$source", "youtube"] },
 | 
				
			||||||
  thumbnail: {
 | 
					  thumbnail: {
 | 
				
			||||||
    $ifNull: [
 | 
					    $ifNull: [
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -71,6 +71,16 @@ function getAndSendLogs(channel, all, socket, pass, query) {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function getUserNameByGuid(guid, callback) {
 | 
				
			||||||
 | 
					  db.collection("user_names").find({ guid: guid }, function(err, usernames) {
 | 
				
			||||||
 | 
					    if (usernames.length == 1) {
 | 
				
			||||||
 | 
					      callback(usernames[0].name);
 | 
				
			||||||
 | 
					      return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    callback("Anonymous");
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function chat(msg, guid, offline, socket) {
 | 
					function chat(msg, guid, offline, socket) {
 | 
				
			||||||
  if (
 | 
					  if (
 | 
				
			||||||
    typeof msg !== "object" ||
 | 
					    typeof msg !== "object" ||
 | 
				
			||||||
@@ -909,6 +919,7 @@ function get_name_generate(guid, announce_payload, first, channel) {
 | 
				
			|||||||
  });
 | 
					  });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module.exports.getUserNameByGuid = getUserNameByGuid;
 | 
				
			||||||
module.exports.get_history = get_history;
 | 
					module.exports.get_history = get_history;
 | 
				
			||||||
module.exports.chat = chat;
 | 
					module.exports.chat = chat;
 | 
				
			||||||
module.exports.all_chat = all_chat;
 | 
					module.exports.all_chat = all_chat;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,6 +2,7 @@ var Functions = require(pathThumbnails + "/handlers/functions.js");
 | 
				
			|||||||
var List = require(pathThumbnails + "/handlers/list.js");
 | 
					var List = require(pathThumbnails + "/handlers/list.js");
 | 
				
			||||||
var Frontpage = require(pathThumbnails + "/handlers/frontpage.js");
 | 
					var Frontpage = require(pathThumbnails + "/handlers/frontpage.js");
 | 
				
			||||||
var Search = require(pathThumbnails + "/handlers/search.js");
 | 
					var Search = require(pathThumbnails + "/handlers/search.js");
 | 
				
			||||||
 | 
					var Chat = require(pathThumbnails + "/handlers/chat.js");
 | 
				
			||||||
var crypto = require("crypto");
 | 
					var crypto = require("crypto");
 | 
				
			||||||
var Filter = require("bad-words");
 | 
					var Filter = require("bad-words");
 | 
				
			||||||
var filter = new Filter({ placeHolder: "x" });
 | 
					var filter = new Filter({ placeHolder: "x" });
 | 
				
			||||||
@@ -819,6 +820,7 @@ function add_function(arr, coll, guid, offline, socket) {
 | 
				
			|||||||
          var source = arr.source;
 | 
					          var source = arr.source;
 | 
				
			||||||
          var tags = arr.tags;
 | 
					          var tags = arr.tags;
 | 
				
			||||||
          conf = docs;
 | 
					          conf = docs;
 | 
				
			||||||
 | 
					          Chat.getUserNameByGuid(guid, function(username) {
 | 
				
			||||||
            if (
 | 
					            if (
 | 
				
			||||||
              docs !== null &&
 | 
					              docs !== null &&
 | 
				
			||||||
              docs.length !== 0 &&
 | 
					              docs.length !== 0 &&
 | 
				
			||||||
@@ -854,7 +856,8 @@ function add_function(arr, coll, guid, offline, socket) {
 | 
				
			|||||||
                        start: parseInt(start),
 | 
					                        start: parseInt(start),
 | 
				
			||||||
                        end: parseInt(end),
 | 
					                        end: parseInt(end),
 | 
				
			||||||
                        type: "video",
 | 
					                        type: "video",
 | 
				
			||||||
                      source: source
 | 
					                        source: source,
 | 
				
			||||||
 | 
					                        added_by: username
 | 
				
			||||||
                      };
 | 
					                      };
 | 
				
			||||||
                      if (source == "soundcloud") {
 | 
					                      if (source == "soundcloud") {
 | 
				
			||||||
                        if (
 | 
					                        if (
 | 
				
			||||||
@@ -942,7 +945,8 @@ function add_function(arr, coll, guid, offline, socket) {
 | 
				
			|||||||
                    start: start,
 | 
					                    start: start,
 | 
				
			||||||
                    end: end,
 | 
					                    end: end,
 | 
				
			||||||
                    type: "suggested",
 | 
					                    type: "suggested",
 | 
				
			||||||
                  tags: tags
 | 
					                    tags: tags,
 | 
				
			||||||
 | 
					                    added_by: username
 | 
				
			||||||
                  };
 | 
					                  };
 | 
				
			||||||
                  var source = arr.source;
 | 
					                  var source = arr.source;
 | 
				
			||||||
                  if (source == "soundcloud") {
 | 
					                  if (source == "soundcloud") {
 | 
				
			||||||
@@ -962,6 +966,10 @@ function add_function(arr, coll, guid, offline, socket) {
 | 
				
			|||||||
                      if (source == "soundcloud")
 | 
					                      if (source == "soundcloud")
 | 
				
			||||||
                        toSend.thumbnail = arr.thumbnail;
 | 
					                        toSend.thumbnail = arr.thumbnail;
 | 
				
			||||||
                      io.to(coll).emit("suggested", toSend);
 | 
					                      io.to(coll).emit("suggested", toSend);
 | 
				
			||||||
 | 
					                      if (source != "soundcloud")
 | 
				
			||||||
 | 
					                        Search.get_correct_info(suggestedAdd, coll, false);
 | 
				
			||||||
 | 
					                      else if (source == "soundcloud")
 | 
				
			||||||
 | 
					                        Search.get_genres_soundcloud(suggestedAdd, coll);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                  );
 | 
					                  );
 | 
				
			||||||
                } else if (docs[0].now_playing === true) {
 | 
					                } else if (docs[0].now_playing === true) {
 | 
				
			||||||
@@ -972,6 +980,7 @@ function add_function(arr, coll, guid, offline, socket) {
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
              });
 | 
					              });
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					          });
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
          if (
 | 
					          if (
 | 
				
			||||||
            (arr.hasOwnProperty("offsiteAdd") && !arr.offsiteAdd) ||
 | 
					            (arr.hasOwnProperty("offsiteAdd") && !arr.offsiteAdd) ||
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,10 +36,6 @@ var Suggestions = {
 | 
				
			|||||||
    var video_title = params.title;
 | 
					    var video_title = params.title;
 | 
				
			||||||
    var date = new Date(params.added * 1000);
 | 
					    var date = new Date(params.added * 1000);
 | 
				
			||||||
    var addedTime =
 | 
					    var addedTime =
 | 
				
			||||||
      Helper.pad(date.getHours()) +
 | 
					 | 
				
			||||||
      ":" +
 | 
					 | 
				
			||||||
      Helper.pad(date.getMinutes()) +
 | 
					 | 
				
			||||||
      " - " +
 | 
					 | 
				
			||||||
      Helper.pad(date.getDate()) +
 | 
					      Helper.pad(date.getDate()) +
 | 
				
			||||||
      "." +
 | 
					      "." +
 | 
				
			||||||
      Helper.pad(date.getMonth()) +
 | 
					      Helper.pad(date.getMonth()) +
 | 
				
			||||||
@@ -53,6 +49,9 @@ var Suggestions = {
 | 
				
			|||||||
      votes: addedTime,
 | 
					      votes: addedTime,
 | 
				
			||||||
      extra: "Added"
 | 
					      extra: "Added"
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					    if (params.added_by != undefined) {
 | 
				
			||||||
 | 
					      toSend.extra += " by " + params.added_by;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    if (params.source) toSend.source = params.source;
 | 
					    if (params.source) toSend.source = params.source;
 | 
				
			||||||
    else {
 | 
					    else {
 | 
				
			||||||
      toSend.source = "youtube";
 | 
					      toSend.source = "youtube";
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user