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

Add ability to batch process Frame.io comments to Final Cut Pro clips #13

Open
latenitefilms opened this issue Jun 20, 2023 · 2 comments
Assignees
Milestone

Comments

@latenitefilms
Copy link
Owner

Ideally you could put in the URL for a Frame.io project or folder, Marker Toolbox would download ALL the comments for all the clips in that project or folder, then if you drag a library or event to Marker Toolbox, it'll use filenames to match everything up.

@latenitefilms
Copy link
Owner Author

@latenitefilms
Copy link
Owner Author

Here's a simple Python script to get a list of all the root_asset_id's:

import requests

# Frame.io API base URL
BASE_URL = "https://api.frame.io/v2"

# Put your Frame.io API token here
TOKEN = "XXX"

# The header for the requests
headers = {
    "Authorization": f"Bearer {TOKEN}",
}

def get_resource(resource_url):
    """Send GET request to the provided resource URL and return the JSON response."""
    response = requests.get(resource_url, headers=headers)
    response.raise_for_status()  # Will raise an HTTPError if the response was unsuccessful
    return response.json()

def fetch_root_asset_ids():
    """Fetch the root_asset_id for each project in each team in each account."""
    # Get the user's accounts
    accounts = get_resource(f"{BASE_URL}/accounts")

    for account in accounts:
        # Get the teams within the current account
        teams = get_resource(f"{BASE_URL}/accounts/{account['id']}/teams")

        for team in teams:
            # Get the projects within the current team
            projects = get_resource(f"{BASE_URL}/teams/{team['id']}/projects")

        for project in projects:
            # Use the .get() method, which returns None if the key is not present in the dictionary
            project_name = project.get('name', 'Unnamed Project')
            team_name = team.get('name', 'Unnamed Team')
            account_name = account.get('name', 'Unnamed Account')
            root_asset_id = project.get('root_asset_id', 'No Root Asset ID')
            print(f"Project '{project_name}' in team '{team_name}' of account '{account_name}' has root_asset_id '{root_asset_id}'.")

if __name__ == "__main__":
    fetch_root_asset_ids()

You can then use that root_asset_id in this website to get a CSV:

https://glitch.com/~frameio-comment-scraper

@latenitefilms latenitefilms added this to the v1.4.0 milestone Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant