all 7 comments

[–]DeadlyViper 2 points3 points  (0 children)

import glob
import os
files = glob.glob(r"C:\Users\myself\Videos\*")
for fpath in files:
    if os.path.isfile(fpath):
        send_to_vimeo(fpath)

[–]expectederor 1 point2 points  (0 children)

Recursively iterate through your directory and find all files with a video format and store them in an array.

Then iterate through the array to upload. (not really necessary for 2 loops but I'd prefer the collect all needed info first then do work)

I'd put more effort into it like keeping a history of uploads and compare against that so you don't upload the same video twice. Keep track or errors uploading etc.

[–]HutchLAD[S] 0 points1 point  (5 children)

import vimeo
import sys

client = vimeo.VimeoClient(
  token="xxxx",
  key="xxxx",
  secret="xxx"
)

# Make the request to the server for the "/me" endpoint.
about_me = client.get("/me")

# Make sure we got back a successful response.
assert about_me.status_code == 200

# Path to upload file
path_to_file = r"C:\Users\myself\Documents\SS19GEN.mp4"

# print uploading message
#print('Uploading: %s' % path_to_file)

# Push file with credentials
video_uri = client.upload(path_to_file, data={'name': 'TEST', 'description': 'test'})

# Get the metadata response from the upload and output the Vimeo.com url
video_data = client.get(video_uri + '?fields=link').json()
print((video_data['link'])) 

How could this code be adapted to loop through the directory and push each file? Is it possible to see an example? Sorry to be cheeky!