Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Discussion] Make the scripts so they call the API once instead of three times #10

Open
tyrsarm opened this issue Mar 31, 2023 · 8 comments · May be fixed by #11
Open

[Discussion] Make the scripts so they call the API once instead of three times #10

tyrsarm opened this issue Mar 31, 2023 · 8 comments · May be fixed by #11

Comments

@tyrsarm
Copy link
Owner

tyrsarm commented Mar 31, 2023

Right now the scripts call the Peertube instance API three times every time the status of the channel is updated. I would like to only call the API once per status update and parse the necessary data from a single JSON output from the API. Currently, the scripts do not share the JSON data. I am thinking of maybe creating an environment variable that would update with the JSON data but I do not know what limitations environment variables have regarding the amount and type of data that they can hold. What would be the most efficient way to have the JSON data shared between the Python scripts?

@tyrsarm tyrsarm changed the title Make the scripts so they call the API once instead of three times [Discussion] Make the scripts so they call the API once instead of three times Mar 31, 2023
@CGBassPlayer
Copy link

Is there anything wrong with passing the JSON data as a parameter? What I would do is have all the code in the other scripts into functions that way you can import the function call and pass the required parameters around. It also remove the need to use env vars or files for the isLive, isPlaying and things of the like.

@tyrsarm
Copy link
Owner Author

tyrsarm commented Mar 31, 2023

I did not think about using parameters for sharing the JSON data. Is there a way that the scripts can pull updated parameters while running? If so that would be the way to go.

@tyrsarm
Copy link
Owner Author

tyrsarm commented Mar 31, 2023

I missed the part of making the other scripts in to functions. That could actually work. I originally made separate scripts so that the PlayLive script can run and while the other scripts continued to get new information.

@CGBassPlayer
Copy link

You still could. Just instead if using the of using the exec on a file, you would just call the function instead

@tyrsarm
Copy link
Owner Author

tyrsarm commented Apr 5, 2023

After looking more into making the other scripts into functions in the main py, I think I can get it to work. I am thinking about calling the functions on a timer. For the PlayLive function I am thinking about using threading on it so that the variables get to update or need to figure out the logic necessary for stopping the Selenium instance when isLive turns from true to false. What would be the best way to go about this? I am starting to lean to monitor isLive as a separate function.

@Strit
Copy link
Contributor

Strit commented May 25, 2023

Any updates on this?

@CGBassPlayer
Copy link

No update from me. Life got busy quick so I have not looked through this like I originally anticipated. Commit history looks quiet as well so I doubt there has been much done here.

@tyrsarm
Copy link
Owner Author

tyrsarm commented May 26, 2023

I have no update as of right now. I am looking at rewriting most of the python structure to fix this issue and the text files to environment variables. Life has gotten in the way on my side but I have not forgotten nor given up on this project.

@CGBassPlayer CGBassPlayer linked a pull request Jul 10, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants