XMBC add code
#1
Hello all,

new here Blush

I kindly request information about writing code and adding it to XBMC.

This is something i want to do:

I have music files on an ftp server. On XMBC startup, i would like the XBMC system to download the files from my ftp server, add them to a playlist and start playing them

How can i go about achieving this? Links to projects and such will be helpful.

Thanks!
Reply
#2
sounds like a simple python script (a service). many many examples out there. also you do know you can add ftps directly in xbmc right?
Reply
#3
thank you.

No, i did not know. The thing is, it file list will change.

So today i download files 1,2,3. and tomorrow i download files 4,5,6 and possibly delete files 1,2,3. So i was hoping to have code that works dynamically.

I have been researching while waiting for a response, and i have come across python script as a solution. How do i add this to the xbmc?

is there a guide/example you can link me to that adds in a simple script for proof of concept?

Also please advise on adding ftps directly in xbmc?

maybe a solution will be for me to set up the ftp to only have files i want to use at that time, and change the files on it for the next day etc - and have xbmc download from the ftp server when needed. But then again, i would like the ability to delete older files
Reply
#4
ok i got a windows version of xbmc and figured out how to add an ftp server to it.

the files are streamed from the ftp server which is something i don't - i like the files to be download instead.

Just need advice on how to add a script to xbmc
Reply
#5
there's no guides really, there's only code. grab some service, read it, monkey it.

http://mirrors.xbmc.org/addons/gotham/
Reply
#6
further help for writing an XBMC addon can be found in our wiki: http://wiki.xbmc.org/index.php?title=Add-on_development
Reply
#7
You could just simply add the ftp location as a source, set XBMC to update the library at startup and use a dynamic smart playlist (wiki).
No need to create your own add-on to achieve this.
Reply
#8
Sorry for not replying - i've been busy

i have just completed a test script. it works on my pc.

the way i wanted it done was like this.

1 - have ftp server with all the files.
2 - have webservice that returns a ftpurl list of files i want to be downloaded and played.
3 - have a python script that does the following:
- on startup, check if the file directory on the rpi exists(where new list of songs will be saved to). if directory doesn't exist, then create it.
- if directory exists, check if files are in it and delete files on startup.
- contact webservice and retrieve a ftpurl list of files i want downloaded
- download the files to the directory
- automatically play the files once download is completed

now my next step:
setting up xbmc so that this script loads on startup
Reply
#9
Ironic_Monkey, I took apart an existing service from the link you provided. Thank you for your help Smile

I added it to the pc version of xbmc, and it got the files correctly but its adding it to my c drive at the moment. does anyone know the disk location i can use for the rpi?

for example i currently have a string directoryPath = "c:\test"
what will be the the equivalent on the rpi?

Next step:
Getting the files to play automatically after it they are downloaded. Any ideas?
Reply
#10
Next step answer: use XBMC.PlayMedia (see http://wiki.xbmc.org/index.php?title=Lis..._functions) to play your folder.
Reply
#11
i will look into it now - thank you.

I was trying some stuff, and have been importing xbmc, and then proceeding to use xbmc.Player().play("c:\\test\\iron.mp3") with no results
Reply
#12
Ah, i got it working - thank you all

Next step: Install xbmc on a raspberry pi!! Tongue
Reply
#13
the script worked, but not as desired.
I used the wrong script by mistake, but i don't think it was the issue

This is what happened:
the directory i have set in my script is "c:\\test"

the python script created a directory in the home/pi directory called "c:\\test" - this is the exact folder name lol

then in my script i use this directory and append the file name onto it, in the hope that it saves the file in that directory, but it saves the file in the home/pi directory with this exact name "c:\test\Mr_brightside.mp3"
it does not save into the folder, but adds the folder name to the filename as you can see

Why does it do that? any way around this?
Reply
#14
use special://temp/ on both platforms for saving it to a temp directory which is platform agnostic. Pathes on linux (rbpi) are completely different then the windows crap with c: blahblah...
AppleTV4/iPhone/iPod/iPad: HowTo find debug logs and everything else which the devs like so much: click here
HowTo setup NFS for Kodi: NFS (wiki)
HowTo configure avahi (zeroconf): Avahi_Zeroconf (wiki)
READ THE IOS FAQ!: iOS FAQ (wiki)
Reply
#15
ah thank you. i shall try this right now Smile
Reply

Logout Mark Read Team Forum Stats Members Help
XMBC add code0