Movie rating - decimals?

Comments on existing version & Suggestions for future versions. If you want a new feature suggest it here. Discussions about beta versions also come in this section.
Rod

Movie rating - decimals?

Post by Rod »

Ok, I have to admit, I'm not AMC user myself, but the ONLY reason keeping me from switching to AMC (i've tried it) from XMM is the fact that movie rating in AMC is stored as an integer. I have a pretty decent movie collection, and believe me, there is a difference between movies that are ranked 7.0 on IMDB and ones that are ranked 7.9. I want to keep that info in my database, but when it all becomes just a '7' it means I need to go and manually add that .X somewhere. Not cool. Would it be hard to implement?
antp
Site Admin
Posts: 9638
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

I do not want to change it in current version :/
I will change it in the next version, but that will not be before several weeks/months, I can't give any date.
If you want I can make for you a modified version of the DivxManager import, so the full rating is also stored in another field (e.g. in the comments field).
timmy

movie rating

Post by timmy »

I also suggest making graphic movie rating like stars or something... maybe not much, but looks cool :)

cant wait till next version :)
antp
Site Admin
Posts: 9638
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

That was in 1.x versions. I do not know yet if I will add that as an option.
kolia
Posts: 56
Joined: 2003-02-19 16:02:46

Post by kolia »

Hi Antoine!

would it be easy for you to re-compile AMC so that the Rating field can accept values from 1-100 instead of 1-10?

this would be the easy way to satisfy all of us who can't wait for it to be implemented in AMC4.0 since it would be easy to do the folowing:

-keep the x.y imdb rating format as xy (i.e. 73 for 7.3) by deleting the " / 10" in the //Rating section of the imdb script
-sort by (full) rating
-keep the small size of amc catalogs (rating is still an integer)

so, could you Pleeeeease put a link to the re-compiled .exe so that anyone who's interested can download it? (there would be many, believe me!!!)
(by doing this i think AMC will gain many new users (at least 3 of my friends who believe this to be a main feature AMC is lacking)

Thanks in advance ;)

Impatiently awaiting your answer!
antp
Site Admin
Posts: 9638
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

I could modify it but what about the compatibility with older version and existing scripts ?
Guest

Post by Guest »

All I meant was to modify it and all of us who want this feature can simply modify their existing scipts to get xy instead of round(x.y)

As for compatibility with older versions I can't understand where the problem is. it will still be an integer, the form of the catalog won't be changed, and if it would still cause a problem, one could always adjust it back to 1-10 by running a script that does a round(GetField(fieldRating)/10) :)
antp
Site Admin
Posts: 9638
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Yes, you're right ;)

Well, I'll maybe add this as an option next time I update the program.
Until then, here is a modified version for 0-100 rating :
ftp://ftp2.antp.be/antp/temp/MovieCatal ... Rating.zip
(untested)
kolia
Posts: 56
Joined: 2003-02-19 16:02:46

Post by kolia »

Thanks, I'lm getting it right now. I'll test it out and send you the resuls ;)
kolia
Posts: 56
Joined: 2003-02-19 16:02:46

Post by kolia »

ok, consider it tested :D

it works just fine, the only thing I haven't tested is to import from non amc catalogs to see if the import dll should be adjusted (amc import works fine, and I'll test the (divxmanager or xmm) import later this day to give you an answer. as for BaseDVDivx and Origons I haven't ever used those so it's up to someone else)

all that one has to do now is
1) in the imdb script he's using
  • find the "// Rating" block and
    replace "Value := IntToStr(Round(StrToInt(StrGet(Line, BeginPos), 0) + (StrToInt(StrGet(Line, BeginPos + 2), 0) / 10)));"
    with "Value := StrGet(Line, BeginPos) + StrGet(Line, BeginPos + 2);"
2) run the script below to 'fix' his current catalog

Code: Select all

// GETINFO SCRIPTING
// to replace rating with 2digit rating (uses URL if found) - kolia

program IMDb_replace_rating;

var
  MovieName: string;
  MovieURL: string;

function FindLine(Pattern: string; List: TStringList; StartAt: Integer): Integer;
var
  i: Integer;
begin
  Result := -1;
  if StartAt < 0 then
    StartAt := 0;
  for i := StartAt to List.Count-1 do
    if Pos(Pattern, List.GetString(i)) <> 0 then
    begin
      Result := i;
      Break;
    end;
end;

procedure AnalyzePage(Address: string);
var
  Page: TStringList;
begin
  Page := TStringList.Create;
  Page.Text := GetPage(Address);
  if pos('<title>IMDb', Page.Text) = 0 then
  begin
    AnalyzeMoviePage(Page)
  end else
  begin
    PickTreeClear;
    AddMoviesTitles(Page, '<b>Exact Matches</b>');
    AddMoviesTitles(Page, '<b>Partial Matches</b>');
    AddMoviesTitles(Page, '<b>Approximate Matches</b>');
    if PickTreeExec(Address) then
      AnalyzePage(Address);
  end;
  Page.Free;
end;

