NineWorlds / serenity-android

An Android client for the Plex and Emby Media Servers optimized for Television displays.
MIT License
178 stars 65 forks source link

Add Wake On Lan Magic Packet Sender #226

Open jmsuk opened 10 years ago

jmsuk commented 10 years ago

It would be great to include the ability to configure Serenity to send a Magic Packet when it starts up. This would give users a more seamless experience when using Serenity to connect to a Plex Media Servers set up for Wake On Lan (e.g. remove the need to WoL via another app). If active, this WoL packet sender should probably attempt to deliver its payload before Serenity does any server discovery.

The configuration settings should probably include the following: MAC Address of target IP Address of target Port on target "Send as Broadcast" switch (If "on" then an additional field to set "subnet" should appear) "Send Multiple" switch (if "on" then an additional field to set packet count should appear) Interval (in seconds)

Hope this helps :)

kingargyle commented 10 years ago

Android library that can be leveraged for this:

https://github.com/mafrosis/Wake-On-Lan

kingargyle commented 10 years ago

Will try and get this in place for 1.8.0-M3, if not, then 1.8.0-M4

kingargyle commented 10 years ago

Question I have on this. It appears that this needs to either send to a Mac Address or to an IP Address specifically to wake the implementation. I can grab the IP Address during the server discovery process but if the servers are already asleep, they may not be broadcasting so that Serenity can find them. How should this case be handled, or is it something that should be ignored?

The plan would be to send out the message to the particular server when Serenity is started. Not sure how long it takes for a particular server to start.

jmsuk commented 10 years ago

My thoughts are, if people are going to utilize your WoL feature, them going through the effort of putting in the configuration settings above, saves you some hassle in trying to do too much auto discovery. IMHO life is easier when the Plex Server is on a fixed/reserved IP anyway.. :) But.. if you do want some kind of auto discovery incase ppl still have theirs setup with dhcp, how about using the last known discovered address if none is specified in the settings page?

As for how long to wait after sending packets, that's a tricky one.. perhaps delay server connection attempt by a configurable number of seconds (if WoL enabled) and also offer a 'refresh' button or menu item like the one in the official client? (If there isn't one already?)

kingargyle commented 10 years ago

Thanks, I should at least be able to get some basic support, where it just tries the preferred plex servers address when the app starts up.

jmsuk commented 10 years ago

Any support will put Serenity leagues ahead of anything else out there.. it's considered a "small" overlooked feature, but a simple trawl through the internets would reveal that integrating WoL would be a really well received feature (along with "trailer support" that's been promised in Plex for what feels like eons :) )

kingargyle commented 10 years ago

Serenity already has Movie Trailer support, if you have the offical YouTube player installed on the device. I'll see if I can get WoL in this weekend.

jmsuk commented 10 years ago

Ahh yeah, I'd forgotten about that. I think I was thinking more about trailers held locally, that could be queued up in a batch (e.g. with little DTS/Dolby Digital idents etc.), saved as a batch and played automagically before a movie.. Plex has a queue feature but its not quite the same :)

kingargyle commented 10 years ago

You could do something similar with Serenity's built in queue feature. You would need to have a library that has all the local items. Go to to the Trailers you want to play before the movie starts, add them individually to the queue. Go to the movie you want to play, add it to the Queue. Then use the side menu, to Play All from Queue. The trailers should play first, followed by the movie.

goosar19 commented 10 years ago

I like jmsuk's line of thinking. I have to agree with him that for anyone even half serious about setting up a reliable Plex server should have their computer set to a static IP (or a DDNS configuration in place) so using the WoL option would alleviate the need for me to keep my computer on 24/7. I will eventually be trying to move the PMS over to a NAS running nas4free that will be on 24/7, however in the meantime this is a great idea to incorporate.