Understanding Xant www

xlobby docs (works in progress)

Understanding Xant www

Postby Marbles_00 on Sun Oct 11, 2009 6:35 am

Wrote this quick document on aiding in understanding how to make the most out of using Xant.

http://www.xlobby.com/files/Marbles_00/Understanding%20Xant.pdf

Enjoy.
Marbles_00
 
Posts: 1867
Joined: Wed Apr 06, 2005 12:44 pm
Location: Canada

Re: Understanding Xant www

Postby samsonlov on Sun Oct 11, 2009 9:07 am

Thanks.
That's pretty clear.
:)
samsonlov
 
Posts: 220
Joined: Thu Sep 25, 2008 1:39 am
Location: Los Angeles, CA

Re: Understanding Xant www

Postby scottw on Mon Oct 12, 2009 1:33 pm

Nice tutorial Marbles!!!!

One thing I have done which may or may not help you since we are doing our movies differently is to have the URL field automatically filled in.

I rip all my movies and then convert them to MKV and name the file exactly what I want to show in ANt's Original Title field. I also store all of my movies in the same folder/share on my Unraid server. Then when I import the move into ANT it takes the name of the file and puts it in that field (Original title) automatically. Then I customized the IMDB script like this:
Code: Select all
  MovieURL := '\\tower\\Movies\\' + MovieName + '.mkv';

which will automatically fill in the URl field with the right path.
Again may not help you but may help others :D

Another thing I do is to pull in the movie rating into the borrower field (but you can use any field) with this in the DVDEmpire script:
Code: Select all
  // Rating
  LineNr := FindLine('<b>Rating:</b>', Page, 0);
  if LineNr > -1 then
  begin
    Line := Page.GetString(LineNr);
    Value := + Trim(TextBetween(Line, '<b>Rating:</b>', '<br />'));
    SetField(fieldBorrower, Value);
  end;


This may be already in the DVDEmpire script...I know I edited the IMDB one but don't remember if I had to change this one.
IMDB did not have ratings for all of the movies but DVDEmpire seems to have more so I switched to them for that and the covers.

Hope this helps someone.
scottw
 
Posts: 774
Joined: Mon Feb 06, 2006 4:21 pm
Location: Glen Burnie, Maryland

Re: Understanding Xant www

Postby Marbles_00 on Mon Oct 12, 2009 1:53 pm

Good tips. Thanks scott.

The ultimate for me, if I can figure it out is to set the file location and file type depending on the value entered in the Borrower field.

If Borrower is "children" or "mature" then fill the URL with \\tower\disk2\"children" or "mature"\MovieName\Video_TS\video_ts.ifo

If Borrower is "hidef" then fill the URL with \\tower\disk2\"hidef"\MovieName\$.mkv

If Borrower is "recordedtv" then fill the URL with \\tower\disk1\"recordedtv\MovieName\$.mpg

Right now, I don't know how to fill the URL with fieldBorrower (gives an error when running the script), and I don't know how to define the Borrower field.

Anyone willing to take a crack using the DVDEmpire script. :wink:
Last edited by Marbles_00 on Mon Oct 12, 2009 5:00 pm, edited 1 time in total.
Marbles_00
 
Posts: 1867
Joined: Wed Apr 06, 2005 12:44 pm
Location: Canada

Re: Understanding Xant www

Postby scottw on Mon Oct 12, 2009 4:40 pm

Ok so I was inspired to play around with the scripts to see what I could do. Marbles hope you don't mind me posting this here :D

I wanted to be able to use an un-used field in ANT similar to how you are using for Childrens movies and Adult movies but determined by the movies rating. This way I can "filter" on that field for my daughters movies.

Basically I added to the DVDEmpire script that if the movies rating is G or PG the "Translated Title" field (which I do not use) will show "Childrens", if it's PG-13, R, NR or nothing it is tagged as "Adult".

Here is what I added:

At around line 30 of the script it shows:
Code: Select all
var
  MovieName: string;
  extras: string;

I just added ( my categoryName var) a line to the bottom to look like this:
Code: Select all
var
  MovieName: string;
  extras: string;
  CategoryName: string;


Then at around line 231 is the Rating section, mine use to look like this:
Code: Select all
  // Rating
  LineNr := FindLine('<b>Rating:</b>', Page, 0);
  if LineNr > -1 then
  begin
    Line := Page.GetString(LineNr);
    Value := + Trim(TextBetween(Line, '<b>Rating:</b>', '<br />'));
    SetField(fieldBorrower, Value);
  end;

Yours may look slightly different since I changed my to use the "fieldBorrower" field...I think the default is Comments.
Either way I just added my script addition after SetField(fieldBorrower, Value);
so the final looks like this:
Code: Select all
  // Rating
  LineNr := FindLine('<b>Rating:</b>', Page, 0);
  if LineNr > -1 then
  begin
    Line := Page.GetString(LineNr);
    Value := + Trim(TextBetween(Line, '<b>Rating:</b>', '<br />'));
    SetField(fieldBorrower, Value);
    if Value = 'G' then
      CategoryName := 'Childrens';
    if Value = 'PG' then
      CategoryName := 'Childrens';
    if Value = 'PG-13' then
      CategoryName := 'Adult';
    if Value = 'R' then
      CategoryName := 'Adult';
    if Value = 'NR' then
      CategoryName := 'Adult';
    if Value = '' then
      CategoryName := 'Adult';
       SetField(fieldtranslatedTitle, CategoryName );
  end;


