Automated Dance Data Download Script

DataDownload.ipynb

This Jupyter notebook script automates the process of downloading C3D (3D motion capture data) files of dancers expressing various emotions. It iterates through combinations of dancer names and emotions, constructing specific URLs to request and save each file locally. The script handles errors gracefully and logs unsuccessful download attempts, with a manual adjustment noted for a uniquely named file.

snippet.python
import requests
from tqdm import tqdm
snippet.python
baseURL = "http://dancedb.eu/file/download/[NAME]-C3D.c3d"
snippet.python
Dancers_1 = ['Theodora', 'Olivia', 'Vasso', 'Sophie']
Emotions_1 = ['Afraid', 'Angry', 'Annoyed', 'Bored',
            'Excited', 'Happy', 'Miserable',
            'Pleased', 'Relaxed', 'Sad', 'Satisfied',
           'Tired', 'Mix']
snippet.python
errorCount = 0
for Dancer in Dancers_1:
    for Emotion in Emotions_1:
        Name = "{}_{}".format(Dancer, Emotion)
        URL = baseURL.replace('[NAME]', Name)
        try:
            r = requests.get(URL)
            with open('Downloaded_Data/{}.c3d'.format(Name), 'wb') as f:
                f.write(r.content)
            print('Downloaded {}'.format(Name))
        except requests.exceptions.RequestException as e:
            print(e)
            print('Unable to Download {}'.format(URL))
            errorCount += 1
Downloaded Theodora_Afraid
Downloaded Theodora_Angry
Downloaded Theodora_Annoyed
Downloaded Theodora_Bored
Downloaded Theodora_Excited
Downloaded Theodora_Happy
Downloaded Theodora_Miserable
Downloaded Theodora_Pleased
Downloaded Theodora_Relaxed
Downloaded Theodora_Sad
Downloaded Theodora_Satisfied
Downloaded Theodora_Tired
Downloaded Theodora_Mix
Downloaded Olivia_Afraid
Downloaded Olivia_Angry
Downloaded Olivia_Annoyed
Downloaded Olivia_Bored
Downloaded Olivia_Excited
Downloaded Olivia_Happy
Downloaded Olivia_Miserable
Downloaded Olivia_Pleased
Downloaded Olivia_Relaxed
Downloaded Olivia_Sad
Downloaded Olivia_Satisfied
Downloaded Olivia_Tired
Downloaded Olivia_Mix
Downloaded Vasso_Afraid
Downloaded Vasso_Angry
Downloaded Vasso_Annoyed
Downloaded Vasso_Bored
Downloaded Vasso_Excited
Downloaded Vasso_Happy
Downloaded Vasso_Miserable
Downloaded Vasso_Pleased
Downloaded Vasso_Relaxed
Downloaded Vasso_Sad
Downloaded Vasso_Satisfied
Downloaded Vasso_Tired
Downloaded Vasso_Mix
Downloaded Sophie_Afraid
Downloaded Sophie_Angry
Downloaded Sophie_Annoyed
Downloaded Sophie_Bored
Downloaded Sophie_Excited
Downloaded Sophie_Happy
Downloaded Sophie_Miserable
Downloaded Sophie_Pleased
Downloaded Sophie_Relaxed
Downloaded Sophie_Sad
Downloaded Sophie_Satisfied
Downloaded Sophie_Tired
Downloaded Sophie_Mix
snippet.python
errors = ['Vasso_Happy']
# This error is because the file name is formated slightly 
#   different, as Vasso_Happy-01-C3D
#   This file has been downloaded manually

python