Hi, i start to learn a few basics, and want to share.
With that script and some xml editing every skin should be able to play locally stored TVShow Trailers .....
(could be used also on Movies , but you should check with condition - "String.IsEmpty(ListItem.Trailer)" as long as PlayMedia($INFO[ListItem.Trailer] works fine )
.... as long as they are saved in/as .mp4
[*path*/(tvshow/movietitle=FOLDERNAME)/FOLDERNAME-trailer.mp4]
Create this python scrip and put it into your "skin/scripts" folder
checkexist.py
Now you can call it with
Benefit:
If file found it'll write a window property to true, wich can be used for visible conditions.
So you can prefer local trailers and use a youtube search as fallback if you like (skinhelper/or other custom script needed)
Con: - Limited to mp4 files only (as i have no idea how to script it with diff filetypes/suffixes)
- im unsure how it works on mac OS, or using emby
- untested on widgets
EXAMPLE for simple use without depending skinsettings
place script
/%yourskin ID%/scripts/checkexist.py
created include
call the include on focused items in library
use playtrailer command (without actions or conditions)
With that script and some xml editing every skin should be able to play locally stored TVShow Trailers .....
(could be used also on Movies , but you should check with condition - "String.IsEmpty(ListItem.Trailer)" as long as PlayMedia($INFO[ListItem.Trailer] works fine )
.... as long as they are saved in/as .mp4
[*path*/(tvshow/movietitle=FOLDERNAME)/FOLDERNAME-trailer.mp4]
Quote:example for Shows > \*whatever*\Bates Motel\Bates Motel-trailer.mp4
\*whatever*\House of Cards (US)\House of Cards (US)-trailer.mp4
example for Movies > \*whatever*\12 Years a Slave (2013)\12 Years a Slave (2013)-trailer.mp4
\*whatever*\16 Uhr 50 ab Paddington (1961)\16 Uhr 50 ab Paddington (1961)-trailer.mp4
Create this python scrip and put it into your "skin/scripts" folder
checkexist.py
## -*- coding: utf-8 -*-
import xbmc
import xbmcvfs
import xbmcgui
trailerfilenamemp4 = xbmc.getInfoLabel( "listitem.path" ) + xbmc.getInfoLabel( "listitem.FolderName" ) + "-trailer" + ".mp4"
if xbmcvfs.exists(trailerfilenamemp4):
xbmc.executebuiltin( "SetProperty(trailer_avail,true,home)" )
else:
pass
Now you can call it with
xbmc.RunScript(special://skin/scripts/checkexist.py)
Benefit:
If file found it'll write a window property to true, wich can be used for visible conditions.
So you can prefer local trailers and use a youtube search as fallback if you like (skinhelper/or other custom script needed)
Con: - Limited to mp4 files only (as i have no idea how to script it with diff filetypes/suffixes)
- im unsure how it works on mac OS, or using emby
- untested on widgets
EXAMPLE for simple use without depending skinsettings
place script
/%yourskin ID%/scripts/checkexist.py
created include
<include name="check_local_trailer">
<control type="button">
<visible>false</visible>
<onfocus>xbmc.RunScript(special://skin/scripts/checkexist.py)</onfocus> <!-- faster,than skinhelper check -->
<onunfocus condition="!String.IsEmpty(Window(home).Property(trailer_avail))">ClearProperty(trailer_avail,home)</onunfocus>
</control>
</include>
call the include on focused items in library
<focusedlayout width="**" height="**">
<control type="group">
.
.
<include>check_local_trailer</include>
.
.
</control>
</focusedlayout>
use playtrailer command (without actions or conditions)
PlayMedia($INFO[listitem.path]$INFO[ListItem.FolderName,,-trailer.mp4],1) <!-- windowed , if you prefer default fullscreen delete ",1" -->