diff options
| -rw-r--r-- | build/server.js | 9 | ||||
| -rw-r--r-- | default-config.json | 3 | ||||
| -rw-r--r-- | res/client.js | 30 | ||||
| -rw-r--r-- | src/Types.hx | 1 | ||||
| -rw-r--r-- | src/client/Main.hx | 4 | ||||
| -rw-r--r-- | src/client/players/Youtube.hx | 3 |
6 files changed, 34 insertions, 16 deletions
diff --git a/build/server.js b/build/server.js index 45164db..2050377 100644 --- a/build/server.js +++ b/build/server.js @@ -1437,7 +1437,7 @@ JsonParser_$52.__name__ = true; JsonParser_$52.__super__ = json2object_reader_BaseParser; JsonParser_$52.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { - this.errors.push(json2object_Error.IncorrectType(variable,"{ youtubeApiKey : String, userVideoLimit : Int, totalVideoLimit : Int, templateUrl : String, serverChatHistory : Int, ?salt : Null<String>, port : Int, permissions : { user : Array<Permission>, leader : Array<Permission>, guest : Array<Permission>, admin : Array<Permission> }, maxMessageLength : Int, maxLoginLength : Int, localAdmins : Bool, ?isVerbose : Null<Bool>, filters : Array<Filter>, emotes : Array<Emote>, channelName : String }",pos)); + this.errors.push(json2object_Error.IncorrectType(variable,"{ youtubePlaylistLimit : Int, youtubeApiKey : String, userVideoLimit : Int, totalVideoLimit : Int, templateUrl : String, serverChatHistory : Int, ?salt : Null<String>, port : Int, permissions : { user : Array<Permission>, leader : Array<Permission>, guest : Array<Permission>, admin : Array<Permission> }, maxMessageLength : Int, maxLoginLength : Int, localAdmins : Bool, ?isVerbose : Null<Bool>, filters : Array<Filter>, emotes : Array<Emote>, channelName : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { @@ -1445,7 +1445,7 @@ JsonParser_$52.prototype = $extend(json2object_reader_BaseParser.prototype,{ } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); - this.objectSetupAssign(assigned,["channelName","emotes","filters","isVerbose","localAdmins","maxLoginLength","maxMessageLength","permissions","port","salt","serverChatHistory","templateUrl","totalVideoLimit","userVideoLimit","youtubeApiKey"],[false,false,false,true,false,false,false,false,false,true,false,false,false,false,false]); + this.objectSetupAssign(assigned,["channelName","emotes","filters","isVerbose","localAdmins","maxLoginLength","maxMessageLength","permissions","port","salt","serverChatHistory","templateUrl","totalVideoLimit","userVideoLimit","youtubeApiKey","youtubePlaylistLimit"],[false,false,false,true,false,false,false,false,false,true,false,false,false,false,false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { @@ -1497,6 +1497,9 @@ JsonParser_$52.prototype = $extend(json2object_reader_BaseParser.prototype,{ case "youtubeApiKey": this.value.youtubeApiKey = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"youtubeApiKey",assigned,this.value.youtubeApiKey,pos); break; + case "youtubePlaylistLimit": + this.value.youtubePlaylistLimit = this.loadObjectField(($_=new JsonParser_$42(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"youtubePlaylistLimit",assigned,this.value.youtubePlaylistLimit,pos); + break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } @@ -1504,7 +1507,7 @@ JsonParser_$52.prototype = $extend(json2object_reader_BaseParser.prototype,{ this.objectErrors(assigned,pos); } ,getAuto: function() { - return { channelName : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), emotes : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), filters : new JsonParser_$57([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isVerbose : new JsonParser_$46([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), localAdmins : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxLoginLength : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxMessageLength : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), permissions : new JsonParser_$58([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), port : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), salt : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), serverChatHistory : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), templateUrl : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), totalVideoLimit : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), userVideoLimit : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubeApiKey : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; + return { channelName : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), emotes : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), filters : new JsonParser_$57([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isVerbose : new JsonParser_$46([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), localAdmins : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxLoginLength : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxMessageLength : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), permissions : new JsonParser_$58([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), port : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), salt : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), serverChatHistory : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), templateUrl : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), totalVideoLimit : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), userVideoLimit : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubeApiKey : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubePlaylistLimit : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$52 }); diff --git a/default-config.json b/default-config.json index 7360e1d..3dc1b2f 100644 --- a/default-config.json +++ b/default-config.json @@ -7,8 +7,9 @@ "totalVideoLimit": 0, "userVideoLimit": 0, "localAdmins": true, - "templateUrl": "https://www.youtube.com/watch?v=craeyJdrCsE", + "templateUrl": "https://youtube.com/playlist?list=PL9FiZUDVMu9tc_85frYognMOVFC_-VkSX", "youtubeApiKey": "AIzaSyDTk1OPRI9cDkAK_BKsBcv10DQCHse-QaA", + "youtubePlaylistLimit": 50, "permissions": { "guest": ["writeChat", "addVideo", "removeVideo", "changeOrder", "requestLeader", "rewind"], "user": ["guest"], diff --git a/res/client.js b/res/client.js index c3e9d60..5e4f8b3 100644 --- a/res/client.js +++ b/res/client.js @@ -1,4 +1,4 @@ -// Generated by Haxe 4.1.1 +// Generated by Haxe 4.1.4 (function ($hx_exports, $global) { "use strict"; $hx_exports["client"] = $hx_exports["client"] || {}; $hx_exports["client"]["JsApi"] = $hx_exports["client"]["JsApi"] || {}; @@ -453,7 +453,7 @@ client_Buttons.init = function(main) { }; var userList = window.document.querySelector("#userlist"); userList.onclick = function(e) { - if(!((main.personal.group & 4) != 0)) { + if((main.personal.group & 4) == 0) { return; } var el = e.target; @@ -684,7 +684,7 @@ client_Buttons.initHotkeys = function(main,player) { window.document.querySelector("#leader_btn").onclick(); break; case 80: - if(!((main.personal.group & 2) != 0)) { + if((main.personal.group & 2) == 0) { client_JsApi.once("SetLeader",function(event) { if(event.setLeader.clientName == main.personal.name) { player.pause(); @@ -1003,7 +1003,7 @@ client_Main.prototype = { var _gthis = this; client_Buttons.init(this); window.document.querySelector("#leader_btn").onclick = function(e) { - _gthis.setLeaderButton(!((_gthis.personal.group & 2) != 0)); + _gthis.setLeaderButton((_gthis.personal.group & 2) == 0); _gthis.send({ type : "SetLeader", setLeader : { clientName : (_gthis.personal.group & 2) != 0 ? "" : _gthis.personal.name}}); }; window.document.querySelector("#voteskip").onclick = function(e) { @@ -1670,7 +1670,11 @@ client_Main.prototype = { } this.onBlinkTab = new haxe_Timer(1000); this.onBlinkTab.run = function() { - window.document.title = StringTools.startsWith(window.document.title,_gthis.pageTitle) ? title : _gthis.getPageTitle(); + if(StringTools.startsWith(window.document.title,_gthis.pageTitle)) { + window.document.title = title; + } else { + window.document.title = _gthis.getPageTitle(); + } }; this.onBlinkTab.run(); } @@ -1712,6 +1716,9 @@ client_Main.prototype = { ,getYoutubeApiKey: function() { return this.config.youtubeApiKey; } + ,getYoutubePlaylistLimit: function() { + return this.config.youtubePlaylistLimit; + } ,isVerbose: function() { return this.config.isVerbose; } @@ -1848,13 +1855,13 @@ client_Player.prototype = { this.isLoaded = true; } ,onPlay: function() { - if(!((this.main.personal.group & 2) != 0)) { + if((this.main.personal.group & 2) == 0) { return; } this.main.send({ type : "Play", play : { time : this.getTime()}}); } ,onPause: function() { - if(!((this.main.personal.group & 2) != 0)) { + if((this.main.personal.group & 2) == 0) { return; } this.main.send({ type : "Pause", pause : { time : this.getTime()}}); @@ -1864,7 +1871,7 @@ client_Player.prototype = { this.skipSetTime = false; return; } - if(!((this.main.personal.group & 2) != 0)) { + if((this.main.personal.group & 2) == 0) { return; } this.main.send({ type : "SetTime", setTime : { time : this.getTime()}}); @@ -1874,7 +1881,7 @@ client_Player.prototype = { this.skipSetRate = false; return; } - if(!((this.main.personal.group & 2) != 0)) { + if((this.main.personal.group & 2) == 0) { return; } this.main.send({ type : "SetRate", setRate : { rate : this.getPlaybackRate()}}); @@ -2571,7 +2578,8 @@ client_players_Youtube.prototype = { ,getPlaylistVideoData: function(data,callback) { var _gthis = this; var id = this.extractPlaylistId(data.url); - var http = new haxe_http_HttpJs("" + this.playlistUrl + this.urlVideoId + "&maxResults=50&playlistId=" + id + "&key=" + this.apiKey); + var maxResults = this.main.getYoutubePlaylistLimit(); + var http = new haxe_http_HttpJs("" + this.playlistUrl + this.urlVideoId + "&maxResults=" + maxResults + "&playlistId=" + id + "&key=" + this.apiKey); http.onData = function(text) { var json = JSON.parse(text); if(json.error != null) { @@ -2624,7 +2632,7 @@ client_players_Youtube.prototype = { } callback({ duration : _gthis.tempYoutube.getDuration()}); }, onError : function(e) { - haxe_Log.trace("Error " + e.data,{ fileName : "src/client/players/Youtube.hx", lineNumber : 191, className : "client.players.Youtube", methodName : "getRemoteDataFallback"}); + haxe_Log.trace("Error " + e.data,{ fileName : "src/client/players/Youtube.hx", lineNumber : 192, className : "client.players.Youtube", methodName : "getRemoteDataFallback"}); if(_gthis.playerEl.contains(video)) { _gthis.playerEl.removeChild(video); } diff --git a/src/Types.hx b/src/Types.hx index f9bc104..76e811b 100644 --- a/src/Types.hx +++ b/src/Types.hx @@ -25,6 +25,7 @@ typedef Config = { localAdmins:Bool, templateUrl:String, youtubeApiKey:String, + youtubePlaylistLimit:Int, permissions:{ guest:Array<Permission>, user:Array<Permission>, diff --git a/src/client/Main.hx b/src/client/Main.hx index b714b38..6c40b6c 100644 --- a/src/client/Main.hx +++ b/src/client/Main.hx @@ -837,6 +837,10 @@ class Main { return config.youtubeApiKey; } + public function getYoutubePlaylistLimit():Int { + return config.youtubePlaylistLimit; + } + public function isVerbose():Bool { return config.isVerbose; } diff --git a/src/client/players/Youtube.hx b/src/client/players/Youtube.hx index 45f74dd..2061585 100644 --- a/src/client/players/Youtube.hx +++ b/src/client/players/Youtube.hx @@ -125,7 +125,8 @@ class Youtube implements IPlayer { function getPlaylistVideoData(data:VideoDataRequest, callback:(data:VideoData)->Void):Void { final url = data.url; final id = extractPlaylistId(url); - final dataUrl = '$playlistUrl$urlVideoId&maxResults=50&playlistId=$id&key=$apiKey'; + final maxResults = main.getYoutubePlaylistLimit(); + final dataUrl = '$playlistUrl$urlVideoId&maxResults=$maxResults&playlistId=$id&key=$apiKey'; final http = new Http(dataUrl); http.onData = text -> { final json = Json.parse(text); |
