[RELEASE] YouTrailer (Script) - Movie Trailers - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33) +--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27) +---- Forum: Video Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=154) +---- Thread: [RELEASE] YouTrailer (Script) - Movie Trailers (/showthread.php?tid=69593) |
[RELEASE] YouTrailer (Script) - Movie Trailers - matthuisman - 2010-02-05 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/packages/YouTrailer/YouTrailer%20V.0.7.rar SVN: http://xbmc-scripting.googlecode.com/svn/trunk/YouTrailer/ 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: Yes, nothing will happen (YET) if you run the script directly. ENJOY!! - moontan77 - 2010-02-05 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<-- - matthuisman - 2010-02-05 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 - moontan77 - 2010-02-05 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? - matthuisman - 2010-02-05 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 - matthuisman - 2010-02-07 Version 0.2 Available Now! 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 - gugahoi - 2010-02-08 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. - trey - 2010-02-08 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 - matthuisman - 2010-02-08 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 " - trey - 2010-02-09 stanley87 Wrote:Hi. 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 - matthuisman - 2010-02-09 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? - matthuisman - 2010-02-09 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 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 - ppic - 2010-02-09 should make a different case if it's rar file. to open db, you've got sqlite manager addons for firefox, works great! - gugahoi - 2010-02-09 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. - ppic - 2010-02-09 that remembers me something i've encountered with xbmcstuff plugin, can you post path / name that fails ? |