• 1(current)
  • 2
  • 3
  • 4
  • 5
  • 8
[RELEASE] YouTrailer (Script) - Movie Trailers
#1
Thumbs Up 
Hey All,

YouTrailer is the perfect solution to always have WORKING trailers in XBMC.
It fetches YouTube tokens when you play the trailer, so no more invalid youtube trailer links.

The script when fetching the trailer, takes the IMDB id of the currently selected movie,
fetches the TMDB youtube trailer. Fetches a token for the trailer. Fetches the full url of the trailer and starts the playback of the trailer.

Features To Come:
1) Option to download trailers then play
2) Option to search youtube for trailer if TMDB has no trailer for a movie
Then an option that will post your found trailer link to the TMDB website
+ a few more

It also checks for local trailers first, and tries the url in xbmc database before fetching.

This script is VERY FAST and you will never be waiting more than 2seconds before a trailer is played!
(Faster internet may increase this speed to)

Download: Version 0.7 : http://xbmc-scripting.googlecode.com/svn...0V.0.7.rar

SVN: http://xbmc-scripting.googlecode.com/svn...ouTrailer/

Install the script into your scripts directory, then edit your desired skins DialogVideoInfo.xml file with this line on the Trailer button control:

<onclick>RunScript(special://home/scripts/YouTrailer/default.py,1)</onclick>

Also, remove the visibility to the trailer button is always shown (else you won't be able to run the script SILLY)

EXAMPLE: This is for Confluence Skin 720p DialogVideoInfo.xml

<control type="button" id="15">
#change id from 11 to another non used id to stop xbmc's "trailer" function from running as well as script but Check you don't break navigation to button
<description>Play Trailer</description>
<label>20410</label>
<include>ButtonInfoDialogsCommonValues</include>
<onclick>RunScript(special://home/scripts/YouTrailer/default.py,1)</onclick>
</control>

Screenshots:

Image

Image

Image

Yes, nothing will happen (YET) if you run the script directly.

ENJOY!!
Reply
#2
does this work at all if you use imdb for movie content?

edit: Using xbmc on ubuntu karmic, I get the following error

18:43:19 T:2336205712 M:1280331776 INFO: -->Python script returned the following error<--
18:43:19 T:2336205712 M:1280331776 ERROR: Error Type: exceptions.ImportError
18:43:19 T:2336205712 M:1280331776 ERROR: Error Contents: No module named _sqlite
18:43:19 T:2336205712 M:1280331776 ERROR: Traceback (most recent call last):
File "/home/xbmc/.xbmc/scripts/YouTrailer/default.py", line 28, in ?
import main
File "/home/xbmc/.xbmc/scripts/YouTrailer/resources/lib/main.py", line 4, in ?
from pysqlite2 import dbapi2 as sqlite
File "/home/xbmc/.xbmc/scripts/YouTrailer/resources/platform_libraries/Linux/pysqlite2/dbapi2.py", line 27, in ?
from pysqlite2._sqlite import *
ImportError: No module named _sqlite
18:43:19 T:2336205712 M:1280331776 INFO: -->End of Python script error report<--
Reply
#3
Ok. Here is how it works:

1) onclick sends the filename & filepath of the currently selected movie in library mode.
2) gets the IMDB id from the XBMC DB using the filename and path.
3) gets the TMDB id from TMDB using the IMDB id
4) get the TMDB youtube url from TMDB
5) gets youtube token for file
6) creates "real url" for file and then plays it

So, as long as you have an IMDB id for the movie stored in your XBMC library, your good to go.

Programs like EMBER etc, write the IMDB id into .nfo files. Xbmc imports these and then you will have the imdb id in your database...
or if you use the IMDB scraper through XBMC.

Im not sure on other scrapers, possibly TMDB scraper might give you the imdb id to...


A fixed .rar has been uploaded. The script should work now.. use link in my first post
Reply
#4
Works great, only bug i have noticed is on some films it would start the trailer instantly (show the green mpaa screen), then you would see it was downloading the trailer still in the top right hand corner (in alaska skin anyways), stop the trailer and then start playing trailer again.

happened with this movie for one

http://www.themoviedb.org/movie/4638

