Mirroring M5 screen to AppleTV

Mirroring M5 screen to AppleTV

Postby mackowiakp » Oct 5th, '15, 19:04

I need to mirror content of my laptop screen to AppleTV unit. It is easy using airplay.jar script taken from here:

http://www.instructables.com/id/Airplay-to-AppleTV-From-Linux-PC/

But the problem is that I have to know IP address of AppleTV box. Of course it is possible to know that address using for example avahi-browse command from CLI but I want to do it automatically. So is any possibility or ready application to mirror screen to AppleTV with automatic IP address of AppleTV recognition?
Last edited by doktor5000 on Oct 5th, '15, 19:30, edited 1 time in total.
Reason: fixed link
Linux is like wigwam. No Windows, no Gates but Apache inside

WARNING ! The administrator has the right to refuse to install WINDOWS, invoking the conscience clause
mackowiakp
 
Posts: 646
Joined: May 23rd, '13, 07:32
Location: Gdynia, Poland

Re: Mirroring M5 screen to AppleTV

Postby doktor5000 » Oct 5th, '15, 19:36

If you know how to obtain the IP adress, and the airplay script is working, why not write a simple wrapper script around it?
Some hints can be found at http://vadim-kirilchuk-linux.blogspot.d ... linux.html

Apart from that, there's https://rubygems.org/gems/airstream
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17629
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Mirroring M5 screen to AppleTV

Postby mackowiakp » Oct 6th, '15, 10:02

Of course it is possible to obtain IP address of AppleTV by manual analyzing output from avahi-browse. But IP addresses in different places where AppleTV boxes are installed, can be different every day because basically it uses DHCP. And in one place, 3 such boxes are installed. I want to have something similar to Mac feature that is if AppleTV box is discover, clicking appropriate icon will display list of available boxes. Is any solution for automatic analyzing avahi-daemon discover units? I think it is possible because using for example printer configuration included in MCC, it is possible to find out mDNS/DNS-SD working network printers (basicaly used by MAC AirPrint). So I am looking for similar solution for AppleTV
Linux is like wigwam. No Windows, no Gates but Apache inside

WARNING ! The administrator has the right to refuse to install WINDOWS, invoking the conscience clause
mackowiakp
 
Posts: 646
Joined: May 23rd, '13, 07:32
Location: Gdynia, Poland

Re: Mirroring M5 screen to AppleTV

Postby doktor5000 » Oct 6th, '15, 17:38

You can grab some pieces of code for the discovery here and there. E.g.
http://stackoverflow.com/questions/5915 ... jour-nodes or https://github.com/benvanik/node-airplay and maybe https://nto.github.io/AirPlay.html#servicediscovery

And no, there doesn't seem to be some kind of applet which is ready to use for what you want.
Should be pretty easy to whip up only using avahi-browse and zenity. And you could also reuse code from avahi-discover.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17629
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Mirroring M5 screen to AppleTV

Postby mackowiakp » Oct 19th, '15, 19:19

If anybody interested in this topic, this is my script to automatically discover Apple TV and display (mirror) screen form my laptop to Apple TV box:

Code: Select all
#!/bin/bash
#
cd /home/maciek/Pobrane
cat /dev/null > ~/Pobrane/air_nodes
avahi-browse _airplay._tcp -tr|egrep "hostname = "|sed 's/.*\[//'|sed 's/\]$//' > ~/Pobrane/air_nodes
num=1
while read LINE ; do
        echo "$num)- $LINE"
        num=$(( $num + 1 ))
done < ~/Pobrane/air_nodes
ilosc=`cat ~/Pobrane/air_nodes|wc -l`
read line
[ $line -eq "0" ] || [ $line -gt $ilosc ] && echo "Wrong number entered" && exit
linia=`head -n $line ~/Pobrane/air_nodes | tail -1`
adres=`avahi-resolve-address -4 -n $linia | awk '{print $2;}'`
java -jar airplay.jar -h $adres -d


Any improvements welcome !!!
Linux is like wigwam. No Windows, no Gates but Apache inside

WARNING ! The administrator has the right to refuse to install WINDOWS, invoking the conscience clause
mackowiakp
 
