Brad Templeton <[EMAIL PROTECTED]> writes:
> I provided a patch to mythweb to do exactly that (search for movies by
> star rating). I don't think it's in CVS yet but hopefully will be soon.
>
> http://www.gossamer-threads.com/lists/mythtv/dev/103682
>
> You can apply it pretty easily yourself, as mythweb is PHP and does not
> need to be compiled.
Thanks! That works perfectly. Isn't open source wonderful?
By the way, the patch is a bit corrupted in that archive, but I made
the changes by hand. I've attached the patch here in case others
want to try it. (I didn't do the HD labelling part, though.)
> I also have another program in testing to do the latter (automatic
> recording by various parameters) which can be used to record all movies
> above a certain star rating and a lot of other stuff, but I am waiting
> for more testing before deploying it here. However, I did not put
> in a specific feature for star rating (though you can do it) because this
> actually isn't very practical if you have cable or satellite at least.
I think it might be practical if limited to 4 star movies, especially
if expiry can be made more sophisticated. Large movies recorded by
such a rule could be made to expire earlier than other recordings, for
example. I'd also like to be able to have different expiry times
based on the priority of a recording. Are features like this in the
works?
> A 4* and above search might not be out of the question. In CVS Myth you
> can also do a generlized SQL query to do this
Sounds like a nice new feature. Is this to do the recording or just
the searching?
Dan
--- search.php.orig 2004-10-18 23:29:44.000000000 -0400
+++ search.php 2005-01-26 10:53:55.000000000 -0500
@@ -40,16 +40,27 @@
$compare = ' LIKE ';
// How do we want to build this query?
- if (preg_match('/\\S/', $_SESSION['search']['searchstr'])) {
+// If it starts with a pair of stars, it's a movie rating query
+ $searchstr = $_SESSION['search']['searchstr'];
+ if( preg_match( '/^\\*+(1\\/2|0?\\.5|-)?/', $searchstr )) {
+ $dummy_array = array();
+ $starcount = preg_match_all( '/\\*/', $searchstr, $dummy ) / 4.0;
+ if( preg_match( "/1\\/2|\\.5|-/", $searchstr ) )
+ $starcount += 0.125;
+ $query[] = "program.stars >= $starcount";
+ //$joiner = " AND ";
+ //$query[] = "program.category_type = 'movie'";
+ }
+ else if (preg_match('/\\S/', $searchstr)) {
// Normal search is an OR search
$joiner = ' OR ';
// Regex search?
- if (preg_match('/^~/', $_SESSION['search']['searchstr'])) {
+ if (preg_match('/^~/', $searchstr)) {
$compare = ' REGEXP ';
- $search = escape(preg_replace('/^~/', '', $_SESSION['search']['searchstr']));
+ $search = escape(preg_replace('/^~/', '', $searchstr));
}
else
- $search = search_escape($_SESSION['search']['searchstr']);
+ $search = search_escape($searchstr);
// Build the query
if ($_SESSION['search']['search_title'])
$query[] = "program.title$compare$search";
_______________________________________________
mythtv-users mailing list
[email protected]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users