Kodi Community Forum

Full Version: Background Music in Kodi
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I recently built a HTPC and installed Kodi. Kodi is a great application which suits my needs as a media center. I need to play background music while I start Kodi and until I select a movie title the music should continue playing. After the movie selection, the music should stop and movie should play. After watching the movie the music should play again while browsing. All this should be done in the background. I am new to Kodi and I don't know how the scripts or plugins work. Can anyone tell me the method to do this. Thanks in advance.
Hi ronie,

Thanks for your reply. Previously I saw a thread where they were using Callbacks addon for this function. Can you explain on how to do this. I am new to writing scripts and programming. I am specifying the path below. I also asked in that thread itself but I got no reply. Can you help me with this. I really needed this feature. Thank you so much.

https://forum.kodi.tv/showthread.php?tid=171177
the callbacks addon is in our repo, so just install it and check if it suits your need.

there's a support thread for the addon here:
https://forum.kodi.tv/showthread.php?tid=256170

and a manual there:
http://kodi.wiki/view/Add-on:Kodi_Callbacks
Hi,

Thanks for the manual. I will check this and revert back. Thanks once again.
Hi ronie,

I installed the callbacks addon and from kodi interface I found that I can run a script or python file at startup. The point is, I don't know how to write a script for playing background music. Do you have any script that you know that can make the job done.

Thanks in advance.
perhaps you don't need to write a python script?

the callback addon allows you to execute built-in commands, so you could try a task like this:
Code:
PlayMedia(/path/to/your/playlist)

then create two events to run this task: onStartup / onPlayBackEnded
Thank you so much for the information. I thought it would be a huge process. This really helped me a lot.



Thank you once again.
Hi Ronnie,

If I wanted to play a playlist of songs randomly, what should I do ?
Hi Ragu24 and others that come here for the same thinq hahaha

Install the add-on callback (thank you guys, its awesome)

Create a notepad file with this:

import xbmc
xbmc.executebuiltin("PlayerControl(RandomOn)")
xbmc.executebuiltin("PlayMedia(
Code:
/path/to/your/playlist
)")

Save with the name backgroundmusic.py

Go to the add on settings, create a new python task and use the python file backgroundmusic.py, after this go to events and select the task with the events you wish.

Its all, enjoy.

Thank you