mfilippov / vimeo-dot-net

A .NET wrapper for Vimeo API v3.0
MIT License
98 stars 88 forks source link

Fix 'Free space error' for free users or if the uploaded file were bigger than the free space #192

Closed leonardoacoelho closed 1 year ago

leonardoacoelho commented 1 year ago

Free space is not measured in bytes but in video quantity, so it must be checked if there is at least one free space to use instead of checking if file lenght is bigger than the free space.

mfilippov commented 1 year ago

@leonardoacoelho It looks not true. I checked json response:

"upload_quota": {
      "space": {
        "free": 518777128,
        "max": 524288000,
        "used": 5510872,
        "showing": "periodic",
        "unit": "video_size"
      },
      "periodic": {
        "period": "week",
        "unit": "video_size",
        "free": 518777128,
        "max": 524288000,
        "used": 5510872,
        "reset_date": "2023-04-13T00:00:00-04:00"
      },
      "lifetime": {
        "unit": "video_size",
        "free": 5363198248,
        "max": 5368709120,
        "used": 5510872
      }
    },

It has unit video size. Could you add example of your JSON response?

awsomd commented 1 year ago

Hi, I got the exact same issue but with a paid account. The free space value returned by Vimeo API is also the number of videos left in the quota. I confirm that Leonardo solution solves the issue.

ferozhussain commented 1 year ago

@mfilippov True, if paid account space refers to storage size if the free account space refers to the video count the person can upload in that month.

mfilippov commented 1 year ago

@ferozhussain than you for the information I think we need to handle both cases. Could you provide which kind of unit in response on free account in paid it ("unit": "video_size")

mfilippov commented 1 year ago

I found it.

      "space": {
        "free": 0,
        "max": 2,
        "used": 2,
        "showing": "periodic",
        "unit": "video_count"
      },
mfilippov commented 1 year ago

I made proper fix for this issue in #199.