2018-04-12, 21:41
Hi, I have been long waiting for some alternative to play soundtracks when browsing movies and tvshows without TvTunes addon. I already had a theme.mp3 file in every movie/tvshow folder, so it was just a matter of playing them while browsing. I have devised a way without even using any addon, it consists on adding three little xml.files to your xml's skin folder, for instance:
customStartSoundtrack.xml
...and...
customStopSoundtrack.xml
...and...
customRidSoundtrack.xml
It should work in every skin and can be tested without much hassle...
If you happen to have in your skin an option to go fullscreen when music starts to play you should find and edit that xml, it could be named something like CustomMusicFullscreen.xml or something like that, then you have to change line from...
Edit 1: (updated 24/05/18) From 30/03 nightlies onwards (https://github.com/xbmc/xbmc/pull/13699) you could get unwanted effects in screen; it's related to the file DialogBusy.xml and to solve the issue it's necessary to add an onload with a condition at the beginning of DialogBusy.xml, just after the <window> line...
Edit 2: Change in third line of customStartSoundtrack.xml to prevent a bug that freezes Kodi when using an addon to select online artworks:
Old:
Edit 3: Change in customStartSoundtrack.xml to prevent error messages when browsing online video streams:
Old:
Edit 4: See edit 1
Edit 5: Change in customStartSoundtrack.xml to prevent errors when option 'Show parent folder items' is selected:
Old:
customStartSoundtrack.xml
xml:
<window type="dialog" id="1355">
<onload>Stop</onload>
<onload condition="String.IsEmpty(Window(home).Property(PlayingOST)) + !String.Contains(ListItem.Path,http)">PlayMedia($ESCINFO[ListItem.Path,,theme.mp3])</onload>
<onload>SetProperty(OST,$INFO[ListItem.Path],home)</onload>
<onload>SetProperty(PlayingOST,True,home)</onload>
<visible>System.IdleTime(2) + [!String.IsEqual(ListItem.Path,Window(home).Property(OST)) | !Player.Playing]</visible>
<visible>!ListItem.IsCollection + !String.Contains(ListItem.Path,thumb:) + !String.Contains(ListItem.Path,image:) + !String.Contains(ListItem.Path,plugin) + !String.Contains(ListItem.Path,videodb:)</visible>
<visible>Container.Content(movies) | [Container.Content(tvshows) + !Player.Playing] | [Container.Content(seasons) + !Player.Playing]</visible>
<visible>!Window.IsActive(movieinformation)</visible>
<visible>Window.IsActive(videos)</visible>
<controls>
</controls>
</window>
...and...
customStopSoundtrack.xml
xml:
<window type="dialog" id="1255">
<onload condition="Player.Playing">Pause</onload>
<onload>ClearProperty(PlayingOST,Home)</onload>
<visible>!String.IsEqual(ListItem.Path,Window(home).Property(OST))</visible>
<visible>Container.Content(movies) | Container.Content(tvshows)</visible>
<visible>!Window.IsActive(movieinformation)</visible>
<controls></controls>
</window>
...and...
customRidSoundtrack.xml
xml:
<window type="dialog" id="1305">
<onload>Stop</onload>
<onload>ClearProperty(PlayingOST,Home)</onload>
<visible>String.Contains(Player.Filenameandpath,theme.mp3) + [!Window.IsActive(videos) | String.IsEmpty(ListItem.Path) | ListItem.IsCollection]</visible>
<controls>
</controls>
</window>
It should work in every skin and can be tested without much hassle...
If you happen to have in your skin an option to go fullscreen when music starts to play you should find and edit that xml, it could be named something like CustomMusicFullscreen.xml or something like that, then you have to change line from...
...to...xml:<onload condition="!Window.IsActive(visualisation)">FullScreen</onload>
xml:<onload condition="!Window.IsActive(visualisation) + !Window.IsActive(videos)">FullScreen</onload>
Edit 1: (updated 24/05/18) From 30/03 nightlies onwards (https://github.com/xbmc/xbmc/pull/13699) you could get unwanted effects in screen; it's related to the file DialogBusy.xml and to solve the issue it's necessary to add an onload with a condition at the beginning of DialogBusy.xml, just after the <window> line...
...to prevent DialogBusy.xml from running when playing the theme.mp3 filesxml:<window>
<onload condition="String.Contains(Player.Filenameandpath,theme.mp3) | !String.IsEmpty(Window(home).Property(PlayingOST))">Dialog.Close(all,true)</onload>
Edit 2: Change in third line of customStartSoundtrack.xml to prevent a bug that freezes Kodi when using an addon to select online artworks:
Old:
New:xml:<onload condition="String.IsEmpty(Window(home).Property(PlayingOST))">PlayMedia($ESCINFO[ListItem.Path,,theme.mp3])</onload>
xml:<onload condition="String.IsEmpty(Window(home).Property(PlayingOST)) + !String.Contains(ListItem.Path,http)">PlayMedia($ESCINFO[ListItem.Path,,theme.mp3])</onload>
Edit 3: Change in customStartSoundtrack.xml to prevent error messages when browsing online video streams:
Old:
New:xml:<visible>!ListItem.IsCollection + !String.Contains(ListItem.Path,thumb:) + !String.Contains(ListItem.Path,image:)</visible>
xml:<visible>!ListItem.IsCollection + !String.Contains(ListItem.Path,thumb:) + !String.Contains(ListItem.Path,image:) + !String.Contains(ListItem.Path,plugin)</visible>
Edit 4: See edit 1
Edit 5: Change in customStartSoundtrack.xml to prevent errors when option 'Show parent folder items' is selected:
Old:
New:xml:<visible>!ListItem.IsCollection + !String.Contains(ListItem.Path,thumb:) + !String.Contains(ListItem.Path,image:) + !String.Contains(ListItem.Path,plugin)</visible>
xml:<visible>!ListItem.IsCollection + !String.Contains(ListItem.Path,thumb:) + !String.Contains(ListItem.Path,image:) + !String.Contains(ListItem.Path,plugin) + !String.Contains(ListItem.Path,videodb:)</visible>