[mythtv-users] Custom MythWeb search (MySQL/php) assistance required
Rod Emerson
rod at emerson.id.au
Sat Jul 8 07:31:03 UTC 2006
Hi myth-users
I fumbled around and came up the following MySQL query
to display programs that might be movies.
It displays titles that are 1 hour 50 minutes or
more and match specific categories.
(free to air in Australia using the immir grabber)
wrapped for readability :
$ mysql -umythtv -pmythtv mythconverg -e
"SELECT title, category, starttime,
SEC_TO_TIME((UNIX_TIMESTAMP(endtime) - UNIX_TIMESTAMP(starttime))) AS length
FROM program WHERE
(UNIX_TIMESTAMP(endtime) - UNIX_TIMESTAMP(starttime)) >= @time
AND (category = 'Action' OR category = 'Adventure'
OR category = 'Comedy' OR category = 'Documentary'
OR category = 'Drama' OR category = 'Musical'
OR category = 'Thriller')
ORDER BY starttime;"
This correctly displays :
+------------------------+-------------+---------------------+----------+
| title | category | starttime | length |
+------------------------+-------------+---------------------+----------+
I add this into MythWeb canned_searches.php :
('Movies (maybe)')
=> 'set @time=6600;'
.'(UNIX_TIMESTAMP(endtime) - UNIX_TIMESTAMP(starttime)) >= @time'
.'AND (category = "Action"'
.'OR category = "Adventure"'
.'OR category = "Comedy"'
.'OR category = "Documentary"'
.'OR category = "Drama"'
.'OR category = "Musical"'
.'OR category = "Thriller")',
The query fails at "'set @time=6600;(UNIX_TIMESTAMP(endtime)...".
Does anybody know how to do the same query without using the @variable
or the correct syntax to use in canned_searches.php ?
I can't figure it out.
Thanks
Rod
More information about the mythtv-users
mailing list