Posts: 646
Joined: May 23rd, '13, 07:32
Location: Gdynia, Poland

Re: Mirroring M5 screen to AppleTV

Postby doktor5000 » Oct 19th, '15, 19:59

Could you at least provide an example output of "avahi-browse _airplay._tcp -tr" and explain what you do with that temporary file? You only want to enter a number corresponding to a line of an name to which Apple TV box to mirror, right?
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17629
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Mirroring M5 screen to AppleTV

Postby mackowiakp » Oct 19th, '15, 21:04

I will provide You output of "avahi-browse _airplay._tcp -tr" tomorrow, when I will be back to work. And, yes. Temporary file in necessary only to enter proper number corresponding to particular Apple TV box. I have 3 Apple TV boxes in local network at work.
Linux is like wigwam. No Windows, no Gates but Apache inside

WARNING ! The administrator has the right to refuse to install WINDOWS, invoking the conscience clause
mackowiakp
 
Posts: 646
Joined: May 23rd, '13, 07:32
Location: Gdynia, Poland

Re: Mirroring M5 screen to AppleTV

Postby doktor5000 » Oct 19th, '15, 21:39

I'd shorten it down like this:

Code: Select all
#!/bin/bash
choice="$(avahi-browse _airplay._tcp -ptr|awk -F';' '{print $8}'|grep -v ^$|zenity --list --hide-header --title="select Apple TV to mirror to:" --text="select one..." --column="IP adresses" 2>/dev/null)"
java -jar airplay.jar -h "$choice" -d


FWIW, you had
Code: Select all
cat /dev/null > ~/Pobrane/air_nodes

which is called "useless use of cat".
Simply use
Code: Select all
> ~/Pobrane/air_nodes


But as you use
Code: Select all
sed 's/\]$//' > ~/Pobrane/air_nodes

later on it's unnecessary to empty the file beforehand.

Also
Code: Select all
[ $line -eq "0" ] || [ $line -gt $ilosc ]

could be shortened down in bash as
Code: Select all
[[ $line -eq 0 -o -gt $ilosc ]]
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17629
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Mirroring M5 screen to AppleTV

Postby mackowiakp » Oct 20th, '15, 12:40

So You have an output from "avahi-browse _airplay._tcp -tr" :

Code: Select all
bash-4.3$ avahi-browse _airplay._tcp -tr
+ enp6s0 IPv4 Apple TV Gabinet (2)                          _airplay._tcp        local
= enp6s0 IPv4 Apple TV Gabinet (2)                          _airplay._tcp        local
   hostname = [Apple-TV-Gabinet.local]
   address = [192.168.100.115]
   port = [7000]
   txt = ["vv=2" "srcvers=220.68" "pi=6f2ee0d4-fac0-4f43-bdb3-ef0ccbbd760f" "pk=ac0a349f7fe67ba42d298ca8ed7e33213e29a16c8680e942476eaa0fdc1fe344" "model=AppleTV3,1" "flags=0x44" "features=0x5A7FFFF7,0xE" "deviceid=9C:20:7B:C7:B6:7F"]


And one remark to Your code:

Code: Select all
    #!/bin/bash
    choice="$(avahi-browse _airplay._tcp -ptr|awk -F';' '{print $8}'|grep -v ^$|zenity --list --hide-header --title="select Apple TV to mirror to:" --text="select one..." --column="IP adresses" 2>/dev/null)"
    java -jar airplay.jar -h "$choice" -d


It returns in zenity window IP address instead of human friendly box name. In my case it should be listed as "Apple TV Gabinet";

Below full listing obtained from "avahi-browse -avrc"

