Skip to content

Commit

Permalink
Merge commit 'f1111374357e09615411'
Browse files Browse the repository at this point in the history
Conflicts:
	shairport.pl
  • Loading branch information
albertz committed Apr 26, 2011
2 parents 4538a39 + f111137 commit c7413f4
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions shairport.pl
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
#!/usr/bin/env perl
#!/bin/sh
if test -n "`perl -V | grep "5\.0"`"
then
echo -n "FATAL: You appear to have perl "
for WORD in `perl -v | grep "^This is "`
do
echo $WORD
done | grep "5" | xargs echo -n
echo ", but at least version 5.10.0 is required."
exit 1
fi
exec perl -wx $0 "$@"
if 0;
#!perl -w
#line 16

# ShairPort - Airtunes compatible server
# Copyright (c) 2011 James Laird
Expand All @@ -25,6 +39,8 @@

use 5.10.0;

use strict;

use Getopt::Long;
use FindBin;

Expand Down Expand Up @@ -59,6 +75,7 @@
my $libao_deviceid;
# suppose hairtunes is under same directory
my $hairtunes_cli = $FindBin::Bin . '/hairtunes';
my $help;

unless (-x $hairtunes_cli) {
say "Can't find the 'hairtunes' decoder binary, you need to build this before using Shairport.";
Expand Down Expand Up @@ -132,17 +149,17 @@ sub REAP {

$avahi_publish = fork();
if ($avahi_publish==0) {
exec 'avahi-publish-service',
{ exec 'avahi-publish-service',
join('', map { sprintf "%02X", $_ } @hw_addr) . "\@$apname",
"_raop._tcp",
"5000",
"tp=UDP","sm=false","sv=false","ek=1","et=0,1","cn=0,1","ch=2","ss=16","sr=44100","pw=false","vn=3","txtvers=1";
exec 'dns-sd', '-R',
"tp=UDP","sm=false","sv=false","ek=1","et=0,1","cn=0,1","ch=2","ss=16","sr=44100","pw=false","vn=3","txtvers=1"; };
{ exec 'dns-sd', '-R',
join('', map { sprintf "%02X", $_ } @hw_addr) . "\@$apname",
"_raop._tcp",
".",
"5000",
"tp=UDP","sm=false","sv=false","ek=1","et=0,1","cn=0,1","ch=2","ss=16","sr=44100","pw=false","vn=3","txtvers=1";
"tp=UDP","sm=false","sv=false","ek=1","et=0,1","cn=0,1","ch=2","ss=16","sr=44100","pw=false","vn=3","txtvers=1"; };
die "could not run avahi-publish-service nor dns-sd";
}

Expand Down Expand Up @@ -211,7 +228,7 @@ sub ip6bin {

while (1) {
my @waiting = $sel->can_read;
foreach $fh (@waiting) {
foreach my $fh (@waiting) {
if ($fh==$listen) {
my $new = $listen->accept;
printf "new connection from %s\n", $new->sockhost;
Expand Down

0 comments on commit c7413f4

Please sign in to comment.