TheBaconNation.com Home Automation

Time:


Tasker Home Automation- Media Server Customizations, Part 1

The idea behind how our media server was integrated into our home automation system was simple: we shouldn't need to interact with it. To accomplish that goal we worked to fully automated it. While home, content will automatically start. It will continue to find and launch content until sleep. I'll touch on how the launching of media is handled, and how the system knows when a program has finished in a later article. This article will focus on the different scenes created that allow us to interact with the media server independent of the automation.

About the Custom Scenes:

While the system is running, it will first try and launch content from the queue. When the queue has been exhausted, the system will automatically find content. It will continue to do so until I add something to the queue. The idea here is that you can add whatever you want, but you don't have to for the system to continue running.




The queue is a text file. When an item is added to the queue, it is added to the text file. When an item is removed from the queue, it is removed from the text file. The scene reads this text file and uses it to generate an array, which is then used to populate the list shown in the scene.

The top button allows you to add an item to the queue. There are two option here. A standard tap of the button will yield a voice prompt asking you what you want added to the queue. If you do not feel like speaking to your device, you can long tap the button, and a text entry box will be displayed allowing you to manually type what you want added.

The delete button removes the current selected item from the queue. Similarly, the play button plays the current selected item. If no item is selected, neither option is allowed.

The Episode List button will open a new scene. This scene lists the possible TV Series that the the server can launch content from. You are presented with the show name as well as the number of the next episode that will be shown.




The episode list is generated in much the same fashion as the queue. There is a text file each series name, as well as a unique show counter variable get added to any time a new show is added to the playback routine. This text file is read into an array, which is used to populate the list in the scene.

There are a few different options from the episode list. Besides being able to scroll through the list, specific items can be selected. A selected item can be added to the queue, played now, or you can view the details. The viewing the details will allow you to see the name of the corresponding episode. You can also add to the queue or play now from the episode details scene.




The data displayed in the Episode Details scene is gathered based on what item was selected in the episode list. The counter variable, the contents of which are displayed as the corresponding episode number in the previous scene, is used here to pull the episode name for the corresponding episode list.

Regarding the Current Playing Data:

The "now playing," "playing in," and "current progress" data are all relayed from the media server. When a new program is launched the title is relayed back to the phone via the AutoRemote EventGhost plugin. The "Playing in" data is automatically updated based on what Chormecast is currently in use. The "Current Progress" data is related from the media server. The same process used to monitor for paused or stopped playback also monitors the playback location and periodically reports it to the mobile devices in simlar fashion to how the title is relayed. The plex logs are scrapped for this data. We will cover how to do that in a future post.