Kodi Community Forum

Full Version: Local trailers / file locations.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hey there! I just replied about the same topic in a different thread:
https://forum.kodi.tv/showthread.php?tid...pid2696258

I would very much welcome this feature (=better trailer GUI, choice between multiple local trailers and online trailer instead of directly play first local if one exists, otherwise directly play online)
and with a bit of help of some developer who knows Kodi's insides would be willing to help code it.
Very old thread, bit same question about trailer files Smile

I have some trailers named
"movie-trailer.mp4"

KODI find them in the right movie folder and plays them without any problems.

additional i have some trailers named eg.
Name part-01_AC3-trailer.mk4
which KODI does not recognise as a trailer Sad

I alread tried this in my advancedsettings.xml
(like described here)
Code:
<trailermatching>
<regexp>(.*?)(-trailer)(\.[^.]+)$</regexp>
</trailermatching>
As you can test here, this regexp will match ALL files with a "-trailer" before the extension.

but this seem not to work Sad
I tested with first trailer (movie-trailer.ext) and scan for new content. This works fine...
but when I put the second file (nameBlaBla AC3-xyz-trailer.ext) in the folder, KODI did not see the trailer.

Any help there?
Do I have to put the <trailermatching> into the <videolibrary> or somewhere else?
(already tried both).

Smile

Thank you
Kodi is tripping up on the operator "-" you have two in Name part-01_AC3-trailer.mk4 Trailers (wiki)
Hello and thank you for your help.

But I don't think so. I have many different trailer files and they all have different names. Even those without "-" won't play for me  Sad
Only if the trailers are located in the correspondending movie folder and called "movie-trailer.ext", KODI does it play without problems.

If the trailer-file has another name:
no matter what regex I use and no matter what the trailer file is called (with "-" or without), KODI shows that there is no trailer or wants to download the YouTube addon.

I also tried the regex without the "-", so every file with word trailer bevor the .ext should match
Code:
<trailermatching>
     <regexp>(.*?)(trailer)(\.[^.]+)$</regexp>
</trailermatching>

even
Code:
<trailermatching>
    <regexp>/trailer/</regexp>
</trailermatching>

or

<trailermatching>
    <regexp>trailer</regexp>
</trailermatching>
do not work.


I think IT HAS TO WORK, when i name my trailerfile "moviename_Trailer.ext" and use the example from the Wiki
Code:
<trailermatching>
<!-- This regexp will match moviename_Trailer.avi -->
<regexp>(.*?)(_Trailer)(\.[^.]+)$</regexp>
</trailermatching>
But even that doesn't work.
To be honest, I'm a bit desperate and don't know how I can get KODI to recognize (and play) all video files with ...-trailer.ext as a local trailer file in the movies folder.  Sad


It seems like the <trailermatching> tag is just completely useless...
Can someone maybe test this and confirm that it works (or not)?
Your <trailermatching> tag must be inside a top level <advancedsettings> tag. Something like

<advancedsettings>
  <trailermatching>
    <regexp>(.*?)(-trailer)(\.[^.]+)$</regexp>
  </trailermatching>
</advancedsettings>

is read successfully by Kodi.
Hello and thank you very much for the tip.

(in this case "unfortunately") i've already done it that way.

I have my
<trailermatching> tags at the very end of the advancedsettings.xml right before the end </advancedsettings>

here is my complete advancedsettings.xml
Code:
<advancedsettings>

  <videodatabase>
    <type>mysql</type>
    <host>192.168.1.6</host>
    <port>3307</port>
    <user>XX-USER-XX</user>
    <pass>XX-PW-XX</pass>
  </videodatabase>

  <musicdatabase>
    <type>mysql</type>
    <host>192.168.1.6</host>
    <port>3307</port>
    <user>XX-USER-XX</user>
    <pass>XX-PW-XX</pass>
  </musicdatabase>

  <pathsubstitution>
    <substitute>
      <from>special://masterprofile/Thumbnails</from>
      <to>smb://USER: [email protected]/PATH/TO/MY/THUMBNAILS/</to>
    </substitute>

    <substitute>
      <from>special://masterprofile/sources.xml</from>
      <to>smb://USER: [email protected]/PATH/TO/MY/sources.xml</to>
    </substitute>

    <substitute>
      <from>special://masterprofile/favourites.xml</from>
      <to>smb://USER: [email protected]/PATH/TO/MY/favourites.xml</to>
    </substitute>
  </pathsubstitution>

  <seeksteps>5, 20, 60, 180, 300, 600, 1200, 1800</seeksteps>

  <videolibrary>
    <usefasthash>false</usefasthash>
    <!-- defaults to true. Set to false in order to skip hashing based on the folders modification time. -->

    <importwatchedstate>true</importwatchedstate>
    <!-- import previously exported playdate and playcount from .nfo files. Defaults to false -->

    <dateadded>1</dateadded>
    <!-- 0 results in using the current datetime when adding a video;
    1 (default) results in prefering to use the files mtime (if it's valid) and only using the file's ctime if the mtime isn't valid;
    2 results in using the newer datetime of the file's mtime and ctime -->
  </videolibrary>


  <trailermatching>
    <regexp>(.*?)(-trailer)(\.[^.]+)$</regexp>
  </trailermatching>

</advancedsettings>
wait...

do i have to name the trailer-file exact like the movie-file?

For example my movie-FOLDER looks like "Batman v Superman Dawn of Justice (2016)"
My movie-FILE do include some more details like "Batman v Superman Dawn of Justice (2016) x265 AC3 [DE+EN] Bluray-1080p.mkv"
BUT my trailer looks like the folder "Batman v Superman Dawn of Justice (2016)-trailer.ext"

No matter what i try: KODI only recognice a trailer, when it is named "movie-trailer.ext" or (the full original movie-filename) "Batman v Superman Dawn of Justice (2016) x265 AC3 [DE+EN] Bluray-1080p-trailer.ext"


I thought with the <regex> Tags i can tell KODI to recognice every file matching the regex (inside the movie folder) as the correspondending a trailer.
So it should recognice "Batman v Superman Dawn of Justice (2016)-trailer.ext" as a trailer.

Is this train of thought wrong on my part?  Confused
The extension is truncated before the regexp execution on the file name.

<regexp>(.*?)(-trailer)$</regexp>

works.
It's very old code, looks like the wiki has always been misleading.
omg...
I've really tried to learn and/or understand regex expressions on various sites. I really didn't think that my "error" was due to an incorrect regex expression Big Grin

I've only tested it briefly once, but this first short test was successful Smile and KODI recognized a trailer file that had a completely different name!! As long as it had “-trailer” at the end ;-)

Thank you @ChrystaIP !!!
You couldn't have guessed, especially with a broken example. I fixed the Wiki page.
Pages: 1 2