2 Replies - 266 Views - Last Post: 26 October 2017 - 07:10 AM Rate Topic: -----

#1 underoathed  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 10-December 15

Copy files from AJA FileRecorder

Posted 26 October 2017 - 06:38 AM

Hello DiC!

Greetings from a beginner programmer. I stumbled upon this script to transfer files from an AJA FileRecorder but I am having trouble understanding it let alone getting it to work. I am going to post the code along with the link to the code so I don't plagiarize the code. I want to understand how this works as well as understand what is missing so I can write code of my own to do the same thing.

Link: https://stackoverflo...ro-using-python

# This script polls the unit downloads any new clips it hasn't already downloaded to the current directory 

# Arguments:  hostname or IP address of Ki Pro unit

import urllib, sys, string, os, posix, time

def is_download_allowed(address):
    f = urllib.urlopen("http://"+address+"/config?action=get&paramid=eParamID_MediaState")
    response = f.read()
    if (response.find('"value":"1"') > -1):
        return True
    f = urllib.urlopen("http://"+address+"/config?action=set&paramid=eParamID_MediaState&value=1")

def download_clip(clip):
    url = "http://" + address + "/media/" + clip
    print url
    posix.system("curl --output " + clip + " " + url);

def download_clips(response):
    values = response.split(":")
    i = 0
    for word in values:
        i += 1
        if(word.find('clipname') > -1):
            clip = values[i].split(',')[0].translate(string.maketrans("",""), '[]{} \,\"\" ')
            if not os.path.exists(clip):
                print "Downloading clip: " + clip
                download_clip(clip)
        else:
            f = urllib.urlopen("http://"+address+"/config?action=set&paramid=eParamID_MediaState&value=0")
            print "No new clips found"

address = sys.argv[1]

while 1:
    if (is_download_allowed(address)):
        print "Looking for new clips"
        f = urllib.urlopen("http://"+address+"/clips")
        response = f.read()
        download_clips(response)


Is This A Good Question/Topic? 0
  • +

Replies To: Copy files from AJA FileRecorder

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 13491
  • View blog
  • Posts: 53,888
  • Joined: 12-June 08

Re: Copy files from AJA FileRecorder

Posted 26 October 2017 - 06:43 AM

I am lost - what is the question?
Was This Post Helpful? 1
  • +
  • -

#3 underoathed  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 10-December 15

Re: Copy files from AJA FileRecorder

Posted 26 October 2017 - 07:10 AM

Oh sorry about that. I have the code above but I am unaware what is missing from it since I want to download files from a device and then delete the files off that device.

Device: https://www.aja.com/products/ki-pro

View Postunderoathed, on 26 October 2017 - 07:07 AM, said:

Oh sorry about that. I have the code above but I am unaware what is missing from it since I want to download files from a device and then delete the files off that device.

Device: https://www.aja.com/products/ki-pro



I can give more information if need be on this. I'm just trying to make this an automated process instead of removing the drives and connecting FW800 to take the files off.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1