#35 [feature] deleting videos

Open
opened 5 years ago by wotaniii · 1 comments
wotaniii commented 5 years ago

I'd like to be able to delete videos per script.

Background: scripts, that upload stuff will eventually fill up their quota. So if a script should be able to run permanently, it must be able to free up space. The script I made in january has uploaded 1500 short videos so far, and I don't intend to delete them by hand.

Example:

# delete a specific video
prismedia --delete_video d1b75379-fb98-46d1-99de-0ce1a2b8c5d5

# delete videos until 500mb of quota is freed up
prismedia --delete_oldest_video_until_free_quota 500

My questions:

  • is that something prismedia should be able to do or is this requirement too specific?

  • would this work:

      videos = sorted(oauth.get(url + "/users/me/videos"), key='updatedAt')
      total_quota = oauth.get(url + "/users/me")[videoQuota]
      for video in videos:
          quota_used = oauth.get(url + "/users/me/video-quota-used")
          if total_quota - quota_used) > free_quota_target:
              break
          try:
              oauth.delete(url + "/api/v1/videos/" + videos['uuid'])
          except:
              print("can't delete + str(videos['uuid'])) 
    

(I'm not entirely sure about the syntax here)

https://docs.joinpeertube.org/api.html#tag/Video/paths/~1videos~1{id}/delete

I'd like to be able to delete videos per script. Background: scripts, that upload stuff will eventually fill up their quota. So if a script should be able to run permanently, it must be able to free up space. The script I made in january has uploaded 1500 short videos so far, and I don't intend to delete them by hand. Example: # delete a specific video prismedia --delete_video d1b75379-fb98-46d1-99de-0ce1a2b8c5d5 # delete videos until 500mb of quota is freed up prismedia --delete_oldest_video_until_free_quota 500 My questions: - is that something prismedia should be able to do or is this requirement too specific? - would this work: videos = sorted(oauth.get(url + "/users/me/videos"), key='updatedAt') total_quota = oauth.get(url + "/users/me")[videoQuota] for video in videos: quota_used = oauth.get(url + "/users/me/video-quota-used") if total_quota - quota_used) > free_quota_target: break try: oauth.delete(url + "/api/v1/videos/" + videos['uuid']) except: print("can't delete + str(videos['uuid'])) (I'm not entirely sure about the syntax here) https://docs.joinpeertube.org/api.html#tag/Video/paths/~1videos~1{id}/delete
Poster
Owner

Hello!

I have to admit this feature is not planned at the moment, but it's something that could be possible.

I do not know the functions allowed by the API about that, perhaps we could list videos massively, or sort them, but I am not sure

Hello! I have to admit this feature is not planned at the moment, but it's something that could be possible. I do not know the functions allowed by the API about that, perhaps we could list videos massively, or sort them, but I am not sure
LecygneNoir added the
enhancement
label 5 years ago
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.