Skip to content

Commit

Permalink
Merge pull request #20 from sodabrew/patch-sdinfo
Browse files Browse the repository at this point in the history
Handle missing airplay dns-sd info.
  • Loading branch information
elcuervo committed Sep 5, 2012
2 parents f3937ab + acfdd56 commit 9e7b70c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
24 changes: 12 additions & 12 deletions lib/airplay/server/features.rb
Expand Up @@ -13,17 +13,17 @@ class Airplay::Server::Features
:PhotoCaching

def initialize(features)
@Video = 0 == (features & ( 1 << 0 ))
@Photo = 0 == (features & ( 1 << 1 ))
@VideoFairPlay = 0 == (features & ( 1 << 2 ))
@VideoVolumeControl = 0 == (features & ( 1 << 3 ))
@VideoHTTPLiveStreams = 0 == (features & ( 1 << 4 ))
@Slideshow = 0 == (features & ( 1 << 5 ))
@Screen = 0 == (features & ( 1 << 7 ))
@ScreenRotate = 0 == (features & ( 1 << 8 ))
@Audio = 0 == (features & ( 1 << 9 ))
@AudioRedundant = 0 == (features & ( 1 << 11 ))
@FPSAPv2pt5_AES_GCM = 0 == (features & ( 1 << 12 ))
@PhotoCaching = 0 == (features & ( 1 << 13 ))
@Video = 0 < (features & ( 1 << 0 ))
@Photo = 0 < (features & ( 1 << 1 ))
@VideoFairPlay = 0 < (features & ( 1 << 2 ))
@VideoVolumeControl = 0 < (features & ( 1 << 3 ))
@VideoHTTPLiveStreams = 0 < (features & ( 1 << 4 ))
@Slideshow = 0 < (features & ( 1 << 5 ))
@Screen = 0 < (features & ( 1 << 7 ))
@ScreenRotate = 0 < (features & ( 1 << 8 ))
@Audio = 0 < (features & ( 1 << 9 ))
@AudioRedundant = 0 < (features & ( 1 << 11 ))
@FPSAPv2pt5_AES_GCM = 0 < (features & ( 1 << 12 ))
@PhotoCaching = 0 < (features & ( 1 << 13 ))
end
end
8 changes: 4 additions & 4 deletions lib/airplay/server/node.rb
Expand Up @@ -4,9 +4,9 @@ class Airplay::Server::Node

def initialize(name, domain, ip, port, info)
@name, @domain, @ip, @port = name, domain, ip, port
@features = Airplay::Server::Features.new info.fetch('features', 0).hex
@deviceid = info.fetch('deviceid')
@srcvers = info.fetch('srcvers')
@model = info.fetch('model')
@features = Airplay::Server::Features.new info.fetch('features', '0').hex
@deviceid = info.fetch('deviceid', nil)
@srcvers = info.fetch('srcvers', nil)
@model = info.fetch('model', nil)
end
end

0 comments on commit 9e7b70c

Please sign in to comment.