Kodi Community Forum
Release TvTunes alternative for playing soundtracks when browsing - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Skinning (https://forum.kodi.tv/forumdisplay.php?fid=12)
+---- Forum: Skin helper addons (https://forum.kodi.tv/forumdisplay.php?fid=300)
+---- Thread: Release TvTunes alternative for playing soundtracks when browsing (/showthread.php?tid=330832)

Pages: 1 2 3 4 5


TvTunes alternative for playing soundtracks when browsing - manfeed - 2018-04-12

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
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...
xml:
<onload condition="!Window.IsActive(visualisation)">FullScreen</onload>
...to...
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...
xml:
<window>
<onload condition="String.Contains(Player.Filenameandpath,theme.mp3) | !String.IsEmpty(Window(home).Property(PlayingOST))">Dialog.Close(all,true)</onload>
...to prevent DialogBusy.xml from running when playing the theme.mp3 files


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:
xml:
<onload condition="String.IsEmpty(Window(home).Property(PlayingOST))">PlayMedia($ESCINFO[ListItem.Path,,theme.mp3])</onload>
New:
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:
xml:
<visible>!ListItem.IsCollection + !String.Contains(ListItem.Path,thumb:) + !String.Contains(ListItem.Path,image:)</visible>
New:
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:
xml:
<visible>!ListItem.IsCollection + !String.Contains(ListItem.Path,thumb:) + !String.Contains(ListItem.Path,image:) + !String.Contains(ListItem.Path,plugin)</visible>
New:
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>



RE: TvTunes alternative for playing soundtracks when browsing - Karellen - 2018-04-15

Hello @manfeed

I created these two xml files and added them to Transparency! and restarted Kodi. They work great!!

I imagine you have no control over this, but do you have any idea why it will play mp3 themes, but not flac themes?


RE: TvTunes alternative for playing soundtracks when browsing - jurialmunkey - 2018-04-15

(2018-04-15, 11:45)Karellen Wrote: Hello @manfeed

I created these two xml files and added them to Transparency! and restarted Kodi. They work great!!

I imagine you have no control over this, but do you have any idea why it will play mp3 themes, but not flac themes?

You have to change the onload condition if your theme files are flac:
Code:
<onload>PlayMedia($INFO[ListItem.Path,,theme.mp3])</onload>

Change to
Code:
<onload>PlayMedia($INFO[ListItem.Path,,theme.flac])</onload>

Unfortunately, there is no way to check whether a local file exits in the skinning engine, so you are stuck with choosing one particular file type.
I haven't tested, but you might be able to get away with stacking them together. Off the top of my head, I'm not sure if PlayMedia will stop playback even if the file doesn't exist.
e.g. You could try
Code:
<onload>PlayMedia($INFO[ListItem.Path,,theme.mp3])</onload>
<onload>PlayMedia($INFO[ListItem.Path,,theme.flac])</onload>



RE: TvTunes alternative for playing soundtracks when browsing - sualfred - 2018-04-15

@jurialmunkey 

FYI
 
Code:
RunScript(script.skin.helper.service,action=fileexists,file=[filenamepath],skinstring=[skinstring to store the result],windowprop=[windowprop to store the result])
Quote:This command will check the filesystem if a particular file exists and will write the results to either a skin string or window property. If the file exists, the result will be written as EXISTS in the property or skinstring, if it doesn't exist, the property/string will be empty.



RE: TvTunes alternative for playing soundtracks when browsing - manfeed - 2018-04-15

I have updated the first post with an improved new method that allows a smoother browsing and in addition the soundtrack won't stop nor restart in video information and other windows.


RE: TvTunes alternative for playing soundtracks when browsing - tehax - 2018-04-15

Great to see that there is now an alternative to TvTunes. Nevertheless it won't work for me in v18 with Estuary or EstuaryModV2.


RE: TvTunes alternative for playing soundtracks when browsing - manfeed - 2018-04-15

I have checked in v18 and Estuary official and in works faultlessly for me...


RE: TvTunes alternative for playing soundtracks when browsing - tehax - 2018-04-15

Ok, tried again and now it works with Estuary but still not with EstuaryMod2. I will ask Guilouz.


RE: TvTunes alternative for playing soundtracks when browsing - whysoserious - 2018-04-15

Thanks for this! I've missed TvTunes alot.

It seems to work pretty well for me (Kodi 17.6, Aeon Nox 5: SiLVO SKIN, v6.0.13). I wasn't exactly sure where to put the files but I put them here:
Users\WiFi_\AppData\Roaming\Kodi\addons\skin.aeon.nox.silvo\16x9 and it works! Now to find a few dozen new theme files...

Thanks again!


RE: TvTunes alternative for playing soundtracks when browsing - jurialmunkey - 2018-04-15

(2018-04-15, 13:56)sualfred Wrote: @jurialmunkey 

FYI
 
Code:
RunScript(script.skin.helper.service,action=fileexists,file=[filenamepath],skinstring=[skinstring to store the result],windowprop=[windowprop to store the result])

Yeah I know about that, but it kinda defeats the purpose of an addon free method. Plus it's not really feasible to use for checking multiple file extensions.


RE: TvTunes alternative for playing soundtracks when browsing - jurialmunkey - 2018-04-15

(2018-04-15, 17:51)tehax Wrote: Ok, tried again and now it works with Estuary but still not with EstuaryMod2. I will ask Guilouz.

Check that the window id numbers don't conflict with an existing custom window in the mod.


RE: TvTunes alternative for playing soundtracks when browsing - Karellen - 2018-04-16

Thanks @jurialmunkey, the following didn't quite work. Flac files played fine, mp3 files played for about 1 second then stopped. I guess it finds the mp3 file, then immediately moves onto looking for a flac file. Anyway to get an "or" in there?

(2018-04-15, 13:37)jurialmunkey Wrote: <onload>PlayMedia($INFO[ListItem.Path,,theme.mp3])</onload>
<onload>PlayMedia($INFO[ListItem.Path,,theme.flac])</onload>

I haven't tried the updated @manfeed version in post 1 yet, but it looks as if it is still limited to mp3 only.


RE: TvTunes alternative for playing soundtracks when browsing - jurialmunkey - 2018-04-16

@Karellen - I thought that might happen. Unfortunately, that means that you are stuck with choosing only one filename/filetype to play. The updated method has the same limitation.

The only other potential solution I can think of is to use a wildcard, but I highly doubt this will work:
Code:
<onload>PlayMedia($INFO[ListItem.Path,,theme.*])</onload>



RE: TvTunes alternative for playing soundtracks when browsing - Karellen - 2018-04-16

Thanks @jurialmunkey

No problems and thanks for the help. It is a minor matter to convert to a single file type, so I will do that instead.

If the above suggestion works, I will post back confirming it does.

---Edit---
Nope, it did not work. Nothing plays. Thanks anyway Smile


RE: TvTunes alternative for playing soundtracks when browsing - manfeed - 2018-04-16

@Karellen for your special case only I can think of is to add another window, if would be this way (total 4 xml files)...

customStartSoundtrack.xml
xml:

<window type="dialog" id="1355">
    <allowoverlay>no</allowoverlay>
    <onload>Stop</onload>
    <onload>PlayMedia($ESCINFO[ListItem.Path,,theme.mp3])</onload>
    <onload>SetProperty(OST,$INFO[ListItem.Path],home)</onload>
    <visible>System.IdleTime(2) + [!String.IsEqual(ListItem.Path,Window(home).Property(OST)) | !Player.Playing]</visible>
    <visible>!ListItem.IsCollection</visible>
    <visible>Container.Content(movies) | [Container.Content(tvshows) + !Player.Playing] | [Container.Content(seasons) + !Player.Playing]</visible>
    <visible>!Window.IsActive(movieinformation)</visible>
    <controls>
    </controls>
</window>

customStartSoundtrackFlac.xml
xml:

<window type="dialog" id="1356">
    <allowoverlay>no</allowoverlay>
    <onload>Stop</onload>
    <onload>PlayMedia($ESCINFO[ListItem.Path,,theme.flac])</onload>
    <onload>SetProperty(OST,$INFO[ListItem.Path],home)</onload>
    <visible>System.IdleTime(3) + [!String.IsEqual(ListItem.Path,Window(home).Property(OST)) | !Player.Playing]</visible>
    <visible>!ListItem.IsCollection</visible>
    <visible>Container.Content(movies) | [Container.Content(tvshows) + !Player.Playing] | [Container.Content(seasons) + !Player.Playing]</visible>
    <visible>!Window.IsActive(movieinformation)</visible>
    <visible>!String.Contains(Player.Filenameandpath,theme.mp3)</visible>
    <controls>
    </controls>
</window>

customStopSoundtrack.xml
xml:

<window type="dialog" id="1255">
    <allowoverlay>no</allowoverlay>
    <onload>Pause</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>

customRidSoundtrack.xml
xml:

<window type="dialog" id="1305">
    <allowoverlay>no</allowoverlay>
    <onload>Stop</onload>
    <visible>[String.Contains(Player.Filenameandpath,theme.mp3) | String.Contains(Player.Filenameandpath,theme.flac)] + [!Window.IsActive(videos) | String.IsEmpty(ListItem.Path)]</visible>
    <controls>
    </controls>
</window>