marcelGoerentz / Threadfin

MIT License
3 stars 1 forks source link

The new Playlist Connection counter has an issue. (Starting from v1.3.0 and up) #22

Open Renkyz opened 1 month ago

Renkyz commented 1 month ago

The new Playlist Connection counter seems to have a bug where it shows connections incorrectly. In my experience, when a client first starts a stream, it all works normally and the counter goes from 0/X to 1/X. But when the client stops watching, it seems to subtract 2 from the counter so instead of displaying 0/X, it shows -1/X. I'm not certain if this only happens if the client loses connection because of a network issue or some sort of crash, or if they simply just stop watching of theirown accord. It may happen for both situations, I have not tested it thoroughly yet. I'm also not sure why the Client Connection counter seems to have it correct, at least for me it seems to keep track of how many clients are indeed connected. This may also be bugged but I've not seen it yet. I'll attach a screenshot showing what I am talking about.

Capture

marcelGoerentz commented 1 month ago

Okay, I‘ve fixed this bug for the other counter should not be a problem to do so for the playlist counter also 😄 I will ping you when I‘ll push a new release with the fix.

Renkyz commented 1 month ago

Nice, thanks Marcel! I also want to ask if there is there a way to toggle those connection counters off at all? Not an absolute must have for me, but just curious :)

marcelGoerentz commented 1 month ago

Right now, no. I could add this option or at least place this info at a less viewable place (bottom of the page or something like that). But to be honest this feature is coming from the original project. So if there are more people who don‘t want to see this information I will add an option to hide it. This will be the easiest for me to do.

Renkyz commented 1 month ago

It's not a big deal for me so I'm not too worried about. Thanks for your consideration :)

marcelGoerentz commented 4 weeks ago

Should be fixed now

Renkyz commented 4 weeks ago

Great! Will test it out now and wait for results. Thanks mate.

PilaScat commented 4 weeks ago

image not true, 0 client and 0 playlist

marcelGoerentz commented 4 weeks ago

@PilaScat I‘m not sure what you want to express with this screenshot. It does not match your text 🤔

PilaScat commented 4 weeks ago

@marcelGoerentz what I meant was that nobody is actually watching, he scores anyway

marcelGoerentz commented 4 weeks ago

@PilaScat Maybe this is related to your RAM problem. Can you send me the logs?

Renkyz commented 4 weeks ago

Should be fixed now

I have tested for a whole day and can not reproduce the bug I was seeing anymore. The counter now seems accurate for me.

Renkyz commented 4 weeks ago

Updated the title to reflect what version had the bug for me when I created this issue. I'm now on 1.3.1 where it seems fixed of course.

marcelGoerentz commented 4 weeks ago

Please close this issue when it has been fixed 😄

Renkyz commented 2 weeks ago

Capture

I noticed this the other day on 1.4.0. Not sure which versions are affected but I'm now on 1.4.1 and it still can happen. The playlist counter seems accurate but the client connections seem to get forgotten after some time and go back to 0, but playlist connection stays at the right number.

marcelGoerentz commented 2 weeks ago

Strange, I will check if I can find it.

Renkyz commented 2 weeks ago

If it is difficult to find the issue, I personally wouldn't worry too much about it seeing as it is purely a cosmetic feature for me haha. Hopefully it's easy to figure out.

Renkyz commented 2 weeks ago

So after further testing, it seems the issue appears after a connection interruption or something like that. Not conclusive yet but this seems to be the case. The playlist counter is able to keep track but not the client counter for some reason. But, considering that this bug can take many hours to appear (for example I have had a test stream running for roughly 6 hours without a problem), and only if a sort of connection interuption takes place, I would consider this to be a pretty edge case scenario and not anything close to a priority fix. If there is anything specific I can do with regard to more testing, please let me know :)

marcelGoerentz commented 2 weeks ago

Thank you but right now I think that should be fine.

marcelGoerentz commented 6 days ago

