How to use the mirdata.download_utils.downloader function in mirdata

To help you get started, we’ve selected a few mirdata examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mir-dataset-loaders / mirdata / tests / test_download_utils.py View on Github external
def test_downloader(mocker, mock_path):
    mock_zip = mocker.patch.object(download_utils, 'download_zip_file')
    mock_tar = mocker.patch.object(download_utils, 'download_tar_file')
    mock_file = mocker.patch.object(download_utils, 'download_from_remote')
    # Zip only
    download_utils.downloader('a', zip_downloads=['foo'])
    mock_zip.assert_called_once_with('foo', 'a', False, False)
    mocker.resetall()

    # tar only
    download_utils.downloader('a', tar_downloads=['foo'])
    mock_tar.assert_called_once_with('foo', 'a', False, False)
    mocker.resetall()

    # file only
    download_utils.downloader('a', file_downloads=['foo'])
    mock_file.assert_called_once_with('foo', 'a', False)
    mocker.resetall()

    # zip and tar
    download_utils.downloader('a', zip_downloads=['foo'], tar_downloads=['foo'])
    mock_zip.assert_called_once_with('foo', 'a', False, False)
    mock_tar.assert_called_once_with('foo', 'a', False, False)
    mocker.resetall()

    # zip and file
    download_utils.downloader('a', zip_downloads=['foo'], file_downloads=['foo'])
github mir-dataset-loaders / mirdata / tests / test_download_utils.py View on Github external
download_utils.downloader('a', zip_downloads=['foo'])
    mock_zip.assert_called_once_with('foo', 'a', False, False)
    mocker.resetall()

    # tar only
    download_utils.downloader('a', tar_downloads=['foo'])
    mock_tar.assert_called_once_with('foo', 'a', False, False)
    mocker.resetall()

    # file only
    download_utils.downloader('a', file_downloads=['foo'])
    mock_file.assert_called_once_with('foo', 'a', False)
    mocker.resetall()

    # zip and tar
    download_utils.downloader('a', zip_downloads=['foo'], tar_downloads=['foo'])
    mock_zip.assert_called_once_with('foo', 'a', False, False)
    mock_tar.assert_called_once_with('foo', 'a', False, False)
    mocker.resetall()

    # zip and file
    download_utils.downloader('a', zip_downloads=['foo'], file_downloads=['foo'])
    mock_zip.assert_called_once_with('foo', 'a', False, False)
    mock_file.assert_called_once_with('foo', 'a', False)
    mocker.resetall()

    # tar and file
    download_utils.downloader('a', tar_downloads=['foo'], file_downloads=['foo'])
    mock_tar.assert_called_once_with('foo', 'a', False, False)
    mock_file.assert_called_once_with('foo', 'a', False)
    mocker.resetall()
github mir-dataset-loaders / mirdata / mirdata / medleydb_pitch.py View on Github external
if data_home is None:
        data_home = utils.get_default_dataset_path(DATASET_DIR)

    info_message = """
        To download this dataset, visit:
        https://zenodo.org/record/2620624#.XKZc7hNKh24
        and request access.

        Once downloaded, unzip the file MedleyDB-Pitch.zip
        and copy the result to:
        {data_home}
    """.format(
        data_home=data_home
    )

    download_utils.downloader(
        data_home, info_message=info_message, force_overwrite=force_overwrite
    )
github mir-dataset-loaders / mirdata / mirdata / tinysol.py View on Github external
def download(data_home=None):
    """Download TinySOL.

    Args:
        data_home (str): Local path where the dataset is stored.
            If `None`, looks for the data in the default directory, `~/mir_datasets`
    """
    if data_home is None:
        data_home = utils.get_default_dataset_path(DATASET_DIR)

    download_utils.downloader(
        data_home,
        tar_downloads=[AUDIO_REMOTE],
        file_downloads=[ANNOTATION_REMOTE],
        cleanup=True,
    )
github mir-dataset-loaders / mirdata / mirdata / msd.py View on Github external
# Connect to the instance
$ INSTANCE_HOSTNAME=$(aws ec2 describe-instances --instance-ids $INSTANCE_ID | jq -r .Reservations[0].Instances[0].PublicDnsName)
$ MSD_FOLDER={msd_folder}
$ ssh -A -i $PEM_PATH ubuntu@$INSTANCE_HOSTNAME

# On the instance, mount the MSD:
$ sudo mkdir $MSD_FOLDER
$ sudo mount $DEVICE $MSD_FOLDER
$ sudo chmod 777 $MSD_FOLDER'

""".format(
        msd_folder=data_home
    )

    download_utils.downloader(data_home, info_message=info_message)
github mir-dataset-loaders / mirdata / mirdata / guitarset.py View on Github external
def download(data_home=None):
    """Download GuitarSet.

    Args:
        data_home (str): Local path where the dataset is stored.
            If `None`, looks for the data in the default directory, `~/mir_datasets`
    """
    if data_home is None:
        data_home = utils.get_default_dataset_path(DATASET_DIR)

    download_utils.downloader(
        data_home,
        zip_downloads=[
            ANNOTATION_REMOTE,
            AUDIO_HEX_CLN_REMOTE,
            AUDIO_HEX_REMOTE,
            AUDIO_MIC_REMOTE,
            AUDIO_MIX_REMOTE,
        ],
        cleanup=True,
    )