Patches: Browse | Submit New | Admin

[#9006] Support for outputs

Date:
2007-03-03 15:04
Priority:
3
Submitted By:
Nobody
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
Support for outputs

Detailed description
Here is a patch for enabling outputs and show outputs
988a989,1007
>       # Gives a list of all outputs
>       def outputs
>               build_outputs_list(send_command("outputs"))
>       end
> 
>       #
>       # Enables output num
>       def enableoutput(num)
>               send_command("enableoutput #{num.to_s}")
>       end
> 
>       #
>       # Disables output num
>       def disableoutput(num)
>               send_command("disableoutput #{num.to_s}")
>       end
> 
> 
>       #
1126a1146,1176
>       # This first creates an array of lines as returned from the server
>       # Then each entry is processed and added to an Hash
>       # Whenever a new 'outputid:' entry is found, the current Hash
>       # is added to an array, and a new one is created
>       #
>       # The end result is an Array of Hashes(containing the outputs)
>       def build_outputs_list( string )
>               return [] if string.nil? or !string.kind_of? String
> 
>               list = []
>               output = {}
>               lines = string.split "\n"
>               lines.each do |line|
>                       key = line.gsub(/:.*/, '')
>                       line.gsub!(/\A[^:]*: /, '')
> 
>                       if key == 'outputid' && !output['outputid'].nil?
>                               list << output
>                       end
> 
>                       output[key.downcase] = line
>               end
> 
>               list << output
> 
>               return list
>       end
> 
>       #
>       # Private Method
>       #
1149a1200
>       private :build_outputs_list

Add A Comment: Notepad

Please login


Followup

No Followups Have Been Posted

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item