function FindValue(BeginTag, EndTag: string; Page: TStringList; var LineNr: Integer; var Line: string): string;
var
  BeginPos, EndPos: Integer;
  Value: string;
begin
  Result := '';
  Value := '';
  BeginPos := Pos(BeginTag, Line);
  if BeginPos > 0 then
  begin
    BeginPos := BeginPos + Length(BeginTag);
    if BeginTag = EndTag then
    begin
      Delete(Line,1,BeginPos-1);
      BeginPos := 1;
    end;
    EndPos := pos(EndTag, Line);
    while ((EndPos = 0) and (LineNr < Page.Count-1 )) do
    begin
      Value := Value + copy(Line, BeginPos, Length(Line) - BeginPos);
      // Next Line
      BeginPos := 1;
      LineNr := LineNr + 1;
      Line := Page.GetString(LineNr);
      if Value = '' then
        Exit;
      EndPos := Pos(EndTag, Line);
    end;
    Value := Value + copy(Line, BeginPos, EndPos - BeginPos);
   end;
  Result := Value;
end;

procedure AnalyzeMoviePage(Page: TStringList);
var
  Line, Value, Value2, FullValue: string;
  LineNr, BeginPos, EndPos, DescrImport: Integer;
  AllTitles: TStringList;
begin
  MovieURL := 'http://imdb.com/title/tt' + copy(Page.Text, pos('<a href="/title/tt',Page.Text)+19, 7);

  // Rating
  LineNr := FindLine('User Rating:', Page, 0);
  if LineNr > -1 then
  begin
    Line := Page.GetString(LineNr + 4);
    if Pos('/10', Line) > 0 then
    begin
      BeginPos := pos('<b>', Line) + 3;
      Value := StrGet(Line, BeginPos) + StrGet(Line, BeginPos + 2);
      SetField(fieldRating, Value);
    end;
  end;

  DisplayResults;
end;



procedure AddMoviesTitles(Page: TStringList; Tag: string);
var
  Line: string;
  LineNr: Integer;
  MovieTitle, MovieAddress: string;
  StartPos: Integer;
begin
  LineNr := FindLine(tag, Page, 0);
  if LineNr > -1 then
  begin
    Line := Page.GetString(LineNr);
    HTMLRemoveTags(Line);
    PickTreeAdd(Trim(Line), '');
    LineNr := LineNr + 5;
    Line := Page.GetString(LineNr);
    repeat
      StartPos := pos('href="', Line) + 5;
      Delete(Line, 1, StartPos);
      MovieAddress := Copy(Line, 1, pos('">', Line) - 1);
      StartPos := Pos('">', Line) + 2;
      MovieTitle := Copy(Line, StartPos, Pos('</a>', Line) - StartPos);
      HTMLDecode(Movietitle);
      PickTreeAdd(MovieTitle, 'http://us.imdb.com' + MovieAddress);
      LineNr := LineNr + 2;
      Line := Page.GetString(LineNr);
    until Pos('</table>', Line) > 0;
  end;
end;

begin
if CheckVersion(3,4,0) then
begin
  if GetField(fieldURL) = '' then
  begin
    MovieName := GetField(fieldOriginalTitle);
    if MovieName = '' then
     MovieName := GetField(fieldTranslatedTitle);
    if MovieName = '' then
     MovieName := Input('IMDb Import', 'Enter the title of the movie:', MovieName);
    if MovieName <> '' then
    begin
     AnalyzePage('http://us.imdb.com/Tsearch?title='+UrlEncode(MovieName));
    end;
  end
  else
  begin
    AnalyzePage(GetField(fieldURL));
  end;
end else
  ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.4.0)');
end. 
You could also post this to the Script section if you'd like.
I didn't take the liberty to do it since I didn't have your OK on re-posting the link to the modified exe (till it's fully tested that is...) :)
antp
Site Admin
Posts: 9638
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

no problem for posting the link somewhere else as long as you mention that I do not garantee that it works ;)
I think that in next version (if I continue on 3.x, see here) I will add an option to specify if it is 10 or 100, and the script should not be modified : depending if it is 10 or 100 the program should know if it has to divide or not the rating ;)
Same for importation.
That's why the version I posted here is only a temporary solution.
kolia
Posts: 56
Joined: 2003-02-19 16:02:46

Post by kolia »

Just to keep you informed...
I tried the divxmanager import and it works as it should (of course the rating value is a rounded 0-10 number)

You already mentioned the way you're going to fix this and it can wait until the next version...

see ya :grinking:
antp
Site Admin
Posts: 9638
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

I added the option that I said about rating on 10 or 100.
It is called "Rating in percent" and is located in Tools -> Preferences -> Movie Info.
here is a version with this option :

ftp://ftp2.antp.be/antp/temp/amc350.rar

It uses a new file format, so the files made with this version cannot be open with old versions (rating is now stored as 0-100 value, and divided by 10 if needed).

When you open your old file the ratings are multiplicated by 10, so you will have to divide them by script.