and one more thing, if a downloaded trailer file already exists for the movie can you get it to play that instead of the youtube stream?
Reply
#5
Hi,

What is hapening is that XBMC's "trailer" function is starting as well as the script.
So, if you had a trailer url already in the xbmc database or a local trailer "-trailer.flv", XBMC will be starting to play these and starting the script.

To stop this, change the "id" of the trailer button to eg: 15
This will stop XBMC knowing its the "Trailer" button.
I will soon write into the script to check for local trailers and urls already in nfo as well 1st then play these if they exist

Aslo, re-download script from above if you want a little bit of "eye candy".
Just made it send a nice infolabel to the xbmc player so if you view now playing etc while playing script, it shows you icon etc

Thanks,

Matt
Reply
#6
Version 0.2 Available Now!
Big Grin

EDIT: Version 0.3 Available Now!
Added: Script now saves all fetched youtube url's to a database for quicker access next time playing trailer
Reply
#7
Working fairly well under Mac OS X and Xperience skin.

I've got 1 request and 1 question though.

Any chance there could be a way to save the trailer... maybe a script settings option or something?

And Is there a possibility to get TV Shows "previews" or whatever to work with this? The ones I have simply fail but maybe it's because they dont have an IMDB id or something, i'm not sure.

Thnks for your work.
Reply
#8
I get this when i try to play a trailer:

"Failed to access xbmc database".


Great script btw, if i get this to work. My girlfriend will be really happy Smile
Reply
#9
Hi.

"Any chance there could be a way to save the trailer... maybe a script settings option or something?"

Yes, i will be making a settings area when you run the script through scripts. This will be an options.
Tv show trailers?

This script doesnt actually search youtube YET, it gets youtube links from thetvdb.
It will soon have a fallback to search youtube manually for trailers, so searching for tv show trailers may be an option.. unless you know a website that has tv show trailers/previews?


Trey: this error occurs when the script fails to fetch data for movies from the xbmc database.
Two things:
1) script ONLY will work in library mode
2) Make sure your onlick link has the "spaces" in it
<onclick>RunScript(special://home/scripts/YouTrailer/default.py,"$INFO[listitem.filename] ","$INFO[listitem.path] ")</onclick>
There are spaces after ] and "
Reply
#10
stanley87 Wrote:Hi.
Trey: this error occurs when the script fails to fetch data for movies from the xbmc database.
Two things:
1) script ONLY will work in library mode
2) Make sure your onlick link has the "spaces" in it
<onclick>RunScript(special://home/scripts/YouTrailer/default.py,"$INFO[listitem.filename] ","$INFO[listitem.path] ")</onclick>
There are spaces after ] and "

1) Yea I'm in Library mode =)
2) Tried spaces everywhere now without any luck.

