Number of Votes

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.
Post Reply
pyro
Posts: 4
Joined: 2008-10-18 10:20:35

Number of Votes

Post by pyro »

Hi,

I've been wondering if there's a way to import the number of votes and have it shown in the catalog in any way?
I'm using the IMDB script if it matters.

If it's impossible I'd really like such a feature to be added....

By the way...
I've been using AMC for about 4 years now, and absolutely loving it!
So a huge thanks flies out to the author :)
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Hi,

Thanks.

About the number of votes, I thought that it was already the case (or that there was an option for it) but I guess that I mixed it with another script in my mind then.
Technically it is possible and - I guess - not difficult. It just requires that someones adds it to the script to include it in comments for example...
pyro
Posts: 4
Joined: 2008-10-18 10:20:35

Post by pyro »

Hmm... for now I came up with this solution:

Code: Select all

  // Votes Number
  if CanSetField(fieldMediaType) then
  begin
    Value := TextBetween(PageText, '<a href="ratings" class="tn15more">', '</a>');
    SetField(fieldMediaType, Value);
  end;
As you can see it adds it to the MediaType field which I didn't use anyway, seems to work...
Hurray for me, my first script edit (if you can even call it that way), and I don't know shit about programming so I'm kinda excited :lol:
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

pyro wrote:and I don't know shit about programming so I'm kinda excited :lol:
well done ;) it is probably a good way to start to learn, by doing small changes like that
bad4u
Posts: 1148
Joined: 2006-12-11 22:54:46

Post by bad4u »

I added your code (with a new script option 'UserRatings' and some additional code) to IMDB script. User ratings with number of votes can be optionally imported to field Media Type or field comments. Thanks ;)

New IMDB script version 3.39: http://www.bad4u.741.com/full/IMDB.ifs (do NOT click, copy link into a NEW browser window !)
pyro
Posts: 4
Joined: 2008-10-18 10:20:35

Post by pyro »

Nicely done bad4u, thanks.

I need another small assistance please.
I want to have a "Last Update" line in my template for each movie (this is because I'm going to go through each movie in my catalog to have the number of votes added).
For this I need the script to add the current system date and time to an empty field (e.g. subtitles), at the time of fetching info.
As you understand it's not like the "Date Added" feature.

Could anyone help me out and write a few lines that do this?

Thanks in advance.
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Value := DateToStr(Date);
Value := TimeToStr(Time);
Value := DateTimeToStr(Now);

Date, Time and Now are function which return respectively the current date, time and date+time.

Date/Time functions were added lately, so they only works in latest AMC release (3.5.1, maybe even only 3.5.1.1)

Code: Select all

function EncodeDate(Year, Month, Day: Word): TDateTime;
function EncodeTime(Hour, Min, Sec, MSec: Word): TDateTime;
procedure DecodeDate(DateTime: TDateTime; var Year, Month, Day: Word);
procedure DecodeTime(DateTime: TDateTime; var Hour, Min, Sec, MSec: Word);
function Date: TDateTime;
function Time: TDateTime;
function Now: TDateTime;
function DateToStr(DateTime: TDateTime): string;
function TimeToStr(DateTime: TDateTime): string;
function DateTimeToStr(DateTime: TDateTime): string;
function StrToDate(S: string): TDateTime;
function StrToDateDef(S: string; Default: TDateTime): TDateTime;
function StrToTime(S: string): TDateTime;
function StrToTimeDef(S: string; Default: TDateTime): TDateTime;
function StrToDateTime(S: string): TDateTime;
function StrToDateTimeDef(S: string; Default: TDateTime): TDateTime;
bad4u
Posts: 1148
Joined: 2006-12-11 22:54:46

Post by bad4u »

Should be on AMC version 3.5.1.1 only (after I tested it with no success, I realized still having 3.5.1.0 installed for my default catalogs ^^)
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Or maybe even 3.5.1.2 (current dev version) but I think that I released one with these new functions as I remember that I had to re-upload few scripts to fix a problem: some scripts used a "date" variable which was now in conflict with the "date" function.
pyro
Posts: 4
Joined: 2008-10-18 10:20:35

Post by pyro »

Thanks so much guys, the Value := DateTimeToStr(Now); thingy is exactly what I needed!
Post Reply