WarmUpTill / SceneSwitcher

An automated scene switcher for OBS Studio
https://obsproject.com/forum/resources/automatic-scene-switching.395/
GNU General Public License v2.0
920 stars 71 forks source link

ADD Automatic Twitch GameName Changer #330

Closed cyclemat closed 1 year ago

cyclemat commented 2 years ago

is it possible to intigrate an function to set the Twitch game section automatic with the scene so when the scene change the game name change ?

i and many friends have on scene per game with backgrount for it so the desktop never show but is was cool when you change to a scene the gamename change on twitch

WarmUpTill commented 2 years ago

Thanks for the suggestion! I will look into it.

As a note: It might be already possible using the "Run" action to run a curl command, but that will probably be rather complicated. https://discuss.dev.twitch.tv/t/using-curl-to-set-game-category-using-channel-update/25184/3

cyclemat commented 2 years ago

have found a plugin that works but 10 moths not updated and its shows only like a poc no dock only a frame window and more problem here is he try to read the gamename but many games like beta games have other name in the programm title so you must give the game manually in

https://github.com/GhBogdan97/obs-twitch-category-manager

markonop93 commented 1 year ago

yes pls!

WarmUpTill commented 1 year ago

I finally found some time to look into this. A build with the functionality to change the stream title and stream category can be found here: https://github.com/WarmUpTill/SceneSwitcher/actions/runs/5880188307?pr=823

Twitch

Unfortunately I ran into some linking issues on MacOS due to dependencies to OpenSSL and thus this functionality is not available for this version of the plugin for now.

Please let me know if this works as expected or if you are facing issues! And sorry for taking forever to get around to this!

Destroy666x commented 1 year ago

Thanks! Things I've noticed so far:

No problems with setting the title I noticed. Too bad that the internal OBS widget doesn't refresh with these though as it's a bit cumbersome to test when offline.

Destroy666x commented 1 year ago

Actually, the Duelyst II category shows but couldn't be searched the 1st few times I tried. Now search started working. Or it didn't show before maybe, I don't know, I browsed once and didn't notice it on the list at least.

WarmUpTill commented 1 year ago

Thanks a lot for your tests!

OBS Studio crashed the first time I tried to request a token and browser said it was redirecting me. I clicked the Account name and Token unenterable fields beforehand, which was the only difference to when it worked fine the 2nd time

OBS crashed at least once when attempting to switch category (stream was offline)

Can you please share the crash logs?

categories load extremely slowly the 1st time OBS is launch, hanging OBS for 15-20 seconds

Yeah there is not much I can do here unfortunately :( That is just how long it takes to fetch all of the games supported by Twitch. They are cached afterwards, which is why it only takes so long for the first time.

Twtitch typo in action dropdown

Cheers :)

Destroy666x commented 1 year ago

Can you please share the crash logs?

Which ones are these? If you mean OBS ->Help -> Crahs reports -> crashes folder, I don't see anything there, other than one very old file.