Code: Select all
+ enp6s0 IPv4 9C207BC7B67F@Apple TV Gabinet                 AirTunes Remote Audio local
+ enp6s0 IPv4 Apple TV Gabinet (2)                          _airplay._tcp        local
+ enp6s0 IPv4 D7AA420BA20ED3DA                              _appletv-v2._tcp     local
+ enp6s0 IPv4 HP Color LaserJet CP2025n (FB4EBC)            UNIX Printer         local
+ enp6s0 IPv4 OKI-ES8473MFP-2EDC8D                          UNIX Printer         local
+ enp6s0 IPv4 OKI-ES8473MFP-2E609E                          UNIX Printer         local
+ enp6s0 IPv4 HP Color LaserJet CP2025n (FB4EBC)            Web Site             local
+ enp6s0 IPv4 OKI-ES8473MFP-2EDC8D                          Web Site             local
+ enp6s0 IPv4 OKI-ES8473MFP-2E609E                          Web Site             local
+ enp6s0 IPv4 Biblioteka mac                                Apple Home Sharing   local
+ enp6s0 IPv4 D7AA420BA20ED3DA                              iPod Touch Music Library local
+ enp6s0 IPv4 A877089EEED5000C                              iPod Touch Music Library local
+ enp6s0 IPv4 HP Officejet 7500 E910 FAX                    _riousbprint._tcp    local
+ enp6s0 IPv4 HP Officejet 7500 E910                        _riousbprint._tcp    local
+ enp6s0 IPv4 HP Color LaserJet CP2025n (FB4EBC)            PDL Printer          local
+ enp6s0 IPv4 OKI-ES8473MFP-2EDC8D                          PDL Printer          local
+ enp6s0 IPv4 HP Officejet 7500 E910 FAX                    PDL Printer          local
+ enp6s0 IPv4 HP Officejet 7500 E910                        PDL Printer          local
+ enp6s0 IPv4 OKI-ES8473MFP-2E609E                          PDL Printer          local
+ enp6s0 IPv4 Base Station Sekretariat                      Apple AirPort        local
+ enp6s0 IPv4 WiFi Gabinet                                  Apple AirPort        local
+ enp6s0 IPv4 Office 8p.                                    Apple AirPort        local
+ enp6s0 IPv4 o9yRNz/NV6K3ciTkGO+wew@BIpOLbKYVri5qcGagTy0Cw _acp-sync._tcp       local
+ enp6s0 IPv4 m1/eUrCpXzuksfS3ANB5Wg@QjGgg5AgWaS47gqRzd6v5w _acp-sync._tcp       local
+ enp6s0 IPv4 IB3YmFAIXWS+wGkdEoMeew@2YjgDMlZXfCLnpeOYHovng _acp-sync._tcp       local
+ enp6s0 IPv4 xZCOt4FtWOCytSQp7a5/ig@2YjgDMlZXfCLnpeOYHovng _acp-sync._tcp       local
+ enp6s0 IPv4 50-35-10-70.1 Base Station Sekretariat        _sleep-proxy._udp    local
+ enp6s0 IPv4 50-35-10-70.1 WiFi Gabinet                    _sleep-proxy._udp    local
+ enp6s0 IPv4 50-35-10-70.1 Office 8p.                      _sleep-proxy._udp    local
+ enp6s0 IPv4 linux                                         Remote Disk Management local
+ enp6s0 IPv4 linux [00:1e:68:25:d5:75]                     Workstation          local
+ enp6s0 IPv4 linux                                         SSH Remote Terminal  local
= enp6s0 IPv4 9C207BC7B67F@Apple TV Gabinet                 AirTunes Remote Audio local
   hostname = [Apple-TV-Gabinet.local]
   address = [192.168.100.115]
   port = [7000]
   txt = ["vv=2" "vs=220.68" "vn=65537" "tp=UDP" "sf=0x44" "pk=ac0a349f7fe67ba42d298ca8ed7e33213e29a16c8680e942476eaa0fdc1fe344" "am=AppleTV3,1" "md=0,1,2" "ft=0x5A7FFFF7,0xE" "et=0,3,5" "da=true" "cn=0,1,2,3"]
= enp6s0 IPv4 Apple TV Gabinet (2)                          _airplay._tcp        local
   hostname = [Apple-TV-Gabinet.local]
   address = [192.168.100.115]
   port = [7000]
   txt = ["vv=2" "srcvers=220.68" "pi=6f2ee0d4-fac0-4f43-bdb3-ef0ccbbd760f" "pk=ac0a349f7fe67ba42d298ca8ed7e33213e29a16c8680e942476eaa0fdc1fe344" "model=AppleTV3,1" "flags=0x44" "features=0x5A7FFFF7,0xE" "deviceid=9C:20:7B:C7:B6:7F"]
