def main():
    for doc in posterous_docs(settings.posterous_primary_sitename):
        bucket = settings.archivedotorg_pdf_bucket

        if not archive.exists(bucket, utils.get_filename(doc)):
            item = utils.download(doc)
            archive.upload(bucket, item)
def main():
    os.chdir('/tmp')
    for video_id in vimeo_video_ids(settings.vimeo_username):
        v = Vimeo(id=video_id, ext='mp4')
        filename = '%s.mp4' % v.title

        if not archive.exists(bucket, filename):
            if os.path.exists(filename):
                info("File %s already exists. Not downloading." % filename)
            else:
                debug("Downloading " + filename)
                v.run()

            archive.upload(bucket, filename)
def main():
    bucket = config["bucket"]["id"]
    archive.create_bucket(
        bucket,
        title=config["bucket"]["title"],
        description=config["bucket"]["description"],
        date=config["bucket"]["date"],
        keywords=config["bucket"]["keywords"],
        mediatype=config["bucket"]["mediatype"],
    )

    for item in items_to_upload():
        archive.upload(bucket, item)
        mark_as_processed(item)
def process(photoset):
    debug("Processing " + photoset.title)

    bucket = photoset.id

    if archive.exists(bucket):
        info("Bucket " + bucket + " (" + photoset.title + ") already exists.")
        return

    archive.create_bucket(bucket,
                          title=photoset.title,
                          description=photoset.description,
                          keywords=photoset.title,
                          mediatype='movies'
                         )

    for photo in photoset.getPhotos():
        url = photo.getLarge()
        item = utils.download(url)
        archive.upload(bucket, item)
        os.remove(item)