Yeah there is not much I can do here unfortunately :( That is just how long it takes to fetch all of the games supported by Twitch. They are cached afterwards, which is why it only takes so long for the first time.

I see, that's not great job by Twitch API then.

WarmUpTill commented 1 year ago

Which ones are these? If you mean OBS ->Help -> Crahs reports -> crashes folder, I don't see anything there, other than one very old file.

Yeah correct. What exactly happened when OBS crashed? Did the program exit on its own? Did the window not react to inputs anymore?

I see, that's not great job by Twitch API then.

Not really their fault. There are just too many games :D Maybe I can add an option to only fetch the top 500 most played games instead of all of them to speed things up.

Destroy666x commented 1 year ago

What exactly happened when OBS crashed?

The window closed in the background and I had to relaunch it with "OBS is still running" popup displayed (but only the processes were running, UI wasn't in task bar/tray/anywhere).

For the token registration one, it also didn't register the token then. For the category one, it was changed. No crashes since then, let's see if it'll happen when live :P

Not really their fault. There are just too many games :D

I guess, but even for that big of data it's quite slow, I assume it loads also more data than the names? Is it this? https://dev.twitch.tv/docs/api/reference/#search-categories

Ah no, I see it's /helix/games/top, one of the files wasn't loaded in diff which I didn't notice. That's maybe also why Duelyst II wasn't available. And I guess these won't be either: https://discuss.dev.twitch.tv/t/is-it-possible-to-get-the-id-or-list-of-all-non-game-related-categories-created-by-twitch-just-chatting-art-etc/43321/3

Maybe I can add an option to only fetch the top 500 most played games instead of all of them to speed things up.

Or perhaps cross-session cache that you can manuall refresh could work.

WarmUpTill commented 1 year ago

I reworked the category selection to support displaying a dialog which shows the current amount of categories fetched and offers the option to stop fetching more games.

A new build will be available here in a few minutes: https://github.com/WarmUpTill/SceneSwitcher/actions/runs/5907294035?pr=823

Let me know what you think!

cyclemat commented 1 year ago

looks very good that is THE thing good work in the moment i didnt have time to stream so i had testet not in live mode but its looks very good !

Destroy666x commented 1 year ago

Nice much more clear/cleaner solution :)

The only bad thing now is that not all games are loaded. Again it missed Duelyst II when I tested few times. It appeared on 7th try, each time it fetched different number of games, which I guess is the problem (don't know if with the API or fetching algorithm).

Also, I livestreamed with previous version for few hours + 2 stream category change actions and had 0 crashes. So I guess they just happened at the start.

WarmUpTill commented 1 year ago

Again it missed Duelyst II when I tested few times.

I think the problem is that categories with no viewers are not returned by the "Get Top Games" query, which is quite annoying. I will see if I can find a workround.

WarmUpTill commented 1 year ago

I added a small search button to manually search for additional categories:

Capture

Couldn't really think of a better solution.

A build will be available here in a few minutes: https://github.com/WarmUpTill/SceneSwitcher/actions/runs/5951391271?pr=823

Let me know if you run into any issues! :)

Destroy666x commented 1 year ago

Something seems not right. I can't get search results to display. And search results number went down from 5 to 0 in a matter of minute of trying few times, for "just" keyword.

Unless it adds the found games to the list. But then no idea why it was like 5 -> 3 -> 1 -> 1 -> 0

WarmUpTill commented 1 year ago

Unless it adds the found games to the list. But then no idea why it was like 5 -> 3 -> 1 -> 1 -> 0

That is indeed how it works. It simply adds the new categories to the list. I probably need to make that more clear.

The progress dialog only displays the number of new items inserted. So if you have already searched for a given term then it likely won't any new entries. (Unless the Twitch API would abort the previous search due to e.g. rate limiting)

Destroy666x commented 1 year ago

Ok, seems to work fine then from what I see, except some cases like mentioned 3 new reported results for the same search which got 5 items before.

WarmUpTill commented 1 year ago

A new build, which displays another dialog when the search is done and informs that the new results were added to the list, can be found here in a few minutes: ~https://github.com/WarmUpTill/SceneSwitcher/actions/runs/5955422627~ https://github.com/WarmUpTill/SceneSwitcher/actions/runs/5955838687?pr=823

except some cases like mentioned 3 new reported results for the same search which got 5 items before.

I see that as well. To be honest I am not sure what is causing this. Maybe it is some race condition on my end that I simply have not found yet.

Destroy666x commented 1 year ago

Ah ok 👍

WarmUpTill commented 1 year ago

except some cases like mentioned 3 new reported results for the same search which got 5 items before.

If I am not misinterpreting my test results, it seems like the /helix/search/categories Twitch API simply returns different results for the same query occasionally. The amount of items returned by the query seems to always stay the same, but order and sometimes the content seem to differ, which leads to the strange behaviour you observed.

So unfortunately there is not much that can be done about that besides searching for the same term multiple times.


If no other issues popped up on your end I will merge the changes to the main branch :)

WarmUpTill commented 1 year ago

I now also added the option to start a commercial.

image

Unfortunately, I am not able to test it as I don't have access to a live partner or affiliate account on Twitch. Would you be able to test this, in case you have the option to do so?

Note that you will have to request a new token with the corresponding permission to start commercials.

A build with this feature is available here: https://github.com/WarmUpTill/SceneSwitcher/actions/runs/6064476012

Destroy666x commented 1 year ago

@WarmUpTill I see that was merged into master, if you could update https://github.com/WarmUpTill/SceneSwitcher/pull/855 with master changes then I'll gladly test!

WarmUpTill commented 1 year ago

Thanks!

A rebased build of #855 will be available here in a few minutes: https://github.com/WarmUpTill/SceneSwitcher/actions/runs/6101694126?pr=855

Destroy666x commented 1 year ago

@WarmUpTill the duration is in mins, right? Could be labeled better is my small suggestion for now. I'll test if it works on tomorrow's stream

WarmUpTill commented 1 year ago

the duration is in mins, right?

It is in seconds.

Could be labeled better is my small suggestion for now.

Yes, you are right.

Destroy666x commented 1 year ago

Seemed to work fine for me @WarmUpTill

WarmUpTill commented 1 year ago

Great! Thanks a lot for your help in getting this tested!