elieserdejesus / JamTaba

Jamtaba is a software to play online music jam sessions.
http://www.jamtaba.com
244 stars 50 forks source link

Jamroomview bots detection obsolete #1369

Open jonjamcam opened 3 years ago

jonjamcam commented 3 years ago

ATM ninbot is not sending bots as users via servers.php as it did before the crash.

For reference, part of the old code was:

{ "servers": [{ "name": "ninbot.com:2049", "stream": "http://ninbot.com:8000/2049", "wsi": "yes", "users": [ { "name": "ninbot", "img": "", "flag": "themes/ninbotty/icon-block.png", "ip": "", "uid": "613", "city": "", "reg": "", "lat": "", "lon": "", "co": "", "country": "" } , { "name": "LFG", "img": "", "flag": "files/pictures/flags/world/france.png", "ip": "90.65.65.x", "uid": "", "city": "", "reg": "", "lat": "48.86", "lon": "2.35", "co": "FR", "country": "France" } ] ,"user_count": "2" ,"user_max": "8" ,"topic": "nb help for commands" ,"bpi": "16" ,"bpm": "108" }, { "name": "ninbot.com:2050", "stream": "http://ninbot.com:8000/2050", "wsi": "yes", "users": [ { "name": "ninbot", "img": "", "flag": "themes/ninbotty/icon-block.png", "ip": "", "uid": "613", "city": "", "reg": "", "lat": "", "lon": "", "co": "", "country": "" } , { "name": "benjamin", "img": "", "flag": "files/pictures/flags/world/france.png", "ip": "77.150.15.x", "uid": "", "city": "", "reg": "", "lat": "48.86", "lon": "2.35", "co": "FR", "country": "France" } , { "name": "cecco", "img": "", "flag": "files/pictures/flags/world/italy.png", "ip": "79.26.135.x", "uid": "", "city": "Fiesole", "reg": "16", "lat": "43.8045", "lon": "11.2949", "co": "IT", "country": "Italy" } , { "name": "zygue", "img": "files/pictures/picture-2277.jpg", "flag": "

New code is different:

{"servers":[{"name":"ninbot.com:2049","bpi":"16","bpm":"120","user_max":"10","stream":"http://ninbot.com/radio/2049","users":[{"name":"walrus","ip":"213.47.147.x","lat":"48.20861053466797","lon":"16.374170303344727","country":"Austria","co":"AT","city":"Vienna","region":"Vienna","flag":"at.svg"},{"name":"bmo","ip":"73.99.198.x","lat":"37.54399871826172","lon":"-77.45069885253906","country":"United States","co":"US","city":"Highland Springs","region":"Virginia","flag":"us.svg"},{"name":"Schmi","ip":"74.15.141.x","lat":"45.49774932861328","lon":"-73.51455688476562","country":"Canada","co":"CA","city":"Longueuil","region":"Quebec","flag":"ca.svg"}]},{"name":"ninbot.com:2050","bpi":"16","bpm":"125","user_max":"10","stream":"http://ninbot.com/radio/2050","users":[]},{"name":"ninbot.com:2051","bpi":"32","bpm":"110","user_max":"10","stream":"http://ninbot.com/radio/2051","users":[]},

This means room capacity is not computed correctly in ninbot and ninjamer (only sites who use bots). Bot name is missing:

"users": [ { "name": "ninbot", "img": "", "flag": "themes/ninbotty/icon-block.png", "ip": "", "uid": "613", "city": "", "reg": "", "lat": "", "lon": "", "co": "", "country": "" }

Suggestion: keep inside server bot detection as it is now, but replace jamroomview method (subtract bots) for simpler one: detect server containing ninbot or ninjamer and subtract one slot.

I tested this solution and it's working fine, but my hack is pretty dirty :/ (https://github.com/elieserdejesus/JamTaba/commit/0074f42a0eb301856d55ee10ffbc6eb78a3ac604)

PR https://github.com/elieserdejesus/JamTaba/pull/1370

Ps. Ninbot "bot" is now called "ninbot_"