Can I create a playlist with a script? - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26) +--- Thread: Can I create a playlist with a script? (/showthread.php?tid=166822) |
Can I create a playlist with a script? - greensha - 2013-06-10 I am writing a script that will play a couple of random trailers before playing a movie. I had planned to pick a couple of trailers from a dynamically generated list and then add them to a playlist and then add the selected movie to the end of the playlist. I am unable to figure out how to make a playlist with a script, or if this is even possible. Alternatively, I can make a list of trailers (using a python data structure) and just play them from that list. Unfortunately, when I do that I can't figure out how to wait on one trailer to finish before the other one starts. The result is that the last trailer in the list is the one that gets played. Also, with this method, I don't think I can easily skip to the next trailer. Here is my code to illustrate what I am trying to do... Code: MOVIE_PATH = 'D:/Movies/' Thanks, Andy RE: Can I create a playlist with a script? - Bstrdsmkr - 2013-06-10 http://mirrors.xbmc.org/docs/python-docs/xbmc.html#PlayList Use the example provided in the docs, but you can call .add() multiple times. Then pass the playlist object to Player.play() RE: Can I create a playlist with a script? - greensha - 2013-06-10 (2013-06-10, 15:40)Bstrdsmkr Wrote: http://mirrors.xbmc.org/docs/python-docs/xbmc.html#PlayList Thanks for the reply. After some more searching I found a code snippet that helped. Here is my working code for playing all my trailers in order. Code: MOVIE_PATH = 'D:/Movies/' It should be fairly trivial now to play a couple of random trailers before a movie. Thanks again! |