= enp6s0 IPv4 D7AA420BA20ED3DA                              _appletv-v2._tcp     local
   hostname = [Apple-TV-Gabinet.local]
   address = [192.168.100.115]
   port = [3689]
   txt = ["MiTPV=196611" "EiTS=1" "DFID=2" "PrVs=65538" "Name=Apple TV Gabinet" "fs=2" "MniT=167845888" "hG=00000000-0ab8-46e6-c43d-6e15a89e4a2a" "atSV=65541" "txtvers=1"]
= enp6s0 IPv4 HP Color LaserJet CP2025n (FB4EBC)            UNIX Printer         local
   hostname = [NPIFB4EBC.local]
   address = [192.168.100.116]
   port = [515]
   txt = ["TBCP=T" "Binary=T" "Transparent=T" "adminurl=http://NPIFB4EBC.local." "priority=50" "product=(HP Color LaserJet CP2025dn)" "ty=HP Color LaserJet CP2025dn" "rp=RAW" "qtotal=1" "txtvers=1"]
= enp6s0 IPv4 OKI-ES8473MFP-2EDC8D                          UNIX Printer         local
   hostname = [oki-es8473mfp-2edc8d.local]
   address = [192.168.100.95]
   port = [515]
   txt = ["usb_CMD=PCL,XPS,IBMPPR,EPSONFX,POSTSCRIPT,PDF,PCLXL,HIPERMIP,URF" "usb_MDL=ES8473 MFP" "usb_MFG=OKI DATA CORP" "adminurl=https://oki-es8473mfp-2edc8d.local." "pdl=application/postscript,application/vnd.hp-PCL" "product=(ES8473 MFP)" "ty=OKI ES8473 MFP" "priority=50" "qtotal=1" "note=" "rp=lp" "txtvers=1"]
= enp6s0 IPv4 OKI-ES8473MFP-2E609E                          UNIX Printer         local
   hostname = [oki-es8473mfp-2e609e.local]
   address = [192.168.100.96]
   port = [515]
   txt = ["usb_CMD=PCL,XPS,IBMPPR,EPSONFX,POSTSCRIPT,PDF,PCLXL,HIPERMIP,URF" "usb_MDL=ES8473 MFP" "usb_MFG=OKI DATA CORP" "adminurl=https://oki-es8473mfp-2e609e.local." "pdl=application/postscript,application/vnd.hp-PCL" "product=(ES8473 MFP)" "ty=OKI ES8473 MFP" "priority=50" "qtotal=1" "note=" "rp=lp" "txtvers=1"]
= enp6s0 IPv4 HP Color LaserJet CP2025n (FB4EBC)            Web Site             local
   hostname = [NPIFB4EBC.local]
   address = [192.168.100.116]
   port = [80]
   txt = []
= enp6s0 IPv4 OKI-ES8473MFP-2EDC8D                          Web Site             local
   hostname = [oki-es8473mfp-2edc8d.local]
   address = [192.168.100.95]
   port = [80]
   txt = []
= enp6s0 IPv4 OKI-ES8473MFP-2E609E                          Web Site             local
   hostname = [oki-es8473mfp-2e609e.local]
   address = [192.168.100.96]
   port = [80]
   txt = []
= enp6s0 IPv4 Biblioteka mac                                Apple Home Sharing   local
   hostname = [Mac-mini-mac.local]
   address = [192.168.100.109]
   port = [3689]
   txt = ["hC=ab2bb645-bd1e-4bd8-88b4-ce9d0385a7c9" "Machine ID=96ADE412B3E1" "hG=00000000-2384-c452-f94e-bd2661e345b5" "DvTy=iTunes" "Machine Name=Biblioteka mac" "Version=196620" "DvSv=2880" "iCSV=65539" "OSsi=0x1F5" "Database ID=83E0191D9CE6625E" "PrVs=65538" "MID=0xA877089EEED5000C" "iTSh Version=196618" "dmv=131082" "hQ=205" "txtvers=1"]
