Ejemplo n.º 1
0
    assemble_folder_path = os.path.join(assemble_folder, "diribeo")
    if os.path.isdir(assemble_folder_path):
        print "Deleting diribeo"
        shutil.rmtree(assemble_folder_path)

    print "Starting copy"
    shutil.copytree("../src", assemble_folder_path, ignore=ignore_dir)
    print "Finished copy action"

    makeArchive(dirEntries(assemble_folder, True), zip_name)
    print "Finished creating archieve"

    print "Uploading"
    abs_zip_path = os.path.abspath(zip_name)
    rsapi = RapidShareAPI(credentials)
    rs_fileid = rsapi.upload_file(abs_zip_path)

    hfapi = HotFileAPI(credentials)
    hf_fileid = hfapi.upload_file(abs_zip_path, folderid="1701142", hashid="2e37c99", path="diribeo")
    hfapi.set_direct_download(hf_fileid)
    print "Finished Uploading"

    print "Notify web server"
    query = urllib.urlencode({"username": username,
                              "password": password})
    base_url = ["http", "diribeo2010.appspot.com", "/tasks/updatedownloads_v1", "", query, ""]
    result = urllib2.urlopen(urlparse.urlunparse(base_url))
    for line in result:
        if "OK" in line:
            print "Notification was successful"