PtokaX forum

Lua 5.3/5.2/5.1 Scripts (for PtokaX 0.4.0.0 and newer) => Request for scripts => Topic started by: bofh19 on 18 August, 2010, 14:51:46

Title: imdb rating only offline
Post by: bofh19 on 18 August, 2010, 14:51:46
there is already a script that shows imdb info.. but if net is slow that script hangs the hub untill the result is out ..

we can get imdb database in text from ftp://ftp.fu-berlin.de/pub/misc/movies/database/
this link has all the rating of all movies ftp://ftp.fu-berlin.de/pub/misc/movies/database/ratings.list.gz

the rating is of this format...
New  Distribution  Votes  Rank  Title
      0000000115  510017   9.1  The Shawshank Redemption (1994)
      0000000015  404721   9.1  The Godfather (1972)
      0000000016  148421   9.0  Inception (2010)
      0000000125  240477   9.0  The Godfather: Part II (1974)
      0000000124  156390   8.9  Il buono, il brutto, il cattivo. (1966)
      0000000124  410855   8.9  Pulp Fiction (1994)
      0000000124  271540   8.9  Schindler's List (1993)
      0000000123  116114   8.8  12 Angry Men (1957)
      0000000123  210348   8.8  One Flew Over the Cuckoo's Nest (1975)
      0000000124  273342   8.8  Star Wars: Episode V - The Empire Strikes Back (1980)
      0000000115  456439   8.8  The Dark Knight (2008)
      0000000125   58198   8.8  Toy Story 3 (2010)
      0000000115  358148   8.8  The Lord of the Rings: The Return of the King (2003)
      0000000124  316962   8.8  Star Wars (1977)
      0000000124   95128   8.8  Shichinin no samurai (1954)
      0000000124  165453   8.7  Casablanca (1942)
      0000000123  225196   8.7  Goodfellas (1990)


just open the ratings.list file and get rating that is offline and will be fast...can be expanded to actors also  ???
can i get a script which when typed !imdbrating star wars can show rating and votes of all movies and movie names which have star wars in their name

see that some movies like Star Wars and lord of rings have a : in their name

i did try to write the script..but got stuck at string.find part..not able to move forward  :(
Title: Re: imdb rating only offline
Post by: bofh19 on 20 August, 2010, 20:42:32
can some one help me with this
function(sArgs)

-- for line in io.lines(Cfg.Path..Cfg.File) do

  line = "0000001222   32586   8.4  The Treasure of the Sierra Madre (1948)"
if string.find(line,"The")
then
sMsg = sMsg.."found"..line.."\n"
end
--end
end


in the
if string.find(line,"The")
it returns true because "The" is in the variable line

but when i send sArgs as "The" to the function and use
if string.find(line,sArg)

this always returns false....
what is the mistake im doing ?
Title: Re: imdb rating only offline
Post by: Dessamator on 23 August, 2010, 00:33:32
Hi,

First of all check if the sArg really contains what you think it does, secondly,
function (sArgs)
string.find( line , sArg)

sArgs is not equal to  sArg, different variables.

Title: Re: imdb rating only offline
Post by: bofh19 on 23 August, 2010, 20:54:32
yea i got that...i did not filter the  | character that comes..figured that out .. thanks btw  :)