= enp6s0 IPv4 D7AA420BA20ED3DA                              iPod Touch Music Library local
   hostname = [Apple-TV-Gabinet.local]
   address = [192.168.100.115]
   port = [3689]
   txt = ["Ver=131077" "atCV=65539" "DvSv=1792" "DvTy=AppleTV" "CtlN=Apple TV Gabinet" "DbId=5F926CA60A374BEB" "atSV=65541" "txtvers=1"]
= enp6s0 IPv4 A877089EEED5000C                              iPod Touch Music Library local
   hostname = [Mac-mini-mac.local]
   address = [192.168.100.109]
   port = [3689]
   txt = ["Ver=131077" "iV=196618" "DvTy=iTunes" "DvSv=2880" "iCSV=65539" "OSsi=0x1F5" "CtlN=Biblioteka mac" "DbId=83E0191D9CE6625E" "txtvers=1"]
= enp6s0 IPv4 HP Officejet 7500 E910 FAX                    _riousbprint._tcp    local
   hostname = [WiFi-Gabinet.local]
   address = [169.254.143.197]
   port = [10000]
   txt = ["usb_S=038000C484001041005a0c8000045d3001444d5001446d5001441d00046" "usb_SN=MY17U210B905JB" "usb_LEDMDIS=USB#FF#CC#00,USB#07#01#02,USB#FF#04#01" "usb_CID=HPIJVIPAV2" "usb_DES=C9309A" "usb_CLS=PRINTER" "usb_1284.4DL=4d,4e,1" "usb_CMD=MLC,PCL,DW-PCL,PML,802.11,802.3,DESKJET,DYN" "usb_MDL=Officejet 7500 E910 FAX" "usb_MFG=HP" "priority=1" "pdl=application/MLC,application/PCL,application/DW-PCL,application/PML,application/802.11,application/802.3,application/DESKJET,application/DYN" "rp=HP Officejet 7500 E910 FAX MY17U210B905JB" "product=(HP Officejet 7500 E910 FAX)" "note=WiFi Gabinet" "qtotal=1" "txtvers=1"]
= enp6s0 IPv4 HP Officejet 7500 E910                        _riousbprint._tcp    local
   hostname = [WiFi-Gabinet.local]
   address = [169.254.143.197]
   port = [10000]
   txt = ["usb_S=038000C484001041005a0c8000045d3001444d5001446d5001441d00046" "usb_SN=MY17U210B905JB" "usb_LEDMDIS=USB#FF#CC#00,USB#07#01#02,USB#FF#04#01" "usb_CID=HPIJVIPAV2" "usb_DES=C9309A" "usb_CLS=PRINTER" "usb_1284.4DL=4d,4e,1" "usb_CMD=MLC,PCL,DW-PCL,PML,802.11,802.3,DESKJET,DYN" "usb_MDL=Officejet 7500 E910" "usb_MFG=HP" "priority=1" "pdl=application/MLC,application/PCL,application/DW-PCL,application/PML,application/802.11,application/802.3,application/DESKJET,application/DYN" "rp=HP Officejet 7500 E910 MY17U210B905JB" "product=(HP Officejet 7500 E910)" "note=WiFi Gabinet" "qtotal=1" "txtvers=1"]
= enp6s0 IPv4 HP Color LaserJet CP2025n (FB4EBC)            PDL Printer          local
   hostname = [NPIFB4EBC.local]
   address = [192.168.100.116]
   port = [9100]
   txt = ["TBCP=T" "Binary=T" "Transparent=T" "adminurl=http://NPIFB4EBC.local." "priority=40" "product=(HP Color LaserJet CP2025dn)" "ty=HP Color LaserJet CP2025dn" "qtotal=1" "txtvers=1"]
= enp6s0 IPv4 OKI-ES8473MFP-2EDC8D                          PDL Printer          local
   hostname = [oki-es8473mfp-2edc8d.local]
   address = [192.168.100.95]
   port = [9100]
   txt = ["usb_CMD=PCL,XPS,IBMPPR,EPSONFX,POSTSCRIPT,PDF,PCLXL,HIPERMIP,URF" "usb_MDL=ES8473 MFP" "usb_MFG=OKI DATA CORP" "adminurl=https://oki-es8473mfp-2edc8d.local." "pdl=application/postscript,application/vnd.hp-PCL" "product=(ES8473 MFP)" "ty=OKI ES8473 MFP" "priority=50" "qtotal=1" "note=" "txtvers=1"]
