Code Monkey home page Code Monkey logo

kobomedia's Introduction

Setup

git clone https://github.com/joshuaberetta/kobomedia
cd kobomedia

# optional
chmod +x kobomedia.py
sudo ln -s $(pwd)/kobomedia.py /usr/local/bin/kobomedia

Create kobo.json config file with the following settings:

{
    "token": "",
    "kf_url": "",
    "kc_url": ""
}

Usage

# download media
python3 kobomedia.py --asset-uid agBMEh8GWxTrCSWQuWyE5d

# or
./kobomedia.py --asset-uid agBMEh8GWxTrCSWQuWyE5d

# or
kobomedia --asset-uid agBMEh8GWxTrCSWQuWyE5d

Optional fields

  • limit: Limit number of submissions per query, paginate until complete
  • query: Set a custom query in the Mongo query syntax
  • question-names: Specify question names to download media for, comma separated
  • chunk-size: Set chunk size for saving data to files
  • throttle: Control time between each download to reduce server strain
  • verbosity: Control verbosity of stdout
./kobomedia.py --asset-uid agBMEh8GWxTrCSWQuWyE5d \
  --limit 10 \
  --query '{"_submission_time": {"$gt": "2021-08-04"}}' \
  --question-names group1/q1,group2/q2 \
  --chunk-size 2048 \
  --throttle 2 \
  --verbosity 2 \

Output

Media downloads will be in the following directory structure:

{asset_uid}
├── {submission_uid}
│   ├── {filename}
│   └── {filename}
├── {submission_uid}
│   └── {filename}
├── {submission_uid}
│   └── {filename}
├── {submission_uid}
│   └── {filename}
└── {submission_uid}
    ├── {filename}
    └── {filename}

If a file has previously been downloaded, it will be skipped (not downloaded again) on subsequent runs. Therefore the script can be run periodically to keep a local sync of submitted media on the server.

kobomedia's People

Contributors

joshuaberetta avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

stephencoduor

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.