Kodi Community Forum
AirPlay target support integrated into XBMC natively? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Discussions (https://forum.kodi.tv/forumdisplay.php?fid=222)
+--- Forum: Feature Requests (https://forum.kodi.tv/forumdisplay.php?fid=9)
+--- Thread: AirPlay target support integrated into XBMC natively? (/showthread.php?tid=80400)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41


- PWiddershoven - 2011-03-12

Unfortunately not, see this.

Apperently IOS uses a non standard format of specifying video orientation.


- olejon - 2011-03-12

This is just awesome! Excellent piece of work.

Just installed on my HTPC running Ubuntu 9.11 (Karmic) with XBMC. Working great showing photos (which is why I use this) and videos (no DRM).

Had to install "python-setuptools" and "python-pip" (apt-get install python-setuptools python-pip) to be able to run the pip-command (should be added to the install instructions?)


Python 2.6.x on Pin87 image - mattg42 - 2011-03-12

Hi @PWiddershoven

Thanks for looking into the effort to port the Python libs to 2.5 and completely understand that isn't a high priority and would take too much time.

Do you have any advice whether I (or anyone using the Umbuntu 8.x / Pin87a image on the ATV1) could upgrade to python 2.6 without breaking other scripts?

If its just a case of me doing an apt-get , could someone advise me of the commands to upgrade my python to 2.6.x so I can use this great script?

Thanks again!


- barberio - 2011-03-13

Okay, after experimentation, I've worked out that while it is possible to use the Windows iTunes client as a backend, the dcom interface makes it only barely usable. However, it does provide support for itunes purchases, so long as the iTunes client is authorised. Going to have a crack at the OS X client next, in hopes that it makes for a better backend.

Using XBMC or Boxee as the backend for generic media is the way forward, but would it be possible for airplayer to switch to a different backend for encrypted content? This would then allow limited support for itunes purchased content by using a local itunes client as the backend, while still able to use a better system like XBMC for everything else.

Here's the experimental windows iTunes client backend,

Code:
import win32com.client
import win32com.client.dynamic
import os
import time

from base_media_backend import BaseMediaBackend
from collections import deque
from win32com.client import gencache

class ituneswinMediaBackend(BaseMediaBackend):
    """
    First attempt at an itunes dcom plugin.
    """
    
    def __init__(self, host, port, username=None, password=None):
        """
        Sets up dcom client for itunes
        """
        gencache.EnsureModule('{9E93C96F-CF0D-43F6-8BA8-B807A3370712}', 0, 1, 13)
        self.itunes= win32com.client.gencache.EnsureDispatch("iTunes.Application")
        self.scrubqueue= deque([])

    def cleanup(self):
        """
        """
        
    def stop_playing(self):
        """
        Stop playing media.
        """
        self.CurrentTrack.Delete()
        self.itunes.Stop()
        
        
    def show_picture(self, data):
        """
        Not implimented
        """
        
    def play_movie(self, url):
        """
        Includes a loop, with a timeout, to not return till itunes is actually playing.
        """
        self.itunes.Stop()
        self.itunes.OpenURL(url)
    # Save the current playing track so we can delete it when playback stops.
        self.CurrentTrack = win32com.client.CastTo(self.itunes.CurrentTrack, "IITURLTrack")
        for n in range(30):
            if self.itunes.PlayerState:
                break
            time.sleep(0.1)
  
        
    def notify_started(self):
        """
        Not implimented
        """
        
    def pause(self):
        """
        Pause
        """
        self.itunes.Pause()
    
    def play(self):
        """
        Play
        """
        for n in range(180):
            self.itunes.Play()
            if self.itunes.PlayerState :
                break
        
        
    def get_player_position(self):
        """
        """
        if len(self.scrubqueue) > 0 :
            print ("Change queued, trying.")
            newPlayerPosition = self.scrubqueue.popleft()
            print ("Moving to ",newPlayerPosition)
            try:
                self.itunes.PlayerPosition = newPlayerPosition
            except:
                print ("Change failed, readding to queue")
                self.scrubqueue.append(newPlayerPosition)
        return self.itunes.PlayerPosition,self.itunes.CurrentTrack.Duration

    def is_playing(self):
        """
        Return wether the backend is currently playing any media.
        
        @returns boolean
        """
        print ("Airtunes asked for playstate. Returning: ")
        if self.itunes.PlayerState :
            print ("Playing", self.itunes.PlayerState)
            return True
        else :
            print ("Paused", self.itunes.PlayerState)
            return False
        
    
    def set_player_position(self, position):
        """
        Queues scrub bar changes in a push pop list to try and prevent fouling.
        Set it four times because the scrub-bar has issues. Impliments a crude
        soft rate limit by dropping the last item in the queue if there are more
        than one after the timeout.
        """
        time.sleep(0.1)
        if len(self.scrubqueue) > 5 :
            self.scrubqueue.popleft()
        self.scrubqueue.append(position)

        newPlayerPosition = self.scrubqueue.popleft()
        print ("Moving to ",newPlayerPosition)
        try:
            self.itunes.PlayerPosition = newPlayerPosition
        except:
            print ("Change failed, readding to queue")
            self.scrubqueue.append(newPlayerPosition)
        
    

    def set_player_position_percentage(self, percentage_position):
        """
        Works out the percentage to a second position.
        """
        self.itunes.PlayerPosition = ((self.itunes.CurrentTrack.Duration/100)*percentage_position)

    def set_start_position(self, percentage_position):
        """
        Waits till itunes is ready
        """
        exceptionbreakout = 0
        for n in range(180):
            if exceptionbreakout:
                break
            try:
                self.itunes.PlayerPosition = ((self.itunes.CurrentTrack.Duration/100)*percentage_position)
            except:
                time.sleep(.3)
            else:
                exceptionbreakout = 1
        print ("Initial Wait : ", n-1)

Note: These are the known issues I haven't been able to work around yet.
  • Scrub bar moves to the wrong position. Seems to be a bug in windows iTunes, happens when moving the scrub bar in iTunes too.
  • Initial start point isn't set.
  • Content source URLs longer than 512 characters will fail. (YouTube app)



- Weavus - 2011-03-15

Anyone know which ports I need to open up in Windows firewall to be able to use the Airplayer script?


auto start? - Rumik - 2011-03-17

Hi all,

I've followed the instructions here: http://htpcbuild.wordpress.com/2011/03/05/get-airplay-working-on-your-xbmc-live-htpc/ and have got the script running, but only when I manually run it through a terminal window. I followed the instructions on starting it automatically every time you boot XBMC but that part of it isn't working.

Can anyone help me figure out how to make this auto start?

Thanks Smile


- krijeck - 2011-03-17

Rumik Wrote:Hi all,

I've followed the instructions here: http://htpcbuild.wordpress.com/2011/03/05/get-airplay-working-on-your-xbmc-live-htpc/ and have got the script running, but only when I manually run it through a terminal window. I followed the instructions on starting it automatically every time you boot XBMC but that part of it isn't working.

Can anyone help me figure out how to make this auto start?

Thanks Smile

Hello!
I had the same issue!
But when following these instructions:
Code:
15. cd /etc/init.d and next sudo chmod +x airplayer

16. sudo nano airplayer Edit user (username), group (id username to find out) and path to where the airplayer.py script is located for me it is “/home/tripkip/PascalW-Airplayer-7a7873e/airplayer/airplayer.py”

There is a remark for making the file airplayer.py execute able ... just make sudo chmod +x airplayer.py in your home folder where the file is located (I guess because I am not in front of my PC now) and then it should work! I think the .py is missing in the manual!

then it worked for me!
hope that helps ...

also installed airvideoenabler thats really cool!!!!


- Rumik - 2011-03-17

Hi there,

thanks for replying. I'm pretty new to Linux so maybe there's a step I'm missing in the instructions. I've done what you suggested but it hasn't made a difference.

I think maybe the problem is with this step:

Quote:sudo nano airplayer Edit user (username), group (id username to find out) and path to where the airplayer.py script is located for me it is “/home/tripkip/PascalW-Airplayer-7a7873e/airplayer/airplayer.py”

Here's how I've configured it...

DAEMON="airplayer/airplayer/airplayer.py"
DAEMON_OPTS="-d --pidfile $PIDFILE --logfile $LOGFILE"

USER=xbmc
GROUP=xbmc



My airplayer script is in root/airplayer/airplayer/airplayer.py so that's how I've configured it. I've also tried changing the path to DAEMON="root/airplayer/airplayer/airplayer.py" but that hasn't helped either.

Maybe it's this step I'm doing wrong?

cd /etc/init.d and next sudo chmod +x airplayer

What does and next mean? I assumed it meant type cd /etc/init.d, then press enter, then type sudo chmod +x airplayer but perhaps I'm wrong? As I said I'm/ fairly new to Linux and I'm following these instructions to the letter but perhaps I'm missing something?

Any help would be appreciated Smile

Thanks


- krijeck - 2011-03-18

Rumik Wrote:cd /etc/init.d and next sudo chmod +x airplayer

What does and next mean? I assumed it meant type cd /etc/init.d, then press enter, then type sudo chmod +x airplayer but perhaps I'm wrong? As I said I'm/ fairly new to Linux and I'm following these instructions to the letter but perhaps I'm missing something?

Any help would be appreciated Smile

Thanks

exactly! and next means press enter and next make the sudo chmod +x airplayer command! Nod

and actually (as I am not on my home PC) I think here I added the .py ....


- Rumik - 2011-03-18

In that case I've followed all the instructions properly and still it's not working Sad the only thing I can think of that still might be wrong are the username, group and/or path.


- krijeck - 2011-03-18

Rumik Wrote:In that case I've followed all the instructions properly and still it's not working Sad the only thing I can think of that still might be wrong are the username, group and/or path.

curious ... I followed exactly the guide with the only difference of the .py as said before and everything works like a charm!

maybe you try to start from scratch and follow exactly the guide ... Shocked


- Rumik - 2011-03-18

I did just that this morning, this time extracting the zip into the home folder so it's in \home\xbmc\airplayer\airplayer\airplayer.py but it just won't run on boot Sad

Is there perhaps a way of using the autoexec to get this script to run on boot?


- Ebbo - 2011-03-18

This is so good. I cannot tell you how much I like that!


- wgou - 2011-03-21

Hi,

I have installed Airplayer on a Mac OS X system and sending photos and video from the photo app, video from itunes app, video from the default video app on my iPhone or iPad works fine. If I try to send music from the iPod app, I do not see the airplay icon. I only see this if I setup shared speakers in the network. Even if I do a slideshow and enable music, the photo's are sent through airplayer to XBMC, but not the music and it plays locally on iPad or iPhone. Any idea's??


- Weavus - 2011-03-21

wgou Wrote:Hi,
If I try to send music from the iPod app, I do not see the airplay icon. I only see this if I setup shared speakers in the network. Even if I do a slideshow and enable music, the photo's are sent through airplayer to XBMC, but not the music and it plays locally on iPad or iPhone. Any idea's??
Music playing is not yet supported.