Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.

app.js -> Add ability to specify 3 'high priority' channels to watch #81

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

RFBomb
Copy link

@RFBomb RFBomb commented Aug 13, 2020

I wanted to re-work this to watch Twitch.tv/warframe, and after poking through the code, I feel like it could work great. The only hiccup would be actually getting the specific channel that I want to watch, instead of the random channels.

The changes include several new routines:

  • ViewPriority -> This is now the main loop (instead of ViewRandomPage being the main loop). It allows checking for several high-priority streams to view before viewing any random channels.

  • ViewURL -> I moved all of the pertinent code from the ViewRandomPage routine into this new routine. This is what will allow specific channels to be watched, while keeping the total code smaller (and mostly the same)

  • CheckStreamerOnline -> This routine is mocked up, but I'll be honest that I am unsure of how to perform this check at the moment. This routine would return a boolean TRUE if the requested stream is online. The ViewPriority routine would then call the ViewURL to go to that stream.

  • SleepWatching -> This routine checks if there are any high priority streams running. If there is a higher priority stream running, it will stop sleeping and allow the ViewPriority loop to decide which page to go to next. If no high priority stream is running it will run out the sleep timer in 1 minute increments, checking for higher priorities each loop.

Since this new code will support up to three 'high priority' channels, and I know some people have data caps or other resources they want to be aware of , I also added in the ability to completely ignore the random streams. If enabled, it will ONLY check the specified channels. I have also added some safeguards to avoid refreshing the page if on a high priority stream, and if the 'ignore' function is turned on, but no high priority streams are available, it will refresh the browser and sit idle, and check every 2 minutes. This should save some resources for the end user's system, as well as save the data cost (if they care about it)

These are the commands to be added into the docker environment list:
#- IgnoreRandomChannels=TRUE #Disables viewing random channels and sits idle if no High-Priority channels are live

  • ChannelName_1='Warframe' # High Priority Channel 1 - supply only the channel name here!
  • ChannelName_2='Valorant'
  • ChannelName_3=''

D3vl0per and others added 2 commits June 6, 2020 22:53
I wanted to re-work this to watch Twitch.tv/warframe, and after poking through the code, I feel like it could work great. The only hiccup would be actually getting the specific channel that I want to watch, instead of the random channels. 

The changes include several new routines:
- ViewPriority -> This is now the main loop (instead of ViewRandomPage being the main loop). It allows checking for several high-priority streams to view before viewing any random channels. 

- ViewURL      -> I moved all of the pertinent code from the ViewRandomPage routine into this new routine. This is what will allow specific channels to be watched, while keeping the total code smaller (and mostly the same)

- CheckStreamerOnline -> This routine is mocked up, but I'll be honest that I am unsure of how to perform this check at the moment. This routine would return a boolean TRUE if the requested stream is online. The ViewPriority routine would then call the ViewURL to go to that stream.

- SleepWatching -> This routine checks if there are any high priority streams running. If there is a higher priority stream running, it will stop sleeping and allow the ViewPriority loop to decide which page to go to next. If no high priority stream is running it will run out the sleep timer in 1 minute increments, checking for higher priorities each loop. 

Since this new code will support up to three 'high priority' channels, and I know some people have data caps or other resources they want to be aware of , I also added in the ability to completely ignore the random streams. If enabled, it will ONLY check the specified channels. I have also added some safeguards to avoid refreshing the page if on a high priority stream, and if the 'ignore' function is turned on, but no high priority streams are available, it will refresh the browser and sit idle, and check every 2 minutes.  This should save some resources for the end user's system, as well as save the data cost (if they care about it)

These are the commands to be added into the docker environment list:
#- IgnoreRandomChannels=TRUE  #Disables viewing random channels and sits idle if no High-Priority channels are live
- ChannelName_1='Warframe'   # High Priority Channel 1 - supply only the channel name here!
- ChannelName_2='Valorant'
- ChannelName_3=''
@RFBomb
Copy link
Author

RFBomb commented Aug 13, 2020

I think the best way to perform the check would be make a call to the twitch api. I have no experience with API calls though.

Here are some links I found:

https://discuss.dev.twitch.tv/t/check-if-streamer-is-online/22672/2

https://discuss.dev.twitch.tv/t/check-whether-channel-is-online-or-not-via-js-solution-found/2019

@D3vl0per D3vl0per marked this pull request as ready for review August 15, 2020 12:03
@tetreum
Copy link
Contributor

tetreum commented Feb 3, 2021

This PR is not longer required, as this got merged:
#84

@RFBomb
Copy link
Author

RFBomb commented Feb 13, 2021

As I posted in #84 , that change did not satisfy the problem at all.

I have tested and published my mod using the HELIX API here:
https://github.com/RFBomb/Twitch-watcher
https://hub.docker.com/repository/docker/rfbomb/warframe_watcher

My update to the code is based on the base sourcecode here from a few months back. It involves bit of a major rework in order to incorporate the HELIX API to grab preferred stream status. I have built an entire module that works well if you wish to implement it here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants