Author Topic: Tool to help create Trailer Server  (Read 5325 times)

Offline jer1956

  • Global Moder8or
  • M8er Addict
  • *****
  • Posts: 17 167
  • Helpful Contribution Status: +190/-52
Tool to help create Trailer Server
« on: August 03, 2014, 12:47:21 pm »
A Trailer Server is a webserver on the local network where trailers can  be stored.  Each  trailer must be Safari HTML5 compatible, than means mp4, and each will have its own small HTML video player.

There are 2 issues:-
1) Each trailer will need the trailers file name put into a copy of the HTML Video Player, and that  given a name to  match.
2) The Jukebox XML for the movie will need the trailer link modified to point at that HTML Video player on the webserver.    

So:-

[CDATA[https://www.youtube.com/embed/5UnjrG_N8hU?version=3&loop=1&playlist=5UnjrG_N8hU&autoplay=1&showinfo=0&autohide=1]

would become something like

[CDATA[https://192.168.1.2/Episode2.html]

The small HTML5 video player is attached below, with a test trailer of poor quality purely to keep  the size down.

https://www.dropbox.com/s/apa8h61k8e53x6k/NewPlayer.rar

So whats needed is a tool that  can  do  these changes as users find external  trailers they  would  prefer.

It has to  be done this way. The X3D player code itself will not be modified to support this  feature.

So  is there anyone willing and able to  give this  ago?
« Last Edit: August 03, 2014, 03:59:20 pm by jer1956 »

Offline sebsch1991

  • Newbie
  • Posts: 11
  • Helpful Contribution Status: +2/-0
Re: Tool to help create Trailer Server
« Reply #1 on: August 04, 2014, 02:25:29 pm »
Im running xampp webserver on a Windows Server on my LAN and its working fine.

Ive already written a batch script that does the following:
- Scan Movie Folder for MovieNames
- Creates appropriate html Files in TrailerFolder of Webserver
- Edits the Movie-Name.xml Files in Movie Folder to match the new link (will delete all auto generated links)

!! Requirement !!
You must have the following folder and name setup:
MovieFolder\Avengers\Avengers.mkv
                                \Avengers.xml

MovieFolder\Spiderman 3\Spiderman 3.mkv
                                     \Spiderman 3.xml
...
..
.


Tested on Windows 8.1 working fine !

Instructions:
1 - Setup your webserver correctly!
2 - Create a folder on your webserver where you will store the trailers (e.g. C:\htdocs\trailer)
3 - Download the trailer-TEMPLATE.html to your created trailer folder
4 - Download the Main Script and store it wherever you want as a .cmd File
5 - Download gnu32 sed for windows and install it (copy to ..\system32\ Folder)
--- http://gnuwin32.sourceforge.net/packages/sed.htm
6 - Change Variables in Script as described in the header
7 - Run the script from commandline or double click on cmd-File
8 - Youre Done!

Now you have to copy your trailer files (mp4) to your trailer Folder and rename it to the matching HTML File!

Main Script:

Code: [Select]
@echo off
setlocal enabledelayedexpansion
REM sebsch1991 mede8er Community
REM Script to prepare Webserver and Movie Files for your own local Trailer
REM
REM
REM ---SET YOUR ENVIRONMENT HERE
REM ---MovieDirectory
SET filmdir="R:\media\filme"

REM ---Webserver Trailer Directory
SET trailerdir=C:\Program Files\xampp\htdocs\trailer

REM ---Link to your Webserver Directory
SET basiclink=http://2.2.2.15/trailer/


dir /B /A:D %filmdir% > C:\list.txt

for /f "tokens=*" %%f in (C:\list.txt) do (
  echo "Processing %%f ..."  
  SET file=%%f
  SET trailername=!file: =_!
  IF EXIST "%trailerdir%\!trailername!.html" (
  echo !trailername! Trailer HTML File already exists!
  ) else (
  sed -e s/...---.../!trailername!.mp4/g "%trailerdir%\trailer_TEMPLATE.html" > "%trailerdir%\!trailername!.html"
  if errorlevel 0 echo !trailername! Trailer HTML File added!
  )
  
  IF EXIST "%filmdir%\%%f\%%f.xml" (
  sed "/<videos>/,/BISZUMSCHLUSS/d" "%filmdir%\%%f\%%f.xml" > %filmdir%\sed.txt
  printf "<videos>"\n >> %filmdir%\sed.txt
  printf "<item name=\"Trailer\" site=\"YouTube\" size=\"720\"><url><^!^[CDATA^[%basiclink%!trailername!.html^]^]></url></item>"\n >> %filmdir%\sed.txt
  printf "</videos>"\n"</movie>"\n"</details>"\n >> %filmdir%\sed.txt
  
  move %filmdir%\sed.txt "%filmdir%\%%f\%%f.xml" >nul 2>&1
  echo XML-File edited!
  ) else (
  echo XML-File not found!
  )
  echo -----
)
del %filmdir%\sed.txt >nul 2>&1
del C:\list.txt
pause

trailer_TEMPLATE.html :

Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head >
<title>Mede8er server video player Version 1.0 03/08/2014</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
 
html {overflow: hidden; height: 100%;background-color:black;}
body {}

</style>


</head>

<body>


<video preload=auto autoplay="autoplay"  loop width=100% height=100%>
<source src="...---..." type="video/mp4" />

</body>
</html>
« Last Edit: August 04, 2014, 05:06:05 pm by sebsch1991 »

Offline sebsch1991

  • Newbie
  • Posts: 11
  • Helpful Contribution Status: +2/-0
Re: Tool to help create Trailer Server
« Reply #2 on: August 04, 2014, 02:28:47 pm »
If someone needs a Linux Bash implementation of that script just let me know ..
Takes me around 10 Minutes to write ..while that **** windows batch garbage took me about 6 hours since sed is not working properly.

Its fun to click that script and your Files are all generated automatically but you will realize the pain to download and rename all the trailers by hand  ;D
Im on 189 of 295 by now ..was a hard day


Best way is youtube + Firefox Download Helper plugin -> Download the mp4 files!

Offline jer1956

  • Global Moder8or
  • M8er Addict
  • *****
  • Posts: 17 167
  • Helpful Contribution Status: +190/-52
Re: Tool to help create Trailer Server
« Reply #3 on: August 04, 2014, 03:35:41 pm »
There is a new version of the player on the drop box. It avoids using a non 100% setting, which  was there just to avoid a  vertical scroll bar. I disliked that bit of html and found a cleaner way.   

Offline sebsch1991

  • Newbie
  • Posts: 11
  • Helpful Contribution Status: +2/-0
Re: Tool to help create Trailer Server
« Reply #4 on: August 04, 2014, 05:07:46 pm »
There is a new version of the player on the drop box. It avoids using a non 100% setting, which  was there just to avoid a  vertical scroll bar. I disliked that bit of html and found a cleaner way.   

Tested, works, looks good! Is it possible to stop the loop and auto return back to Jukebox View when trailer ends ?

Offline sebsch1991

  • Newbie
  • Posts: 11
  • Helpful Contribution Status: +2/-0
Re: Tool to help create Trailer Server
« Reply #5 on: August 04, 2014, 06:22:26 pm »
Tested, works, looks good! Is it possible to stop the loop and auto return back to Jukebox View when trailer ends ?

Doesnt work, the movie stops/pauses at last frame but wont close and return back to jukebox

Offline jer1956

  • Global Moder8or
  • M8er Addict
  • *****
  • Posts: 17 167
  • Helpful Contribution Status: +190/-52
Re: Tool to help create Trailer Server
« Reply #6 on: August 04, 2014, 06:23:25 pm »
Tested, works, looks good! Is it possible to stop the loop and auto return back to Jukebox View when trailer ends ?

I thought I had found it....and then safari refused to do it. This is the problem with html5, lack of universal support for all commands.

it worked on the PC..and you tested on the player quicker than I did.
« Last Edit: August 04, 2014, 08:47:20 pm by jer1956 »