Hi,
Would it be possible to improve imdbpy2sql script so that episodes
production_year field contains correct episode year, which is calculated
by episode movie_info release date?
I am not sure how episode production year is calculated, but it is
wrong and incomplete for almost every TV show.
Here you can run this select (example House M.D.) and see that
production_date differs a lot from real episode production date:
SELECT
title.id, production_year, (select max(SUBSTRING(info,
'([0-9]{4})')::int) from movie_info where movie_id=title.id and
info_type_id=16) as real_year
FROM title
WHERE episode_of_id=(select id from title where title='House M.D.')
ORDER BY real_year DESC
Right now to fix this after every update i run following SQL script,
however it takes few hours to update, so i was wondering maybe this
could be fixed in imdbpy2sql.
Thanks.
PS. Thanks for the gender field. Just tested and it works perfectly!
Here is the update function i run after update, if interested:
CREATE OR REPLACE FUNCTION episodes_year_update() RETURNS void AS $BODY$
DECLARE m record; r record; year int; year_tmp int;
BEGIN
FOR m IN select * from title where kind_id=7 -- and episode_of_id=498593
LOOP
year := null;
FOR r IN SELECT * FROM movie_info WHERE movie_id=m.id and
info_type_id=16
LOOP
year_tmp := SUBSTRING(r.info, \'([0-9]{4})\')::int;
IF (year_tmp NOTNULL AND (year ISNULL OR year_tmp < year)) THEN
year := year_tmp; --RAISE NOTICE \'info: %\', r.info;
END IF;
END LOOP;
IF (year NOTNULL and year != m.production_year) THEN
UPDATE title SET production_year=year where id=m.id;
END IF;
END LOOP;
return;
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
darklow.
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Imdbpy-devel mailing list
Imdbpy-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-devel