#57 Add a way to track Youtube quota usage

Open
opened 3 years ago by Zykino · 3 comments
Zykino commented 3 years ago

First of all I think this feature is not needed for the average youtuber that uploads some videos a day/week/month to youtube. This feature would however become a requirement if Prismedia is used by peertube instance to propose a "mirror to youtube" button. The users and admin would know if they can upload more or not for the day. And with a bit more of logic the instance itself can then rearrange uploads around quotas and youtube’s publish date. Maybe this would need #27 and that automatic upload also takes this information into account.

In a way I see a configuration file (option in the NFO?) that tell the program how much of Youtube’s quota has been used.
Prismedia would then need to store in a file how much data is currently used and a date (last use of quota or next reset time).
Each call to a youtube’s API would need an overload function that add the cost of that call and reset the quota when youtube is doing so.

For advanced use, a way to do a dry-run of upload to know in advance if the quota is enough to do all the required steps of upload could also be useful.

First of all I think this feature is not needed for the average youtuber that uploads some videos a day/week/month to youtube. This feature would however become a requirement if Prismedia is used by peertube instance to propose a "mirror to youtube" button. The users and admin would know if they can upload more or not for the day. And with a bit more of logic the instance itself can then rearrange uploads around quotas and youtube’s publish date. Maybe this would need #27 and that automatic upload also takes this information into account. In a way I see a configuration file (option in the NFO?) that tell the program how much of Youtube’s quota has been used. Prismedia would then need to store in a file how much data is currently used and a date (last use of quota or next reset time). Each call to a youtube’s API would need an overload function that add the cost of that call and reset the quota when youtube is doing so. For advanced use, a way to do a `dry-run` of upload to know in advance if the quota is enough to do all the required steps of upload could also be useful.
Poster
Owner

Indeed the youtube quota is a real problem to work with, I agree.

However instead of storing the quota locally, I think it should be easier and more relevant to ask youtube directly.

Perhaps before uploading, or at the very start of prismedia, we may ask youtube about the quota, thne report to the user.

An option to report the quota without doing anything else would be useful too, so it would be possible to get the remaining quota when needed, in the case of some peertube plugin or displaying information in GUI.

But the full feature is dependant of youtue having methods to ask for remaining quota, which I do not found at first search 😅

Youtube data API has no evident way to do, only the compute methods and costs for each calls.

I'll search, perhaps it's hidden somewhere or on another API (as quota is global for project)

Indeed the youtube quota is a real problem to work with, I agree. However instead of storing the quota locally, I think it should be easier and more relevant to ask youtube directly. Perhaps before uploading, or at the very start of prismedia, we may ask youtube about the quota, thne report to the user. An option to report the quota without doing anything else would be useful too, so it would be possible to get the remaining quota when needed, in the case of some peertube plugin or displaying information in GUI. But the full feature is dependant of youtue having methods to ask for remaining quota, which I do not found at first search 😅 [Youtube data API](https://developers.google.com/youtube/v3/getting-started) has no evident way to do, only the compute methods and costs for each calls. I'll search, perhaps it's hidden somewhere or on another API (as quota is global for project)
LecygneNoir added the
enhancement
label 3 years ago
LecygneNoir added the
Todo
label 3 years ago
Poster
Owner

Okay, after some more research it appears indeed Youtube has absolutely no method to get remaining quota, total quota, or interact with quota....

Some resources (officials! As stackoverflow is the official support channel for Google API, no shit)
https://stackoverflow.com/questions/59172902/how-to-see-the-remaining-quota-on-api-youtube-v3

https://support.google.com/a/answer/6301355?hl=en

The only way to know your quota is to click click on the Developers Console (and even here, no trivial to find)

So the solution using a file to store used quota, and compute ourself the total quota used, seems the only solution. Need to do the work ourself.

Honestly my first reaction is fuck you Google. But who knows? Perhaps I or someone else have some motivation... 🤷

Okay, after some more research it appears indeed Youtube has absolutely no method to get remaining quota, total quota, or interact with quota.... Some resources (officials! As stackoverflow is the official support channel for Google API, no shit) [https://stackoverflow.com/questions/59172902/how-to-see-the-remaining-quota-on-api-youtube-v3](https://stackoverflow.com/questions/59172902/how-to-see-the-remaining-quota-on-api-youtube-v3) [https://support.google.com/a/answer/6301355?hl=en](https://support.google.com/a/answer/6301355?hl=en) The only way to know your quota is to click click on the Developers Console (and even here, no trivial to find) So the solution using a file to store used quota, and compute ourself the total quota used, seems the only solution. Need to do the work ourself. Honestly my first reaction is fuck you Google. But who knows? Perhaps I or someone else have some motivation... 🤷
Zykino commented 3 years ago
Poster

I did not thought about asking them 😅. But their doc have a "Quota Calculator" that really is a "quota cost cheat-sheet".

It doesn’t seems too bad to implement: never call functions directly but always pass by an encapsulation.
Maybe even better: have a function that takes into argument the option (to know if it is a dry-run, maybe the place of the configuration, …) and a pointer to the SDK function to call already prepared. Not sure how pointers to functions works in python 🤔.

I did not thought about asking them 😅. But their doc have a "[Quota Calculator](https://developers.google.com/youtube/v3/determine_quota_cost)" that really is a "quota cost cheat-sheet". It doesn’t seems too bad to implement: never call functions directly but always pass by an encapsulation. Maybe even better: have a function that takes into argument the `option` (to know if it is a dry-run, maybe the place of the configuration, …) and a pointer to the SDK function to call already prepared. Not sure how pointers to functions works in python 🤔.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.