= enp6s0 IPv4 HP Officejet 7500 E910 FAX                    PDL Printer          local
   hostname = [WiFi-Gabinet.local]
   address = [169.254.143.197]
   port = [9101]
   txt = ["ty=C9309A" "usb_S=038000C484001041005a0c8000045d3001444d5001446d5001441d00046" "usb_SN=MY17U210B905JB" "usb_LEDMDIS=USB#FF#CC#00,USB#07#01#02,USB#FF#04#01" "usb_CID=HPIJVIPAV2" "usb_DES=C9309A" "usb_CLS=PRINTER" "usb_1284.4DL=4d,4e,1" "usb_CMD=MLC,PCL,DW-PCL,PML,802.11,802.3,DESKJET,DYN" "usb_MDL=Officejet 7500 E910 FAX" "usb_MFG=HP" "priority=5" "pdl=application/vnd.hp-PCL" "product=(HP Officejet 7500 E910 FAX)" "note=WiFi Gabinet" "qtotal=1" "txtvers=1"]
= enp6s0 IPv4 HP Officejet 7500 E910                        PDL Printer          local
   hostname = [WiFi-Gabinet.local]
   address = [169.254.143.197]
   port = [9100]
   txt = ["ty=C9309A" "usb_S=038000C484001041005a0c8000045d3001444d5001446d5001441d00046" "usb_SN=MY17U210B905JB" "usb_LEDMDIS=USB#FF#CC#00,USB#07#01#02,USB#FF#04#01" "usb_CID=HPIJVIPAV2" "usb_DES=C9309A" "usb_CLS=PRINTER" "usb_1284.4DL=4d,4e,1" "usb_CMD=MLC,PCL,DW-PCL,PML,802.11,802.3,DESKJET,DYN" "usb_MDL=Officejet 7500 E910" "usb_MFG=HP" "priority=5" "pdl=application/vnd.hp-PCL" "product=(HP Officejet 7500 E910)" "note=WiFi Gabinet" "qtotal=1" "txtvers=1"]
= enp6s0 IPv4 OKI-ES8473MFP-2E609E                          PDL Printer          local
   hostname = [oki-es8473mfp-2e609e.local]
   address = [192.168.100.96]
   port = [9100]
   txt = ["usb_CMD=PCL,XPS,IBMPPR,EPSONFX,POSTSCRIPT,PDF,PCLXL,HIPERMIP,URF" "usb_MDL=ES8473 MFP" "usb_MFG=OKI DATA CORP" "adminurl=https://oki-es8473mfp-2e609e.local." "pdl=application/postscript,application/vnd.hp-PCL" "product=(ES8473 MFP)" "ty=OKI ES8473 MFP" "priority=50" "qtotal=1" "note=" "txtvers=1"]
= enp6s0 IPv4 Base Station Sekretariat                      Apple AirPort        local
   hostname = [Base-Station-Sekretariat.local]
   address = [169.254.73.43]
   port = [5009]
   txt = ["waMA=F8-1E-DF-F7-63-EF,raMA=F8-1E-DF-FD-CE-FB,raM2=F8-1E-DF-FD-CE-FC,raNm=Sekretariat,raCh=1,rCh2=44,raSt=0,raNA=0,syFl=0x8A0C,syAP=114,syVs=7.6.4,srcv=76400.10,bjSd=23"]
= enp6s0 IPv4 WiFi Gabinet                                  Apple AirPort        local
   hostname = [WiFi-Gabinet.local]
   address = [169.254.143.197]
   port = [5009]
   txt = ["waMA=6C-70-9F-D6-D5-A8,raMA=6C-70-9F-E6-D7-E5,raM2=6C-70-9F-E6-D7-E4,raNm=WiFi Gabinet,raCh=36,rCh2=1,raSt=0,raNA=0,syFl=0x8A0C,syAP=120,syVs=7.7.3,srcv=77300.1,bjSd=25"]