For the scripts :
fieldRating = value in 0-10 format
fieldRatingPercent = value in 0-100 format
(so the scripts have to be updated to be able to use this new field name)

For the import/export :
depends of what was specified in the option
exception : for HTML export,
$$ITEM_MOVIERATING = value in 0-10 format
$$ITEM_MOVIERATINGPERCENT = value in 0-100 format

For the printing :
same system than for HTML export, the RatingPercent field is located in "virtual fields"

It would be nice if people could test it, especially the feature that depend of the fields (script, export, import, print, etc.)
kolia
Posts: 56
Joined: 2003-02-19 16:02:46

Post by kolia »

ok, antoine. I'll test it later this afternoon and tell you my opinion... ;)
kolia
Posts: 56
Joined: 2003-02-19 16:02:46

Post by kolia »

antoine, here are some bugs I've found...
1)-when changing from "%" to "/10" the 2nd digit is lost by rounding (e.g. 72% to 7/10 (to 70%))
2)-the movie that has the focus when doing the change is not changed (thus going from 72% to 10/10 or 7/10 to 7%)
3)-for DivXManager Import: rating is NOT multiplied by 10
4)-script: you can read but not write to fieldRatingPercent (e.g. "SetField(fieldRatingPercent, '79');" does not alter the rating value)
5)-AMC Import worked fine (older amc catalogs *10, amc 3.5 catalogs not)
6)-when in % mode, reading from xml (which only saves field rating) multiplies all by 10

let me say that I think your approach is wrong!
In my opinion, changing rating values to 0-100 is enough to satisfy everyone
those who want 0-10 can still continue using it, those who want 0-100 can easily use it instead
this way, you shouldn't need to complicate things further by using virtual fields, new formats, and so on...
nevertheless, if you still want to use the dual rating, instead of making your life difficult with storing one time % and the other /10, my opinion is that you should just save the % rating and round to /10 for display (only) if the rating option is unchecked
also, no different script should be used for each case of rating

In closing, I just want to say that the above are just suggestions...
I'm sure you above all know better what is best for the great program you put together to make it even better ;)
antp
Site Admin
Posts: 9638
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

1) what else could I do ?
2) ok, I saw this bug but I could not reproduce it, now I know when it happens
3) yes, I haven't modified the DLL that imports data (amdimport.dll)
4) strange, I will check that
5) ok
6) I'll check that

The rating is always saved in % now. It is only changed for display (and when entering the new value when in /10 mode)

The problems are the following :
- keeping only the new system (%) breaks compatibility with old templates and scripts. They all have to be modified.
- keeping both systems is difficults, and not especially the good solution.

Maybe I should take the first one, and now keep a /10 system. Only have an option so the up/down arrows jumps 10 by 10 and forces rounding values to a 0-ending value.

Another solution would be to use a decimal number (for input and output, but stored in file as %). It will reduce the possible problems : no compatibility problem with old scripts or templates since it is still 0-10. The new scripts can pass a value like '7.2' where an old script would only pass '7'.
Guest

Post by Guest »

1)you can save in % regardless of how it is shown
2-6) ok, waiting for the modified version so that I can re-check
Another solution would be to use a decimal number (for input and output, but stored in file as %). It will reduce the possible problems : no compatibility problem with old scripts or templates since it is still 0-10. The new scripts can pass a value like '7.2' where an old script would only pass '7'.
I like this solution! :grinking:
[there shouldn't be any problem even with templates that assume rating to be 1-10 (i.e. to show it with stars)]
antp
Site Admin
Posts: 9638
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Anonymous wrote:1)you can save in % regardless of how it is shown
That's what is done currently. But if it is displayed in /10 I have to get this value and multiply it by 10.
Even if you do not modify a field of a movie, if the fields area of the window was focused since last save each movie is saved when switching to a different movie. I have to fix that to save only if current movie may have been modified.
Anonymous wrote: I like this solution! :grinking:
[there shouldn't be any problem even with templates that assume rating to be 1-10 (i.e. to show it with stars)]
ok, I just hop that I can display a decimal value with the up/down fields :/
When I've few time I will quickly fix current version and keep the "%" in the main window display, but in the future it will be displayed as decimal there too.
kolia
Posts: 56
Joined: 2003-02-19 16:02:46

Post by kolia »

That's what is done currently. But if it is displayed in /10 I have to get this value and multiply it by 10.
I hope that doesn't mean losing the extra digit...

I think you should focus your efforts on always using '7.2' format, treating the value as '72', even convert single digits entered as 7 to 7.0 if you think this could be usefull, so as to treat all ratings equally from there on
(the above may actually mean not having the ability to save <1.0 but I haven't seen a rating below 1, at least in IMDB... (don't know for other sites that possibly use /5 rating :/ ))

oh well, just throwing out my thoughts... :wink:
antp
Site Admin
Posts: 9638
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

kolia wrote: I think you should focus your efforts on always using '7.2' format, treating the value as '72',
that's what I will do.
And for people that do not want to have the second digit I'll put an option "trunc rating" to force second decimal to 0 in main window, and hide it in exports ;)
Post Reply