I think I'll have to rewrite the complete buffer logic as it is hard to maintain and a complete mess -.- This will take some time, but at the end it will make everything easier and eventually fix this bug also!

Renkyz commented 6 days ago

I am about to update to 1.5.0. So far I've still been noticing issues with the connection counter and my most recent observation is that the client connections can bug out if more than 1 person watches the same channel. I've had a hard time replicating it by using my own devices in my own house but as soon as my friend connects remotely yo the same channel as me, that's when it seems to be able to mess up the counter. Not sure how else to better describe the issue.

Renkyz commented 6 days ago

I'm not too bothered about the feature tbh. It's as useful as not having the feature at all haha. The only thing that would make it worthwhile to me is if it told me what exact channel/playlist is being watched.

marcelGoerentz commented 6 days ago

Ah this will be with the next update. I will update the API and then you can get a list of active channels sorted by playlist.

Renkyz commented 5 days ago

That will be great. Thanks again Marcel for all your work on this software. Myself and my friends who stream my city's local free to air TV channels from me really appreciate how well it is working for us haha.

marcelGoerentz commented 2 days ago

That will be great. Thanks again Marcel for all your work on this software. Myself and my friends who stream my city's local free to air TV channels from me really appreciate how well it is working for us haha.

Please have a look at the latest beta, there is the extended API.

Renkyz commented 1 day ago

Running the beta now. Not sure exactly what has changed but I tested the client counter and it seems easy to trick still.

Here's what I did:

Loaded my channel list via the DVR IP in VLC player Played the first channel and checked Threadfin which said 1 playlist counter and 1 client counter. Skipped to the 2nd channel and all of a sudden Threadfin said 1 playlist counter, but 0 client counter. If I hit stop in VLC and then wait 10-20 seconds, then play the same channel again, the counter goes back to being accurate it seems. I'm testing alone at the moment without my friend who lives a few hours away from me in a rural town. Once he is able to try some of the channels as well and I have more testing done, I will let you know any additional info that we come up with :)

Other than the playlist counter, everything else seems to be working great!

marcelGoerentz commented 1 day ago

Great to here, I didn‘t made changes to the Counter. But you can use this command to get the active playlists and channels from the API:

curl -X POST -H "Content-Type: application/json" -d '{"cmd":"getCurrentlyUsedChannels"}' http://localhost:34400/api/

Please adjust the url to your needs.

Thanks for all the testing.

Renkyz commented 1 day ago

How can I use that command? Do I execute it in cmd or something like that? I'm very unfamiliar with this sort of stuff, sorry haha.

Renkyz commented 1 day ago

It seems I just need to run it in cmd or powershell so I'll give that a go. By the way, the link to the API doccumentation leads to a 404 page for me. https://github.com/Threadfin/Threadfin-Documentation/blob/master/en/configuration.md#api

Renkyz commented 1 day ago

Also apparently Windows CMd doesn't like the single quotes.

C:\Users\Renkyz>curl -X POST -H "Content-Type: application/json" -d '{"cmd":"getCurrentlyUsedChannels"}' http://192.168.0.116:34400/api/
{
  "error": "invalid character '\\'' looking for beginning of value"
}

Changing it to double quotes fixed it.

C:\Users\Renkyz>curl -X POST -H "Content-Type: application/json" -d "{\"cmd\":\"getCurrentlyUsedChannels\"}" http://192.168.0.116:34400/api/
{
  "activeStreams": {
    "playlists": {}
  }
}

I'll go load up a channel on my spare machine and try again.

Renkyz commented 1 day ago

It works great. Just tested it running 2 different channels on 2 different machines. Both channels are in different playlists and running the command displayed all the information correctly :)

marcelGoerentz commented 1 day ago

Yes, in command line

marcelGoerentz commented 1 day ago

Good to hear 😄

marcelGoerentz commented 1 day ago

Yeah I have to create a new document for the API and fix the link