Should the output in the log be:
______________________________________________________________
1. --> ," $INFO[listitem.filename] "," $INFO[listitem.path] ")</onclick> <--
______________________________________________________________
CApplication::ExecuteXBMCAction : To RunScript(special://home/scripts/YouTrailer/default.py," m-dos-720p.mkv "," rar://smb://quad/Media G (WDGP 2TB #1)/Filmer/HDRip/500.Days.Of.Summer.720p.BluRay.x264-METiS/m-dos-720p.rar/ ")


___________________________________________________________
2. --> ,"$INFO[listitem.filename]","$INFO[listitem.path]")</onclick> <--
___________________________________________________________
CApplication::ExecuteXBMCAction : To RunScript(special://home/scripts/YouTrailer/default.py,"m-dos-720p.mkv","rar://smb://quad/Media G (WDGP 2TB #1)/Filmer/HDRip/500.Days.Of.Summer.720p.BluRay.x264-METiS/m-dos-720p.rar/")


_____________________________________________________________
3. --> ,"$INFO[listitem.filename] ","$INFO[listitem.path] ")</onclick> <--
_____________________________________________________________
CApplication::ExecuteXBMCAction : To RunScript(special://home/scripts/YouTrailer/default.py,"m-dos-720p.mkv ","rar://smb://quad/Media G (WDGP 2TB #1)/Filmer/HDRip/500.Days.Of.Summer.720p.BluRay.x264-METiS/m-dos-720p.rar/ ")


Is there any other log then xbmc.log i should look in?

Part of log:
Code:
13:50:39 T:3452 M:1443540992   DEBUG: SDLKeyboard: scancode: 75, sym: 276, unicode: 0, modifier: 0
13:50:39 T:3452 M:1443540992   DEBUG: CApplication::OnKey: 61477 pressed, action is 1
13:50:40 T:3452 M:1443790848   DEBUG: SDLKeyboard: scancode: 28, sym: 13, unicode: 13, modifier: 0
13:50:40 T:3452 M:1443790848   DEBUG: CApplication::OnKey: 61453 pressed, action is 7
13:50:40 T:3452 M:1443778560   DEBUG: CApplication::ExecuteXBMCAction : Translating RunScript(special://home/scripts/YouTrailer/default.py," $INFO[listitem.filename] "," $INFO[listitem.path] ")
13:50:40 T:3452 M:1443778560   DEBUG: CApplication::ExecuteXBMCAction : To RunScript(special://home/scripts/YouTrailer/default.py,"m-dos-720p.mkv ","rar://smb://quad/Media G (WDGP 2TB #1)/Filmer/HDRip/500.Days.Of.Summer.720p.BluRay.x264-METiS/m-dos-720p.rar/ ")
13:50:40 T:3452 M:1443778560    INFO: initializing python engine.
13:50:40 T:3452 M:1443778560   DEBUG: Win32DllLoader::Load(special://xbmc/system/python/python24.dll)
13:50:40 T:3452 M:1443745792   DEBUG: LoadLibraryA('MSVCR71.dll')
13:50:40 T:3452 M:1443745792   DEBUG: LoadLibrary('MSVCR71.dll') returning: 02EE80B0
13:50:40 T:3452 M:1443258368   DEBUG: LoadLibraryExA called with flags:
                                             - LOAD_WITH_ALTERED_SEARCH_PATH
13:50:40 T:3452 M:1443258368   DEBUG: LoadLibraryA('zlib.pyd')
13:50:40 T:3452 M:1443258368   DEBUG: Win32DllLoader::Load(special://xbmc/system/python/DLLs\zlib.pyd)
13:50:40 T:3452 M:1443246080   DEBUG: LoadLibraryA('python24.dll')
13:50:40 T:3452 M:1443246080   DEBUG: LoadLibrary('python24.dll') returning: 069831D8
13:50:40 T:3452 M:1443246080   DEBUG: LoadLibraryA('MSVCR71.dll')
13:50:40 T:3452 M:1443246080   DEBUG: LoadLibrary('MSVCR71.dll') returning: 02EE80B0
13:50:40 T:3452 M:1443246080   DEBUG: LoadLibrary('zlib.pyd') returning: 06983138
13:50:40 T:3452 M:1442738176   DEBUG:   msg: 'import site' failed; use -v for traceback
13:50:40 T:3452 M:1442443264   DEBUG: new python thread created. id=2
13:50:40 T:3268 M:1442443264   DEBUG: thread start, auto delete: 0
13:50:40 T:3268 M:1442443264   DEBUG: Python thread: start processing
13:50:40 T:3268 M:1441820672   DEBUG:   msg: 'import site' failed; use -v for traceback
13:50:40 T:3268 M:1441820672  NOTICE: -->Python Interpreter Initialized<--
13:50:40 T:3268 M:1441820672   DEBUG: XBPyThread::Process - The source file to load is special://home/scripts/YouTrailer/default.py
13:50:40 T:3268 M:1441689600   DEBUG: XBPyThread::Process - Setting the Python path to C:\XBMC\scripts\YouTrailer;special://xbmc/system/python/python24.zlib;special://xbmc/system/python/DLLs;special://xbmc/system/python/Lib;special://xbmc/system/python/spyce
13:50:40 T:3268 M:1441689600   DEBUG: XBPyThread::Process - Entering source directory C:\XBMC\scripts\YouTrailer
13:50:40 T:3268 M:1441685504  NOTICE: [SCRIPT] 'YouTrailer: version 0.3' initialized!
13:50:40 T:3268 M:1441648640   DEBUG: LoadLibraryExA called with flags:
                                             - LOAD_WITH_ALTERED_SEARCH_PATH
13:50:40 T:3268 M:1441648640   DEBUG: LoadLibraryA('_sqlite.pyd')
13:50:40 T:3268 M:1441648640   DEBUG: Win32DllLoader::Load(C:\XBMC\scripts\YouTrailer\resources\platform_libraries\win32\pysqlite2\_sqlite.pyd)
13:50:40 T:3268 M:1441632256   DEBUG: LoadLibraryA('python24.dll')
13:50:40 T:3268 M:1441632256   DEBUG: LoadLibrary('python24.dll') returning: 069831D8
13:50:40 T:3268 M:1441632256   DEBUG: LoadLibraryA('MSVCR71.dll')
13:50:40 T:3268 M:1441632256   DEBUG: LoadLibrary('MSVCR71.dll') returning: 02EE80B0
13:50:40 T:3268 M:1441632256   DEBUG: LoadLibrary('_sqlite.pyd') returning: 06983048
13:50:40 T:3268 M:1440776192   DEBUG: LoadLibraryExA called with flags:
                                             - LOAD_WITH_ALTERED_SEARCH_PATH
13:50:40 T:3268 M:1440776192   DEBUG: LoadLibraryA('_socket.pyd')
13:50:40 T:3268 M:1440776192   DEBUG: Win32DllLoader::Load(special://xbmc/system/python/DLLs\_socket.pyd)
13:50:40 T:3268 M:1440759808   DEBUG: LoadLibraryA('python24.dll')
13:50:40 T:3268 M:1440759808   DEBUG: LoadLibrary('python24.dll') returning: 069831D8
13:50:40 T:3268 M:1440759808   DEBUG: LoadLibraryA('MSVCR71.dll')
13:50:40 T:3268 M:1440759808   DEBUG: LoadLibrary('MSVCR71.dll') returning: 02EE80B0
13:50:40 T:3268 M:1440759808   DEBUG: LoadLibrary('_socket.pyd') returning: 06982FF8
13:50:40 T:3268 M:1440755712   DEBUG: LoadLibraryExA called with flags:
                                             - LOAD_WITH_ALTERED_SEARCH_PATH
13:50:40 T:3268 M:1440755712   DEBUG: LoadLibraryA('_ssl.pyd')
13:50:40 T:3268 M:1440755712   DEBUG: Win32DllLoader::Load(special://xbmc/system/python/DLLs\_ssl.pyd)
13:50:40 T:3268 M:1440714752   DEBUG: LoadLibraryA('python24.dll')
13:50:40 T:3268 M:1440714752   DEBUG: LoadLibrary('python24.dll') returning: 069831D8
13:50:40 T:3268 M:1440714752   DEBUG: LoadLibraryA('MSVCR71.dll')
13:50:40 T:3268 M:1440714752   DEBUG: LoadLibrary('MSVCR71.dll') returning: 02EE80B0
13:50:40 T:3268 M:1440714752   DEBUG: LoadLibrary('_ssl.pyd') returning: 06982FA8
13:50:40 T:3268 M:1438105600   DEBUG: unable to load C:\XBMC\scripts\YouTrailer\resources\language\Swedish\strings.xml: Failed to open file at line 0
13:50:40 T:3268 M:1438076928    INFO: Loading skin file: DialogProgress.xml
13:50:40 T:3268 M:1438072832   DEBUG: Load DialogProgress.xml: 17.70ms
13:50:40 T:3268 M:1438072832   DEBUG: ------ Window Init (DialogProgress.xml) ------
13:50:40 T:3268 M:1438072832   DEBUG: Alloc resources: 0.04ms (0.00 ms skin load)
13:50:41 T:3268 M:1437900800    INFO: Loading skin file: DialogOK.xml
13:50:41 T:3268 M:1437896704   DEBUG: Load DialogOK.xml: 17.29ms
13:50:41 T:3452 M:1437896704   DEBUG: ------ Window Init (DialogOK.xml) ------
13:50:41 T:3452 M:1437896704   DEBUG: Alloc resources: 0.03ms (0.00 ms skin load)
13:50:41 T:3452 M:1437892608   DEBUG: ------ Window Deinit (DialogProgress.xml) ------
13:50:42 T:3452 M:1438593024   DEBUG: SDLKeyboard: scancode: 28, sym: 13, unicode: 13, modifier: 0
13:50:42 T:3452 M:1438593024   DEBUG: CApplication::OnKey: 61453 pressed, action is 7
13:50:43 T:3452 M:1438580736   DEBUG: ------ Window Deinit (DialogOK.xml) ------
13:50:43 T:3452 M:1438580736   DEBUG: SDLKeyboard: scancode: 14, sym: 8, unicode: 8, modifier: 0
13:50:43 T:3452 M:1438580736   DEBUG: CApplication::OnKey: 61448 pressed, action is 51
13:50:44 T:3452 M:1438781440   DEBUG: ------ Window Deinit (DialogVideoInfo.xml) ------
13:50:44 T:3452 M:1441443840   DEBUG: SDLKeyboard: scancode: 14, sym: 8, unicode: 8, modifier: 0
13:50:44 T:3452 M:1441443840   DEBUG: CApplication::OnKey: 61448 pressed, action is 9
13:50:44 T:3452 M:1441431552   DEBUG: CGUIWindowManager::PreviousWindow: Deactivate
13:50:44 T:3452 M:1441431552   DEBUG: ------ Window Deinit (MyVideoNav.xml) ------
13:50:44 T:3452 M:1443201024   DEBUG: CGUIWindowManager::PreviousWindow: Activate new
13:50:44 T:3452 M:1443201024   DEBUG: ------ Window Init (Home.xml) ------
Reply
#11
Ok.
Do you know how to open the xbmc database with EG: SQLite Expert Personal 2 in windows?
If so, open up the database look at the table "path"
My script query's this using the path to your movie.
If the path in this database is different to:

rar://smb://quad/Media G (WDGP 2TB #1)/Filmer/HDRip/500.Days.Of.Summer.720p.BluRay.x264-METiS/m-dos-720p.rar/

it will not find the movie.

Let me know what the path in the database is

Any XBMC developers have any input?
Reply
#12
Ok. Looks if xbmc stores "rar" file paths differently to normal :-(
Filepath = C:\quad\Media G (WDGP 2TB #1)\Filmer\HDRip\500.Days.Of.Summer.720p.BluRay.x264-METiS\

Filename = rar://C%3a%5cquad%5cMedia%20G%20%28WDGP%202TB%20%231%29%5cFilmer%5cHDRip%5c500%2eDays%2eOf%2eSummer%2e720p%2eBluRay%2ex264%2dMETiS%5cm%2ddos%2d720p%2erar/Avatar (2009).avi

Instead of:
Filepath = C:\quad\Media G (WDGP 2TB #1)\Filmer\HDRip\500.Days.Of.Summer.720p.BluRay.x264-METiS\

Filename = Avatar (2009).avi



I HAVE A FIX!!!

I will upload a new version in apox 2 hours of the script.
In this version, no longer is the imdb fetched from the xbmc database by quering the path of the file.
But, now is query'd using the title of the movie, the year of the movie and the director.
So, no longer will the script rely on paths of files AT ALL!!

This will fix your problem and make the link to run the script match more simple:
<onclick>RunScript(special://home/scripts/YouTrailer/default.py, 1)</onclick>

EASY Big Grin

1 tells it is is run in trailer mode, not settings mode (still to write)


Pop back at 3pm New Zealand time (2 hours away) and get the new version Big Grin
Reply
#13
should make a different case if it's rar file.

to open db, you've got sqlite manager addons for firefox, works great!
Reply
#14
New problem came up.

I've set up a new user this time using an smb source instead of local files. Everything is catalogued great but i often get "Trailer has been removed" and very few trailers seem to be working this time. Maybe this new update will fix this problem.

And thanks for replying about the TV Shows thing.
I was really just thinking about a youtube kind of search but since it's not doing that yet I guess I'll wait for a future version.
Reply
#15
that remembers me something i've encountered with xbmcstuff plugin,
can you post path / name that fails ?
Reply
  • 1(current)
  • 2
  • 3
  • 4
  • 5
  • 8

Logout Mark Read Team Forum Stats Members Help
[RELEASE] YouTrailer (Script) - Movie Trailers0