It seems to work great!!!

The only thing I wish you could do, and maybe you can, is to be able to run one script from another or 2 at once. Right now I have to run the IMDB script and then run the DVDEmpire script to get everything else. It would be nice to only have to run one.

Marbles,
Are you running yours one at a time?

Thanks,
Scott
scottw
 
Posts: 774
Joined: Mon Feb 06, 2006 4:21 pm
Location: Glen Burnie, Maryland

Re: Understanding Xant www

Postby Marbles_00 on Mon Oct 12, 2009 5:06 pm

We were both typing at the same time...I appended my post above, but may be lost with yours...but:

The ultimate for me, if I can figure it out is to set the file location and file type depending on the value entered in the Borrower field.

If Borrower is "children" or "mature" then fill the URL with \\tower\disk2\"children" or "mature"\MovieName\Video_TS\video_ts.ifo

If Borrower is "hidef" then fill the URL with \\tower\disk2\"hidef"\MovieName\$.mkv

If Borrower is "recordedtv" then fill the URL with \\tower\disk1\"recordedtv\MovieName\$.mpg

Right now, I don't know how to fill the URL with fieldBorrower (gives an error when running the script), and I don't know how to define the Borrower field.

Anyone willing to take a crack using the DVDEmpire script.


And to answer your question, I only run the DVDEmpire script. I don't use any other. I'm not one for huge amounts of details. Just give me my title, coverart, and ratings, I'm happy. Especially when using fanart in the background, to much details in the foreground will just swamp the screen with too much. And depending on the coverart image, could make reading very difficult.
Marbles_00
 
Posts: 1867
Joined: Wed Apr 06, 2005 12:44 pm
Location: Canada

Re: Understanding Xant www

Postby scottw on Mon Oct 12, 2009 5:10 pm

Let me give it a try.
scottw
 
Posts: 774
Joined: Mon Feb 06, 2006 4:21 pm
Location: Glen Burnie, Maryland

Re: Understanding Xant www

Postby Marbles_00 on Mon Oct 12, 2009 5:17 pm

Then filling in the Media Label tag for fanart location would be trivial. It makes things so much easier to just have to enter the title and borrower, and everything else just fills out. I understand most of the concepts, except everytime I add fieldBorrower or the sort, I'm getting an error in running the script.
Marbles_00
 
Posts: 1867
Joined: Wed Apr 06, 2005 12:44 pm
Location: Canada

Re: Understanding Xant www

Postby scottw on Mon Oct 12, 2009 6:00 pm

Ok I am getting there.

Need to add the VAR's:
MovieRating: string;
URLName: string;

Original:
Code: Select all
var
  MovieName: string;
  extras: string;


After:
Code: Select all
var
  MovieName: string;
  extras: string;
  MovieRating: string;
  URLName: string;
  MovieName2: string;


Then right after the "//Rating" section add this:
Code: Select all
  begin
MovieName2 := MovieName;
MovieName2 := StringReplace(MovieName2, '+', ' ');
MovieRating := GetField(fieldBorrower);
    if MovieRating = 'children' then
      URLName := '\\tower\disk2\' + MovieRating + '\' + MovieName2 + '\Video_TS\video.ifo';
    if MovieRating = 'mature' then
      URLName := '\\tower\disk2\' + MovieRating + '\' + MovieName2 + '\Video_TS\video.ifo';
    if MovieRating = 'hidef' then
      URLName := '\\tower\disk2\' + MovieRating + '\' + MovieName2 + '\' + MovieName2 + '.mkv';
    if MovieRating = 'recordedtv' then
      URLName := '\\tower\disk1\' + MovieRating + '\' + MovieName2 + '\' + MovieName2 + '.mpg';
       SetField(fieldURL, URLName );
 end;


Now this is not finished or working 100% correctly. I assume the "$" would be the "Original Title" in Ant, right? ---------edit---this is fixed now
Also I am having some trouble where there are spaces in the "MovieName", it adds +'s to the spaces. I know this is just my inexperience and will figure it out but just wanted to show you what I had so far.---------edit---this is fixed now

PLEASE back up your DB first....I am a newbie at this and don't want to be responsible for any mess-ups :lol:

Also if you want to try it you have to check the box for URL in the modifiable fields when you go to run the script.

I attached my script if you want to try it....it is not a zip file...just rename the .zip to .ifs

Let me know,
Attachments
dvdempiremarb.zip
(12.99 KiB) Downloaded 437 times
Last edited by scottw on Mon Oct 12, 2009 7:57 pm, edited 1 time in total.
scottw
 
Posts: 774
Joined: Mon Feb 06, 2006 4:21 pm
Location: Glen Burnie, Maryland

Re: Understanding Xant www

Postby Marbles_00 on Mon Oct 12, 2009 7:32 pm

