How to add intros via asx file and my random intro generator

Media Browser Tutorial ONLY (strictly enforced)

Re: How to add intros via asx file and my random intro generator

Postby casperinmd » Wed Jun 17, 2009 4:49 pm

Just a quick note...there is a problem with files containing (). I will figure it out when I get home and update the script. If all your movie only contain alpha/numeric and spaces, you can use it as is, the new script won't change anything except being able to deal with the ().
casperinmd
 
Posts: 122
Joined: Mon Mar 23, 2009 2:07 pm

Re: How to add intros via asx file and my random intro generator

Postby daavid1 » Wed Jun 17, 2009 11:01 pm

Works a treat - Thanks guys
daavid1
 
Posts: 166
Joined: Sun Jan 11, 2009 1:04 pm

Re: How to add intros via asx file and my random intro generator

Postby daavid1 » Thu Jun 18, 2009 9:13 am

Hi Caspermind - I really liked Scales original idea that the intro could change at a given interval.
I have a folder of trailers for all of the movies in my collection. Would it be possible to write a script which randomly added a set amount of trailers to another asx which gets called before the Intro asx? Lets say 4 trailers get pulled.

Perhaps the easiest approach would be something similar to how it is initially handled in this thread where we have a set ASX with set files being pulled. For instance:

Code: Select all
<asx version="3">
<title>Trailers</title>
<entry><ref href="K:\Trailers\trailer1.mpg" /><title>Trailer1</title></entry>
<entry><ref href="K:\Trailers\trailer2.mpg" /><title>Trailer2</title></entry>
<entry><ref href="K:\Trailers\trailer3.mpg" /><title>Trailer3</title></entry>
<entry><ref href="K:\Trailers\trailer4.mpg" /><title>Trailer4</title></entry>
</asx>


So the script I'd be looking for i suppose would in fact randomly pick four trailers and rename them to trailer1.mpg, trailer2.mpg, trailer3.mpg and trailer4.mpg.

So then We'd have 4 random trailers from our collection followed by an intro sequence, follwed by the main movie :)

Can it be done?
daavid1
 
Posts: 166
Joined: Sun Jan 11, 2009 1:04 pm

Re: How to add intros via asx file and my random intro generator

Postby casperinmd » Thu Jun 18, 2009 2:00 pm

@daavid1,
If you are just looking to add a few more trailer lines to your asx file, that is simple Just find/replace in the script the following:

FIND
Code: Select all
>con echo.
             echo ^<asx version="3"^>
             echo ^<title^>!FOLDER!^</title^>
             echo ^<entry^>^<ref href="%INTRO%" /^>^<title^>Intro^</title^>^</entry^>
             echo ^<entry^>^<ref href="%%~dpa!FOLDER!02%%~xa" /^>^<title^>Main Movie^</title^>^</entry^>
             echo ^</asx^>
       )   >"%%~dpa!FOLDER!01.asx"


REPLACE WITH
Code: Select all
>con echo.
             echo ^<asx version="3"^>
             echo ^<title^>!FOLDER!^</title^>
             echo ^<entry^>^<ref href="K:\Trailers\trailer1.mpg" /^>^<title^>Trailer1^</title^>^</entry^>
             echo ^<entry^>^<ref href="K:\Trailers\trailer2.mpg" /^>^<title^>Trailer2^</title^>^</entry^>
             echo ^<entry^>^<ref href="K:\Trailers\trailer3.mpg" /^>^<title^>Trailer3^</title^>^</entry^>
             echo ^<entry^>^<ref href="K:\Trailers\trailer4.mpg" /^>^<title^>Trailer4^</title^>^</entry^>
             echo ^</asx^>
       )   >"%%~dpa!FOLDER!01.asx"


This will give you an asx file like the one you posted above, then you can use the random script scales posted in teh first post to mix it up as you wish.
casperinmd
 
Posts: 122
Joined: Mon Mar 23, 2009 2:07 pm

Re: How to add intros via asx file and my random intro generator

Postby casperinmd » Thu Jun 18, 2009 2:04 pm

I just noticed as well, a flaw, well as designed but...I was asked to make the asx file with an intro entry followed by the movie, so that will play the intro then the movie (from the asx file), then the movie again b/c it will find the movie in the folder with the asx. This is not really what was intended was it?

I think the asx should be listing just the intro's since we are renaming the movie to play after the playlist..right?
casperinmd
 
Posts: 122
Joined: Mon Mar 23, 2009 2:07 pm

