Home AMX User Forum AMX Design Tools

Apple TV!!

124

Comments

  • truetrue Posts: 307
    Glad you figured it out. :) I hope the module works well for you.
  • jimmywjimmyw Posts: 112
    True, you still developing this module?
    Looking at what you wrote, creating you own mDNS packets IS fun!
    Tweaking the code to try and make coverart more reliable, also playing with the artist lists and sublisting, as is it just plays playlists and returns to the main menu as soon as you pick something
    Also, some odd code for reconnect / logins, still trying to understand where you were going.
    I have been devoloping this, sadly the new appleTV's dont work this way but, I can use a Via EPIA LN10000EG it a micro case for about 240 booting right off a USB drive with itunes 9
  • truetrue Posts: 307
    jimmyw, it is on haitus for a while; I intend to start picking it up and possibly hacking the newer units if I can get one.

    Disconnect / reconnect was through constant experimentation as the aTV would freak out if connections were maintained for a while (it still does), and it completely ignores communication from the NI IP address until the aTV is rebooted. Having it disconnect / reconnect prolonged the amount of time until this occured but still didn't fix it. Having it re-login seemed to help, but again doesn't completely resolve the issue. So, to be honest, not exactly sure what I was getting at :)

    The main issue is that most communications need to be polled, hence why an open connection needs to be maintained. There is a way to allow non-polled communications but it requires multiple connections to the same remote port, which NetLinx doesn't allow. Doing this would make for far more reliable updates of metadata and cover art...still thinking of ways around it. Regardless I've played with things like coverart for a while, but kinda gave up since it worked well enough until I could spend time tackling specific issues.

    Re: more than playlists, it was my intent to get there with cover art browsing included. It just never got done. Playlists is different and easier than the rest, hence why it was in first. Album/artist/song is quite a bit different in how it works.
  • jimmywjimmyw Posts: 112
    I actually have gotten cover art 100% reliable, BUT, the issue I am having is filehandles, I have 5 ATV, + other modules that do cover art etc, so I kept crashing the NI with too much writing to the CF, I have artist list semi working right now, I am still probably at least 10 hours away from FULLY understanding what everything is doing, I am thinking of implementing a propeller MCU to handle all the actual connections then having 1 ip connection from NI to the prop, similar to what I did with Sirius head units. It looks like I am going to have to write a module that handles the filesystem and send everything off to there. for now I have a SynAccess PDU that I just reboot the ATVs every night and seems to be happy with that. Once I get to a point where it seems like my code would be an improvement over what we currently have, I'll post it.
  • truetrue Posts: 307
    jimmyw, it seems the only solution to DACP multiple connection support would be external due to NetLinx implementation. Kinda sucks. :(

    What did you do to get coverart to be reliable?
  • jimmywjimmyw Posts: 112
    I made a buffer array to receive the coverart, it seems to can only append a string to 16000 chars, even if the char array is 50000 (a very odd number, but I wrote a test module and it comes up that way every time)
    ie byte_array = "byte_array,more_bytes" and it seems to on average for the high quality coverart to take 21 iterations, each iteration taking .3 on average, I added some code that if if got no response and the iteration count was 0 after .9 seconds, to ask if there was coverart available, if there was, restart, I have only 3 times in 100 interations had to request it twice if there was art available. Once I filled the buffers you would normally dump the buffers to a file, but I am sending them to my IO module to wait to be written.

    I am working on this project again, just had to revamp my sirius radio stuff for a new job. I manage to crash itunes 9 every once in a while when requesting artists, any ideas?
    Jimmy
  • zeroiozeroio Posts: 13
    AppleTV and reboots

    I have a keypad working nice with the appletv module (yep, I donated!) and here's two thoughts...

    1) As mentioned, the AppleTV needs rebooting from time-to-time. I decided to look into getting it to reboot every day at 4am and the best solution is to get ATV Patchstick with SSH installed, then you can copy cron and crontab which are two unix scheduling utilities... just schedule a reboot. I've done the patchstick without any problems but I still need to find cron and crontab from an old OS X 10.4 Intel install disk. I think mine is at the office. Anyone have these commands handy?
    http://code.google.com/p/atvusb-creator/

    2) Using a keypad is different than a panel so the appletv module needs some tweaks. I'd like to be able to get a complete list of the playlists in one call without the page up/page down code since the MIO-DMS can have it loaded all at once. I played around with the max values but that didn't seem to work.

    That's about it. Nice work!
  • viningvining Posts: 4,368
    zeroio wrote: »
    I have a keypad working nice with the appletv module (yep, I donated!) and here's two thoughts...

    1) As mentioned, the AppleTV needs rebooting from time-to-time. I decided to look into getting it to reboot every day at 4am and the best solution is to get ATV Patchstick with SSH installed, then you can copy cron and crontab which are two unix scheduling utilities... just schedule a reboot. I've done the patchstick without any problems but I still need to find cron and crontab from an old OS X 10.4 Intel install disk. I think mine is at the office. Anyone have these commands handy?
    http://code.google.com/p/atvusb-creator/

    2) Using a keypad is different than a panel so the appletv module needs some tweaks. I'd like to be able to get a complete list of the playlists in one call without the page up/page down code since the MIO-DMS can have it loaded all at once. I played around with the max values but that didn't seem to work.

    That's about it. Nice work!

    If you're looking for cron just google "cron man" and that should lead you to the unix cron manuals.

    Here's a copy of my crontab (/etc/crontab) on a Linux fc14 vortexbox. These cron jobs are pointers to shell scripts I created but you can just put jobs in the etc/cron.daily or etc/cron.hourly directories. You might also need to look at the etc/anacrontab. On my system that is what calls the cron.daily and cron.weekly folders and crontab was empty.

    crontab:
    [vortexbox_0.localdomain ~]# nano /etc/crontab
      GNU nano 2.2.4             File: /etc/crontaSHELL=/bin/bash
    PATH=/sbin:/bin:/usr/sbin:/usr/bin
    MAILTO=root
    
    # For details see man 4 crontabs
    
    # Example of job definition:
    # .---------------- minute (0 - 59)
    # |  .------------- hour (0 - 23)
    # |  |  .---------- day of month (1 - 31)
    # |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
    # |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
    # |  |  |  |  |
    # *  *  *  *  * user-name  command to be executed
    
    */5 * * * *  root /etc/cron.rsync/rsync_Auto.cron	
    001 0 * * *  root /etc/cron.rsync/rsync_Periodic.cron 		
    1 */6 * * *  root /etc/cron.rsync/rsync_Periodic.cron 		
    001 0 * * *  root /etc/cron.rsync/rsync.clearlogs 
    
    anacrontab:
    note the command "run-parts", that's a command to run all files in those directories so you can just create your own shell script and drop it in cron.daily directory. The "nice" invokes a command with an altered scheduling priority. Since no nice level is specified 10 is assumed. You may need to look up anacron man too.
    # /etc/anacrontab: configuration file for anacron
    
    # See anacron(8) and anacrontab(5) for details.
    
    SHELL=/bin/sh
    PATH=/sbin:/bin:/usr/sbin:/usr/bin
    MAILTO=root
    # the maximal random delay added to the base delay of the jobs
    RANDOM_DELAY=45
    # the jobs will be started during the following hours only
    START_HOURS_RANGE=3-22
    
    #period in days   delay in minutes   job-identifier   command
    1	5	cron.daily		nice run-parts /etc/cron.daily
    7	25	cron.weekly		nice run-parts /etc/cron.weekly
    @monthly 45	cron.monthly		nice run-parts /etc/cron.monthly
    
  • zeroiozeroio Posts: 13
    Reboot working

    Thanks for the cron help, I've got it working now after loading and starting the cron and editing it with crontab.

    $ crontab -e

    0 4 * * * /sbin/reboot
  • truetrue Posts: 307
    Re: playlists, the first 100 playlists are requested and queued in the main module...it's been a while since I looked but I believe the UI module just queries the ones it needs. You should be able to request all of them and do what you want with them.

    Re: coverart, not quite understanding what you are saying, re: 21 iterations and appending, each iteration taking .3 what on average? Also sometimes I would request coverart, it would say it is available but it wasn't. Which commands are you using for this, and do they work reliably?

    Once I get a TV at home, I will hack on this and try to get second generation / home sharing support as well (although I don't have a second gen aTV).
  • iTunes for MacOS module (not AppleTV)

    Posting in this thread in case anyone, like me, thought that I might *have* to go through an Apple TV to control iTunes...

    In case anyone is interested, I've been working on a NetLinx module to control an iTunes server running on MacOS (not Apple TV). Right now I can browse playlists, start/stop/pause/skip/etc and get now-playing data (although I haven't looked at artwork yet). I'm cleaning it up right now and could provide a demo in a few days. Let me know.

    Cheers,
    Ron
  • iTunes Control using Ruby and Python

    Hi Guys,

    I'm working on the same thing except I am currently controlling iTunes installed on one PC using either Python or Ruby. Full control is already working fine as I will implement it later in one of our client here in KSA for their BGM requirements. Working with Ruby and Python and interfacing them with AMX is more comfortable than writing the whole things in Duet, I think. I have done the same thing with my Nokia C6-01 as I am utilizing it as cheap Touch panel to control any devices within the scope of AMX System.
  • Does this module work with the newest generation 2 Apple TV's?


    Edit: Never mind, I found the answer in the bug site. It doesn't.
  • rrdbstudiosrrdbstudios Posts: 160
    True,

    Any news on the newer models of apple tv?


    Thanks,
    Paul
  • zeroiozeroio Posts: 13
    New AppleTV

    Since the new AppleTV works best with a host iTunes, I am now using the controller to talk to iTunes using an Apache Web Site on that iTunes server which has integration with AppleScript to control iTunes. There are some basic scripts on the web that explain this and it so far does the basics for me. The more advanced scripts can retrieve art too.
  • bump...

    anyone working on something that works over IP?

    maybe one day ill find some time to try and see what the apple remote app is sending...
  • This might be helpful:

    http://nto.github.com/AirPlay.html
  • If you jailbrake the apple tv 1 or 2, and purchase aTV Flash from firecore, they have created a simple API for simple control and feedback via TCP/IP-http transport commands, unless you need control over everything, this is far easier to use then the airplay protocol.

    http://support.firecore.com/entries/21375902-3rd-Party-Control-API-AirControl-beta-

    The Control API

    The HTTP transport can be used by third-party applications which can access the Apple TV (with AirControl installed) using the HTTP protocol. Third-party applications can send commands to the Apple TV by sending HTTP requests as described below.

    URL Format
    http://<Apple-TV-or-IP-Address>/<Action>=<Value>
    



    Available Remote Commands

    <Action> = remoteAction
    •Menu = 1
    •Menu Hold = 2
    •Arrow Up = 3
    •Arrow Down = 4
    •Select = 5
    •Arrow Left = 6
    •Arrow Right = 7
    •Play/Pause = 10
    •Pause = 15
    •Play = 16
    •Stop = 17
    •Fast Forward = 18
    •Rewind = 19
    •Chapter Skip Forward = 20
    •Chapter Skip Backwards = 21
    •List/Select Hold = 22

    Example

    To send a 'Menu' command to the Apple TV you would use the following URL
    http://apple-tv.local/remoteAction=1
    


    Now Playing API

    AirControl also provides a simple API for retrieving information about the video or song that is currently playing on the Apple TV.

    Results URL
    http://apple-tv.local/npx
    
    Results are provided in standard XML format. A few examples are below.

    Movie via iTunes
     <nowplaying>
            <name>Natural Born Killers</name>
    	<copyright>© 1994 Warner Bros. Entertainment Inc. All Rights Reserved.</copyright>
    	<type>movie</type>
    	<studio>Warner Bros.</studio>
    	<genre>Action & Adventure</genre>
    	<released>1994-08-26</released>
    	<credits>
    		<cast>
    			<person job="Producer" name="Jane Hamsher" />
    			<person job="Producer" name="Clayton Townsend" />
    			<person job="Producer" name="Don Murphy" />
    			<person job="Director" name="Oliver Stone" />
    			<person job="Actor" name="Woody Harrelson" />
    			<person job="Actor" name="Juliette Lewis" />
    			<person job="Actor" name="Robert Downey Jr." />
    			<person job="Actor" name="Tommy Lee Jones" />
    			<person job="Actor" name="Tom Sizemore" />
    			<person job="Screenwriter" name="David Veloz" />
    			<person job="Screenwriter" name="Oliver Stone" />
    		</cast>
    	</credits>
    	<coverArtURL>http://a3.mzstatic.com/us/r1000/012/Video/5a/52/06/mzl.wzegqraj.400x400-75.jpg</coverArtURL>
    	<certification>R</certification>
    	<overview>Oscar-nominees Woody Harrelson ("The People Vs. Larry Flynt," "Wag the Dog"), Juliette Lewis ("From Dusk Till Dawn," "Strange Days") and Robert Downey, Jr. ("Wonder Boys," "Bowfinger"), Academy Award-winner Tommy Lee Jones (the "Men in Black" movies, "Space Cowboys") and an all-star cast are featured in director Oliver Stone's ("Any Given Sunday," "Nixon," "JFK") gripping and satirical look at violence, murder and the American media, from a story by Oscar-winner Quentin Tarantino ("Jackie Brown," "Pulp Fiction"), as told through the eyes of two of the most terrifying, relentless, cold-blooded (and popular) mass murderers imaginable. Co-starring Golden Globe-nominee Tom Sizemore ("Black Hawk Down," "Red Planet") and comedian Rodney Dangerfield ("Little Nicky," "Back to School") in a chillingly serious role. Time Magazine calls this film "explosive... delirious, daredevil fun." Newsweek says it's "flabbergasting, funny, enlightening, brilliantly nightmarish.</overview>
    	<runtime>118</runtime>
    </nowplaying> 
    


    Movie via Media Player
    <nowplaying>
            <name>The Ides of March</name>
    	<backDropURL>http://cf2.imgobject.com/t/p/w1280/fWy4ATlV8T3mYKicihloXfBeVAd.jpg</backDropURL>
    	<type>video</type>
    	<genre>Drama, Thriller</genre>
    	<tagline>Ambition seduces. Power corrupts.</tagline>
    	<released>2011-10-07</released>
    	<credits>
    		<cast>
    			<person job="Actor" name="George Clooney" />
    			<person job="Actor" name="Ryan Gosling" />
    			<person job="Actor" name="Evan Rachel Wood" />
    			<person job="Actor" name="Marisa Tomei" />
    			<person job="Actor" name="Paul Giamatti" />
    			<person job="Actor" name="Philip Seymour Hoffman" />
    			<person job="Actor" name="Jeffrey Wright" />
    			<person job="Director" name="George Clooney" />
    			<person job="Producer" name="Grant Heslov" />
    			<person job="Producer" name="Leonardo DiCaprio" />
    		</cast>
    	</credits>
    	<coverArtURL>http://cf2.imgobject.com/t/p/w342/ncAdjHs58NhPWkwZRtqd9nXzBg4.jpg</coverArtURL>
    	<certification>R</certification>
    	<overview>An idealistic staffer for a newbie presidential candidate gets a crash course on dirty politics during his stint on the campaign trail. Based on the play by Beau Willimon.</overview>
    	<runtime>101</runtime>
    </nowplaying> 
    


    Music via Media Player
    <nowplaying>
    	<name>L.E.S.</name>
    	<album>Unknown</album>
    	<artist>Childish Gambino</artist>
    	<overview>Donald McKinley Glover (born September 25, 1983) is an American actor, writer, comedian, musician and rapper. Glover first came to attention for his work in the sketch group Derrick Comedy and is best known for his role as community college student Troy Barnes on the NBC comedy series Community.   Glover was born on Edwards Air Force Base, California, and raised in Stone Mountain, Georgia. He graduated from New York University with a degree in Dramatic Writing in 2006. Glover is known for his work on the NBC show Community alongside Joel McHale and Chevy Chase.</overview>
    	<type>Song</type>
    	<coverArtURL>http://cdn.last.fm/depth/catalogue/noimage/cover_large.gif</coverArtURL>
    </nowplaying>
    



    TV Show via Netflix
    <nowplaying>
    	<name>My Morning Straight Jacket</name>
    	<released>Released 2010</released>
    	<runtime>21 minutes</runtime>
    	<certification>TV-14</certification>
    	<type>Streaming video</type>
    	<coverArtURL>http://cdn-0.nflximg.com/en_us/boxshots/ghd/70143809.jpg</coverArtURL>
    	<overview>When Hayley goes to a My Morning Jacket concert against Stan's wishes, he crashes the show to bring her back home.</overview>
    	<tagline>American Dad!: Season 5</tagline>
    </nowplaying>
    
  • truetrue Posts: 307
    tombadger wrote: »

    Interesting.

    If I ever get my hands on an newstyle ATV (installed probably close to a hundred of these things, still do not own one) and some time I'll see if this is a possibility.

    It looks like this would work way better than any control of the first gen models ever did, specifically having the reverse HTTP communications channel and the XML format for metadata.

    However, this document doesn't show full UI control. It may be possible without home sharing, but I really haven't looked into it at all.
  • joshjosh Posts: 4
    Anyone still have a copy of true's module? It appears not to be hosted on his site anymore.
  • tical1969tical1969 Posts: 4
    Any demo ?
    Posting in this thread in case anyone, like me, thought that I might *have* to go through an Apple TV to control iTunes...

    In case anyone is interested, I've been working on a NetLinx module to control an iTunes server running on MacOS (not Apple TV). Right now I can browse playlists, start/stop/pause/skip/etc and get now-playing data (although I haven't looked at artwork yet). I'm cleaning it up right now and could provide a demo in a few days. Let me know.

    Cheers,
    Ron

    Dear Ron

    Where do you stand so far with your itunes module ?

    Regards

    Alexandre
  • tical1969tical1969 Posts: 4
    icekool wrote: »
    Hi Guys,

    I'm working on the same thing except I am currently controlling iTunes installed on one PC using either Python or Ruby. Full control is already working fine as I will implement it later in one of our client here in KSA for their BGM requirements. Working with Ruby and Python and interfacing them with AMX is more comfortable than writing the whole things in Duet, I think. I have done the same thing with my Nokia C6-01 as I am utilizing it as cheap Touch panel to control any devices within the scope of AMX System.

    Dear Sir

    Where do you stand so far with your itunes module ?

    Regards

    Alexandre
  • any updates on ATV3 control

    Reviving an old thread. Anyone figure anything out yet for ATV3 IP control with feedback?
  • Reviving an old thread. Anyone figure anything out yet for ATV3 IP control with feedback?

    AppleTV 3 uses an encrypted protocol, I don't think you'll ever find any programming for it using AMX, unless Apple changes their friendliness to third parties.
  • troberts wrote: »
    AppleTV 3 uses an encrypted protocol, I don't think you'll ever find any programming for it using AMX, unless Apple changes their friendliness to third parties.

    Didn't autonomic having a working module for a while? Also, I believe RTI has a module.
  • Didn't autonomic having a working module for a while? Also, I believe RTI has a module.

    Yes, but that was on older AppleTVs, which was pre encrypted protocol from Apple. I do think Savant has someway to do this, but since they are Apple (sorta) they are able to use data from their native iTunes or some other quasi way of getting the data.
  • noted. Sure would be nice if they weren't so "closed" about it.
  • Maybe my understanding of how it works is wrong, but I think with the new HomeKit, it would be possible for TPC (or another iDevice app) to control an AppleTV.
  • ColzieColzie Posts: 470
    An Australian developer has actually "cracked the code" for current generation Apple TVs. They have a complete two way driver available to purchase for RTI systems. The company is My Device. Great guys, too.
  • Only RTI though :(
Sign In or Register to comment.