= enp6s0 IPv4 Office 8p.                                    Apple AirPort        local
   hostname = [Office-8p.local]
   address = [169.254.59.191]
   port = [5009]
   txt = ["waMA=00-26-BB-72-DE-B2,raMA=00-26-BB-79-56-AB,raM2=00-26-BB-79-56-AC,raNm=Office8p,raCh=12,rCh2=36,raSt=0,raNA=0,syFl=0x8A0C,syAP=114,syVs=7.6.4,srcv=76400.10,bjSd=38"]
= enp6s0 IPv4 o9yRNz/NV6K3ciTkGO+wew@BIpOLbKYVri5qcGagTy0Cw _acp-sync._tcp       local
   hostname = [Base-Station-Sekretariat.local]
   address = [169.254.73.43]
   port = [5009]
   txt = ["bssinfo=AQIBUYYIAAAH+B7f/c77LHSGCAAAB/ge3/3O/A" "ssid=Sekretariat" "mac=F8:1E:DF:F7:63:EF" "nm=Base Station Sekretariat" "cu=4dde65b7-ee90-555f-a5a9-f20ee14e9322"]
= enp6s0 IPv4 m1/eUrCpXzuksfS3ANB5Wg@QjGgg5AgWaS47gqRzd6v5w _acp-sync._tcp       local
   hostname = [WiFi-Gabinet.local]
   address = [169.254.143.197]
   port = [5009]
   txt = ["bssinfo=AQIkgIYQAAAJbHCf5tflAVGGCAAAB2xwn+bX5A" "ssid=WiFi Gabinet" "mac=6C:70:9F:D6:D5:A8" "nm=WiFi Gabinet" "cu=4dde65b7-ee90-555f-a5a9-f20ee14e9322"]
= enp6s0 IPv4 IB3YmFAIXWS+wGkdEoMeew@2YjgDMlZXfCLnpeOYHovng _acp-sync._tcp       local
   hostname = [Office-8p.local]
   address = [169.254.59.191]
   port = [5009]
   txt = ["bssinfo=AQEkdJYIAAAHACa7eVas" "ssid=Office8p 5 GHz" "mac=00:26:BB:72:DE:B2" "nm=Office 8p." "cu=4dde65b7-ee90-555f-a5a9-f20ee14e9322"]
= enp6s0 IPv4 xZCOt4FtWOCytSQp7a5/ig@2YjgDMlZXfCLnpeOYHovng _acp-sync._tcp       local
   hostname = [Office-8p.local]
   address = [169.254.59.191]
   port = [5009]
   txt = ["bssinfo=AQEMUYYIAAAHACa7eVar" "ssid=Office8p" "mac=00:26:BB:72:DE:B2" "nm=Office 8p." "cu=4dde65b7-ee90-555f-a5a9-f20ee14e9322"]
= enp6s0 IPv4 50-35-10-70.1 Base Station Sekretariat        _sleep-proxy._udp    local
   hostname = [Base-Station-Sekretariat.local]
   address = [169.254.73.43]
   port = [57118]
   txt = []
= enp6s0 IPv4 50-35-10-70.1 WiFi Gabinet                    _sleep-proxy._udp    local
   hostname = [WiFi-Gabinet.local]
   address = [169.254.143.197]
   port = [54113]
   txt = []
= enp6s0 IPv4 50-35-10-70.1 Office 8p.                      _sleep-proxy._udp    local
   hostname = [Office-8p.local]
   address = [169.254.59.191]
   port = [53659]
   txt = []
= enp6s0 IPv4 linux                                         Remote Disk Management local
   hostname = [linux.local]
   address = [192.168.100.101]
   port = [22]
   txt = []
= enp6s0 IPv4 linux [00:1e:68:25:d5:75]                     Workstation          local
   hostname = [linux.local]
   address = [192.168.100.101]
   port = [9]
   txt = []
= enp6s0 IPv4 linux                                         SSH Remote Terminal  local
   hostname = [linux.local]
   address = [192.168.100.101]
   port = [22]
   txt = []
Linux is like wigwam. No Windows, no Gates but Apache inside

WARNING ! The administrator has the right to refuse to install WINDOWS, invoking the conscience clause
mackowiakp
 
Posts: 646
Joined: May 23rd, '13, 07:32
Location: Gdynia, Poland