Re: How to add intros via asx file and my random intro generator

Postby tlmaclennan » Thu Jun 18, 2009 5:27 pm

Yea, it should only have the intro video in the playlist. With the playlist named Movie01.asx and the movie renamed to Movie02.mkv MediaBrowser will see it as the movie being split into two files.

Thank you for the script! It worked perfectly. I now need to convert my ISO movies over to MKV.
tlmaclennan
 
Posts: 13
Joined: Thu Jun 11, 2009 9:37 pm

Re: How to add intros via asx file and my random intro generator

Postby daavid1 » Thu Jun 18, 2009 6:03 pm

Hi Casper,
Thats partly what I want, but the other side of it is some script that could be run daily, or hourly or something that will randomly change the name of some of my trailers so the ASX picks them up.
If all my trailers are named to match the film they represent, such as "28 Days Later_trailer.mpg", the ASX won't pick them up. But if I have an hourly script that randomly renames some of them to 'trailer1.mpg', 'trailer2.mpg' etc. then the ASX will pick up the trailers.

I guess the script could first delete the existing 'trailer1.mpg', 'trailer2.mpg', 'trailer3.mpg' and 'trailer4.mpg', makes copies of 4 random trailers, then rename them to 'trailer1.mpg', 'trailer2.mpg', 'trailer3.mpg' and 'trailer4.mpg'. If i set this to run hourly or whatever, it would mean that nearly everytime i watch a film it would give me different trailers from my collection. Does that explain it better?
daavid1
 
Posts: 166
Joined: Sun Jan 11, 2009 1:04 pm

Re: How to add intros via asx file and my random intro generator

Postby casperinmd » Thu Jun 18, 2009 6:07 pm

daavid1 wrote:Hi Casper,
Thats partly what I want, but the other side of it is some script that could be run daily, or hourly or something that will randomly change the name of some of my trailers so the ASX picks them up.
If all my trailers are named to match the film they represent, such as "28 Days Later_trailer.mpg", the ASX won't pick them up. But if I have an hourly script that randomly renames some of them to 'trailer1.mpg', 'trailer2.mpg' etc. then the ASX will pick up the trailers.

I guess the script could first delete the existing 'trailer1.mpg', 'trailer2.mpg', 'trailer3.mpg' and 'trailer4.mpg', makes copies of 4 random trailers, then rename them to 'trailer1.mpg', 'trailer2.mpg', 'trailer3.mpg' and 'trailer4.mpg'. If i set this to run hourly or whatever, it would mean that nearly everytime i watch a film it would give me different trailers from my collection. Does that explain it better?


Yes I understand, but while I have not used it, isn't that what scales php script does in the first post? I thought it did the random rename of trailers, then you can use task scheduler to run as often as you'd like. My script was originally intended to do his step #8 only. Let me know if that helps.

Not only do I need to fix teh () issue in names, but I think I need to quickly change teh creation of the asx file to remove the actual movie. I will leave directions to those that want multiple intro's in theirs so they can edit it as desired. I also need a better way to keep the script versions..maybe just keep editing my original post with all the variations of the script.
casperinmd
 
Posts: 122
Joined: Mon Mar 23, 2009 2:07 pm

Re: How to add intros via asx file and my random intro generator

Postby daavid1 » Thu Jun 18, 2009 6:33 pm

Thanks Casper, Scales php script restricts us to certain things. It is a great starting point, but I think something that can be stuck into a BAT file like your other script would be perfection.

It's no major issue for me, so no worries if you're busy or whatever, but if you do get a chance it'd be much appreciated.

Thanks a millio nfor all of your work on the 'step 8' tool anyway, it saved me soooooo much work ;)
daavid1
 
Posts: 166
Joined: Sun Jan 11, 2009 1:04 pm

Re: How to add intros via asx file and my random intro generator

Postby scales » Fri Jun 19, 2009 12:21 am

Well I saw the issue with the movie filename in the asx but I just ripped that line out and added my own for my second intro.
I will look into creating a script that allows the user to set paramaters to suit their needs.

I must say thanks to Casper.. for the great little script. however I change a few things that i understood.

I have the intros and randomize r working to full effect. It is awesome.... every time I play a new movie I am blasted with an awesome insanely loud Dolby or DTS intro :) its fun just to cruise through the collection to see what intro is next LOL
scales
 
Posts: 13
Joined: Wed Apr 01, 2009 12:04 am

PreviousNext

Return to Tutorials



Who is online

Users browsing this forum: No registered users and 1 guest