Good job scott. I would never have thought of doing it that way. It basically works, but a little cleanup with the structure and this will be awesome. This has made you the fore-runner for Ant scripts, and when the next time DVDEmpire changes something on their website, and the script breaks, you know who I'll be calling :wink: :lol:

The "$" is just the file name, which will be the MovieName variable repeated again. Only thing is I have to go through my directory structure to change them all to suit. Well I have something to do tonight when I want to take a break from building a mclapp-4 bowtie antenna.
Last edited by Marbles_00 on Mon Oct 12, 2009 7:34 pm, edited 1 time in total.
Marbles_00
 
Posts: 1867
Joined: Wed Apr 06, 2005 12:44 pm
Location: Canada

Re: Understanding Xant www

Postby scottw on Mon Oct 12, 2009 7:34 pm

Yeah yeah yeah... :lol:

I am still working on cleaning it up...let me know if you get it figured out first.
scottw
 
Posts: 774
Joined: Mon Feb 06, 2006 4:21 pm
Location: Glen Burnie, Maryland

Re: Understanding Xant www

Postby scottw on Mon Oct 12, 2009 7:59 pm

Marbles,

I figured out the problem and fixed it in the post where I explained everything....3 posts up. I changed the "code" in that post to reflect the changes.
I also re-uploaded my DVDEmpire script (on that same post) if you want to test it---just change the extension to .ifs

This "should" work. :lol:


Let me know!!!
scottw
 
Posts: 774
Joined: Mon Feb 06, 2006 4:21 pm
Location: Glen Burnie, Maryland

Re: Understanding Xant www

Postby Marbles_00 on Mon Oct 12, 2009 9:04 pm

I had pretty similar to yours, only I just placed it all in the //URL section, and I'm using MovieName, not MovieName2. Basically it looks like this:
Code: Select all
// URL
   begin
   MovieRating := GetField(fieldBorrower);
       if MovieRating = 'children' then
         URLName := '\\tower\disk1\' + MovieRating + '\' + MovieName + '\Video_TS\video_ts.ifo';
       if MovieRating = 'mature' then
         URLName := '\\tower\disk1\' + MovieRating + '\' + MovieName + '\Video_TS\video_ts.ifo';
       if MovieRating = 'hidef' then
         URLName := '\\tower\disk2\' + MovieRating + '\' + MovieName + '\' + MovieName + '.mkv';
      if MovieRating = 'recordedtv' then
         URLName := '\\tower\disk1\' + MovieRating + '\' + MovieName + '\' + MovieName + '.mpg';
      SetField(fieldURL, URLName );
    end;


Then I added a MediaLabel string with the rest of the string definitions, then added this code to automatically fill in the Media Label field:
Code: Select all
//Media Label
    begin
    MovieRating := GetField(fieldBorrower);
        if MovieRating = 'children' then
           MediaLabel := '\\tower\disk1\' + MovieRating + '\' + MovieName + '\fanart.jpg';
        if MovieRating = 'mature' then
           MediaLabel := '\\tower\disk1\' + MovieRating + '\' + MovieName + '\fanart.jpg';
        if MovieRating = 'hidef' then
           MediaLabel := '\\tower\disk2\' + MovieRating + '\' + MovieName + '\fanart.jpg';
        if MovieRating = 'recordedtv' then
           MediaLabel := '\\tower\disk1\' + MovieRating + '\' + MovieName + '\fanart.jpg';
        SetField(fieldMedia, MediaLabel );
    end;


So far during test it has worked. I'm going to try it out on the system tonight. Thanks for all your help....I'll have to update the document with this.
Marbles_00
 
Posts: 1867
Joined: Wed Apr 06, 2005 12:44 pm
Location: Canada

Re: Understanding Xant www

Postby scottw on Mon Oct 12, 2009 10:19 pm

Cool.
Yeah they are almost exactly the same...don't think it matters where you put it. Now the only reason I used MovieName2 is because I could not get MovieName to show spaces right. For example Gone in 60 Seconds showed on the URL line as Gone+in+60+Seconds, did your test have any spaces in the name?

Hopefully it worked fine for you as the MovieName2 was just a bad hack attempt ...but did work :D

Let me know the results!!!!
scottw
 
Posts: 774
Joined: Mon Feb 06, 2006 4:21 pm
Location: Glen Burnie, Maryland

Re: Understanding Xant www

Postby Marbles_00 on Tue Oct 13, 2009 1:14 pm

Yeah, there's something with this new code that Ant doesn't like. Some of the entries would go download, but then it would just sit there with the script screen open, and nothing was happening. I tried with both my code, and then yours, and same result. One example was "The Kingdom". It originally was entered as "Kingdom, The", so I thought that my have been the problem. Not to sure what is going on. Thought it may be because of two words, or two words separated by a comma, but I think it also happened with titles like "Shrek" as well. I didn't spend too much time on it last night...got right involved with building the Mclapp-4 antenna. Boy sure easier to build than the Gray-Hoverman, hopefully it works well.
Marbles_00
 
Posts: 1867
Joined: Wed Apr 06, 2005 12:44 pm
Location: Canada

Next