# Copyright 2009 Autodesk, Inc.  All rights reserved.
# Use of this software is subject to the terms of the Autodesk license agreement 
# provided at the time of installation or download, or which otherwise accompanies
# this software in either electronic or hard copy form.
#
# Script description:
# Find a Device (from its name) in the scene and stop it
#
# Topic: FBDevice, FBPlayerControl
#

from pyfbsdk import *

#Change the name of the following constant to match your device name
DeviceName = "My Device"

def FindDevice( pName ):
    lResult = None
    lDeviceList = FBSystem().Scene.Devices

    if lDeviceList:
        #print "get camera device"
        for lDevice in lDeviceList:
            #print "Device Name = %s" % lDevice.Name    
            if lDevice.Name == pName:
                lResult = lDevice
                break
    else:
        print 'No device found'

    return lResult


#Actual script
lDevice = FindDevice( DeviceName )
if lDevice:
    lPlayer = FBPlayerControl()
    lPlayer.Stop()

    lDevice.RecordMode = False
    lDevice.Live = False
else:
    print 'No device found'