Kodi Community Forum
[Release] SendTo - Printable Version

Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Program Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=151)
---- Thread: [Release] SendTo (/showthread.php?tid=147178)

Pages: 1 2 3


[Release] SendTo - robweber - 2012-12-04

I've been working on this addon for my own household but thought others may like it too. Read through the details to see exactly what it is meant to do - or just jump straight into the downloads. I didn't package anything but from the Github repo you can download the zip:

https://github.com/robweber/script.sendto

Only tested to work with XBMC 12 - Frodo.

Why?

Many households now have XBMC running on multiple devices in the home. Pieces like MySQL functionality and path substitution are good ways to make sure your music and video files are available and synchronized by any XBMC host available. A function that was always missing for me though was a real awareness of what was happening between each host instance. Consider the following scenerios:

Scenerio 1
You're in room A of the house listening to music on XBMC. You decide that you'd like to continue listening while eating a meal in room B. Even with MySQL setup within your home you'd have to stop the music, go to the next XBMC host, find the song, and resume. If the file you are playing is actually part of a larger playlist you'd have to save the playlist or recreate it on the other XBMC machine, making the process even more complicated.

Scenerio 2
You're watching a TV show on your main HTPC. Your children or significant other ask that they use the larger TV. Luckily you have a iPad running XBMC; however you'll still have to stop what you're doing, find the TV show on your iPad and then continue watching.

The SendTo addon seeks to make these processes easier by providing some automation between hosts.

How Does It Work:

"Pull" from Remote XBMC Hosts:

In the Programs area of XBMC you can launch the SendTo addon and define each of your hosts. I really wanted to use only native XBMC windows so adding hosts will bring up multiple prompts to collect information. Once a host is added you can click on it to see what is currently playing and perform the following actions:
  • Transfer now playing - essentially this is a "pull" of the current playlist from a remote host to the current one. This will stop all media playing on the remote host and play the file where it left off on the new device.
  • Start playing this file - Starts playing the selected file from the beginning (I use this frequently to start watching a TV show someone may have started watching elsewhere in the house already)
  • Copy playlist, starting here - Copies the entire playlist from the remote machine but starts playback on the file you've specified
  • Stop playback - stops playing media on the remote host
  • Send Notification - type a message to send to the remote host

Sending to Remote XBMC Hosts:

With proper skin support (important!) you can launch the SendTo addon while watching a video or playing music on XBMC. The addon will ask you which XBMC host you wish to send your video or music playlist to, and then run the necessary commands via the JSONRPC interface to recreate the playlist and continue the file exactly where you left off on the first XBMC instance. The "Send" and "Transfer" commands are essentially mirrors of each other except one pushes media to a remote host and the other pulls media from one.

How Can I Use It:

Once the addon is installed and the hosts added a few other pieces must exist in order to send files between the hosts.

a) Enable Web Services (JSONRPC) under the Services section of XBMC on all hosts
b) Make sure each XBMC host has the same sources defined so they can play the sent files
c) Proper skin support. The addon can easily be added to the Music and Video menus by adding an option to call XBMC.RunScript(script.sendto,mode=1000). An alternative to this would be to map the RunScript command to a button on your remote.

Disclaimer:

This is not airplay-like functionality! This addon is not streaming via upnp or any other protocol from Host A to Host B. We are stopping file playback, and then resuming it on another device so both must have access to the original source. MySQL and path subsititution are not necessary; however access to the sources on both machines is. MySQL is just a nice bonus if you want the watched flags and other info to line up when continuing playback from device to device.


RE: [Release] SendTo - Robotica - 2012-12-04

Nice!


RE: [Release] SendTo - DigitalAnvil - 2012-12-05

Let's say I'm watching something in the basement and then decide that I want to go upstairs to continue watching it (using "•Transfer now playing"). Would that automatically stop what is playing on my HTPC upstairs?