Re: Mirroring M5 screen to AppleTV

Postby doktor5000 » Oct 20th, '15, 20:12

mackowiakp wrote:
Code: Select all
choice="$(avahi-browse _airplay._tcp -ptr|awk -F';' '{print $8}'|grep -v ^$|zenity --list --hide-header --title="select Apple TV to mirror to:" --text="select one..." --column="IP adresses" 2>/dev/null)"

It returns in zenity window IP address instead of human friendly box name. In my case it should be listed as "Apple TV Gabinet";

Well, then change it to display the hostname.It's the seventh column instead of the eigth, so
Code: Select all
awk -F';' '{print $8}'
becomes
Code: Select all
awk -F';' '{print $7}'
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17629
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Mirroring M5 screen to AppleTV

Postby mackowiakp » Apr 3rd, '16, 13:46

Advice please ! The process initialises by java -jar airplay.jar command line, can be stop by depressing control-C character. How can I send control-C to such process from zenity (or other) GUI? It is importand because at this moment, java -jar airplay.jar ones started, still mirror M5 desktop do Apple-TV. The only solution is to run the script form terminal and end it by control-C from that terminal.
Linux is like wigwam. No Windows, no Gates but Apache inside

WARNING ! The administrator has the right to refuse to install WINDOWS, invoking the conscience clause
mackowiakp
 
Posts: 646
Joined: May 23rd, '13, 07:32
Location: Gdynia, Poland

Re: Mirroring M5 screen to AppleTV

Postby doktor5000 » Apr 3rd, '16, 13:57

ctrl+c sends the SIGINT signal, so you can use that.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17629
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Mirroring M5 screen to AppleTV

Postby mackowiakp » Apr 3rd, '16, 17:14

Yes, I know that ctrl+c sends the SIGINT signal. But how can I obtain process number to send it ctrc-c ? There is no airplay.jar process ins system.
Linux is like wigwam. No Windows, no Gates but Apache inside

WARNING ! The administrator has the right to refuse to install WINDOWS, invoking the conscience clause
mackowiakp
 
Posts: 646
Joined: May 23rd, '13, 07:32
Location: Gdynia, Poland

Re: Mirroring M5 screen to AppleTV

Postby doktor5000 » Apr 4th, '16, 01:01

Inside your script run
Code: Select all
pstree -pas $$
once and display the output or write it to some file, you'll see all your parent and child processes.
Then you could run ps www on all the childs to get their full comm fields if you don't know what processes you start.

Or
Code: Select all
ps auxwww|grep -v grep|grep -iE "java|airplay"
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17629
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

[SOLVED]Re: Mirroring M5 screen to AppleTV

Postby mackowiakp » Aug 1st, '16, 09:01

Below my final version of "AirPlay for Linux". First run start cloning desktop from M5 to AppleTV, the second run, turn it off. If anybody interested - wecame:

Code: Select all
#!/bin/bash
if [ -f ~/tmp/apple ]
then
proc=`cat ~/tmp/apple`
kill -9 $proc
rm -f ~/tmp/apple 2>/dev/null
kdialog --passivepopup "End of cloning to Apple TV" 5 2>/dev/null
else
choice="$(avahi-browse _airplay._tcp -ptr|awk -F';' '{print $7}'|grep -v ^$|zenity --list --hide-header --title="Wybór Apple TV" --text="Wybierz Apple TV..." --column="IP adresses" 2>/dev/null)"
#echo Wybór
#echo $choice
if [ -z "$choice" ]
then
kdialog --passivepopup "ERROR - no choice taken" 5 2>/dev/null
exit
else
java -jar airplay.jar -h "$choice" -d &
kdialog --passivepopup "Start cloning to Apple TV" 5 2>/dev/null
proc=$!
echo $proc > ~/tmp/apple
fi
fi
Linux is like wigwam. No Windows, no Gates but Apache inside

WARNING ! The administrator has the right to refuse to install WINDOWS, invoking the conscience clause
mackowiakp
 
Posts: 646
Joined: May 23rd, '13, 07:32
Location: Gdynia, Poland


Return to Networking

Who is online

Users browsing this forum: No registered users and 1 guest

cron