This addon sound amazing (since I have an HTPC box setup with all 5 TVs in the home as well as on 2 desktops and a laptop as well... im unfortunately still on Frodo Alpha 5 and haven't had a chance to upgrade (as I would have to upgrade them all the same day to avoid problems))


Re: RE: [Release] SendTo - robweber - 2012-12-05

(2012-12-05, 01:14)DigitalAnvil Wrote: Let's say I'm watching something in the basement and then decide that I want to go upstairs to continue watching it (using "•Transfer now playing"). Would that automatically stop what is playing on my HTPC upstairs?

This addon sound amazing (since I have an HTPC box setup with all 5 TVs in the home as well as on 2 desktops and a laptop as well... im unfortunately still on Frodo Alpha 5 and haven't had a chance to upgrade (as I would have to upgrade them all the same day to avoid problems))

Alpha 5 might work. It uses the jsonrpc methods and i know eden will fail for sure but alpha 5 is most likely fine.

Regarding your question: using the transfer function would be done on your second (upstairs) host and would stop the basement and move playback upstairs. The other options (play file or copy playlist) keep the original playing and start it on the new instance.

Without skin support everything is a pull operation. If you can map the correct command to your remote its possible to use the send features. Check the settings too as there are options for if the destination is already in use or if youd like to pause the destination until you walk upstairs to watch it.


Re: [Release] SendTo - bnevets27 - 2012-12-05

Wow! I was just thinking about when my multi room setup is complete with mysql how much of a pain it is to pick up where I left off in one room when moving to another room. Sure the show/movie can resume from the same stop point using mysql but having to navigate to that same episode on the room your moving to is very time consuming. I'm really looking forward to trying this out. Thank you!


RE: [Release] SendTo - bnevets27 - 2013-03-05

Finally had a chance to try this out the other day.

Here are my devices:
Windows 7 running Frodo x2
Zotac Zbox HD-ID11 running OpenELEC Frodo RC4
Pivos XIOS running their custom linux build: "XBMC-Linux-M1 Beta 012913"

It works between my windows boxes and the zbox. But I can't even add a host on the Pivos. I tried to move over the host.xml that was created on my zbox to the Pivos but it gets overwritten soon as I launch SendTo. I have a debug log here

Haven't had it installed long and my primary use would be between the the zbox and the pivos but I'm very glad you made this addon! Thank you! Big Grin I also haven't added the push function to the remote or skin yet. I'm surprised there isn't more response here but that might be because everyone who is using it is happy with it.


RE: [Release] SendTo - Doctor3D - 2013-03-05

Very creative! Big Grin


RE: [Release] SendTo - robweber - 2013-03-05

(2013-03-05, 06:26)bnevets27 Wrote: Finally had a chance to try this out the other day.

Here are my devices:
Windows 7 running Frodo x2
Zotac Zbox HD-ID11 running OpenELEC Frodo RC4
Pivos XIOS running their custom linux build: "XBMC-Linux-M1 Beta 012913"

It works between my windows boxes and the zbox. But I can't even add a host on the Pivos. I tried to move over the host.xml that was created on my zbox to the Pivos but it gets overwritten soon as I launch SendTo. I have a debug log here

Haven't had it installed long and my primary use would be between the the zbox and the pivos but I'm very glad you made this addon! Thank you! Big Grin I also haven't added the push function to the remote or skin yet. I'm surprised there isn't more response here but that might be because everyone who is using it is happy with it.

Thanks for the comments! This addon has been working great for me in my home using a Win 7 machine, Rpi, and Android tablet.

I took a look at your debug log and it looks like you were having an error on a python call gethostbyname(). The error looks like there may have been some DNS issue or something trying to resolve a host name to an IP address. It isn't really important for the functioning of the addon, but it was preventing you from adding a host, or loading existing ones. The call is just to get the local address and determine if your host is the local host or a remote one. I added a try/except block around this segment of code so that it will fail gracefully and allow you to use the addon. I would recommend using IP addresses instead of hostnames though, just in case the same name resolution issue prevents you from sending the JSON commands.

Download the new version from github and let me know if it is working for you now.


RE: [Release] SendTo - bnevets27 - 2013-03-06

I actually took a look at the debug log to try and see if I could figure it out for myself and I saw the gethostbyname() error. I figured if could at least get a host file in there I could see if it would work. Funny thing though is I was using an IP address, and each box has an unique host name. I was adding the same exact hosts config that worked in all of my other XBMC installs.

Anyhow, thanks for the incredibly quick response and I'll give it go tonight and update this post. (forgot to hit post when I was at work)


I am now able to add a hosts on the XIOS! Big Grin But now I'm having trouble getting SentTo to work at all between hosts.

Here's the error I'm getting, I tried between different hosts and all 3 have the same error.
Code:
21:52:18 T:5396   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.KeyError'>
                                            Error Contents: ('items',)
                                            Traceback (most recent call last):
                                              File "F:\Software\Currently Using\XBMC\portable_data\addons\script.sendto-master\default.py", line 177, in <module>
                                                SendGui(params).run()
                                              File "F:\Software\Currently Using\XBMC\portable_data\addons\script.sendto-master\default.py", line 23, in run
                                                self.hostInfo()
                                              File "F:\Software\Currently Using\XBMC\portable_data\addons\script.sendto-master\default.py", line 68, in hostInfo
                                                playingItems = selectedHost.getPlaylist()
                                              File "F:\Software\Currently Using\XBMC\portable_data\addons\script.sendto-master\resources\lib\hostmanager.py", line 46, in getPlaylist
                                                result = items['items']
                                            KeyError: ('items',)
                                            -->End of Python script error report<--
21:52:19 T:4640   ERROR: XFILE::CDirectory::GetDirectory - Error getting plugin://script.sendto/?host=0&mode=1001
21:52:19 T:4640   ERROR: CGUIMediaWindow::GetDirectory(plugin://script.sendto/?host=0&mode=1001) failed

I have the full debug log for all 3 boxes if you need that also. I can select each host if they are at idle but if they are currently playing a file then the scrip crashes. This of course is when I'm using SendTo under programs to request a pull. Windows box and Zbox running 0.0.5, XIOS running 0.0.6.


RE: [Release] SendTo - robweber - 2013-03-06

Interesting, thanks for the log. Could you also tell me the XBMC version of each of your installs (can be found under System - System Info). I'll see if I can recreate this, looks like a JSON error to me, something in the result was not returned as expected. Would you mind running the script again with xbmc debug logging enabled and upload that to pastebin or xbmclogs? I only need one host, as long as the one you are trying to access is playing media. I see I have some logging entries in the script that might help.

Regarding the hostname lookup. Glad that fix worked for you. The call to gethostbyname is actually done on the local host to get it's own name, so it's weird that that would fail but apparently it did.


RE: [Release] SendTo - bnevets27 - 2013-03-06

I can give you more specific build/versions when it get home but here are the "download" names:

Windows 7 x64 is running Frodo 12 Final
Zotac Zbox HD-ID11 running OpenELEC 3.0 RC4 (Frodo 12)
Pivos XIOS running their custom linux build: "XBMC-Linux-M1 Beta 012913" Which is Frodo 12 also

Re hostname: Ah that makes more sense as to why it was crashing on the XIOS only.

EDIT:
Zbox = XBMC 12.0 Git:a1a93b5 (compiled: Mar 1 2013)
Win 7 = XBMC 12.0 Git:2013127-fb595f2 (compiled Jan 28 2013)
XIOS = XBMC 12.0 Git:20130129-b0e7853 (Compiled Jan 29 2013)


RE: [Release] SendTo - robweber - 2013-03-09

For some reason I didn't see you message until today - sorry. I'll review what you've given me so far and see if I can recreate this issue. This addon was developed for xbmc 12.0, so it should work. Your builds all look new enough. I'll post back here with any findings.


RE: [Release] SendTo - bnevets27 - 2013-03-09

If you need me to do any tests and give you a full debug log just let me know.


RE: [Release] SendTo - ConfusedTA - 2013-04-12

Awesome little plugin - and essentially what I've been looking for! Smile

One issue I've found with it though, is that it requires that the XBMC instances don't have a username/password set on the HTTP interface - whereas mine do.


I've tweaked with it a bit, and I've added in the ability to specify remote host usernames/passwords during the host setup, as well as adding some settings for the local username, password and port (unless there's a nice way to retrieve those from the main XBMC settings that I've not found yet - this is my first attempt at playing with any XBMC add-ons and Python!)

I've tested this across my few machines at home, and it works a treat now.

If anyone wishes to make use of my changes, or if you want to look at them/merge them into the master, robweber, I've put my updated zip file here


Garry


RE: [Release] SendTo - robweber - 2013-04-14

(2013-04-12, 23:37)ConfusedTA Wrote: Awesome little plugin - and essentially what I've been looking for! Smile

One issue I've found with it though, is that it requires that the XBMC instances don't have a username/password set on the HTTP interface - whereas mine do.


I've tweaked with it a bit, and I've added in the ability to specify remote host usernames/passwords during the host setup, as well as adding some settings for the local username, password and port (unless there's a nice way to retrieve those from the main XBMC settings that I've not found yet - this is my first attempt at playing with any XBMC add-ons and Python!)

I've tested this across my few machines at home, and it works a treat now.

If anyone wishes to make use of my changes, or if you want to look at them/merge them into the master, robweber, I've put my updated zip file here


Garry

Thanks for adding this. I don't password my local xbmc hosts (only available on local network) so I never had any incentive to add this in. I'll look over your changes and merge them into the git branch for anyone watching that.


This forum uses Lukasz Tkacz MyBB addons.