New feature - Search all the movies I didn't see

Please use this forum to post feedback and suggestions related to VCD-db.
You can also post any questions here that are on your mind.

Moderators: Carpo, Saviq

New feature - Search all the movies I didn't see

Postby ketzaldev » Wed Feb 10, 2010 9:16 pm

Hi all,

I'd like to add a new feature in vcddb, which I think, is easy to implement. The problem is that I didn't read the code, so I don't really know how to do it.

A thing which is missing and could be interresting to have is to be able to know all the movie I didn't see for example.
In Vcddb, there is a feature on the movie description that allow you to tell if you saw the movie or not (the icon by default is a small disc with a green "plus").
I'd like to get a list of all the movies i didn't see.

I search this information on the database, and found that it is located on the table "vcd_MetaData".

Here is an example of a "vcd_MetaData" entry:
Code: Select all
+-------------+-----------+--------------+---------+---------+----------------+
| metadata_id | record_id | mediatype_id | user_id | type_id | metadata_value |
+-------------+-----------+--------------+---------+---------+----------------+
|         248 |       278 |            0 |       2 |      12 | 0              |
+-------------+-----------+--------------+---------+---------+----------------+


With this information it's easy to create a request, to find out all the movies the user $user didn't already see:

select record_id from vcd_MetaData where user_id = $user and type_id = 12 and metadata_value = 0;

That will return the whole list of all the movies that user didn't see.

I'm sure there are some things already done to display a list of entries (of movies id), but I don't know how to do it.

Can you please help me if it's easy to do?

Thanks a lot

Ketzaldev
ketzaldev
 
Posts: 8
Joined: Tue Oct 13, 2009 4:25 pm

Re: New feature - Search all the movies I didn't see

Postby ketzaldev » Thu Feb 11, 2010 7:39 am

Ok, i investigate more, and I think I need to create:
- a file named VCDPageNotSeen.php containing the code to execute (on classes/controler/)
- a template of the display, (in pages/)

Do I need more.
Is there a model to do the mysql requests, where is it located?
Is there model objects (like MovieObj) used?

Have you got a picture of how the PHP files mapped together? Something explaining how to enter the code and understand it?

Thanks in advance
Louis
ketzaldev
 
Posts: 8
Joined: Tue Oct 13, 2009 4:25 pm

Re: New feature - Search all the movies I didn't see

Postby ketzaldev » Thu Feb 11, 2010 10:42 am

I'm in the vcdSQL.php file, and I don't understand nothing about the SQL syntax...
case 'title':
if ($showadult) {

$query = "SELECT v.vcd_id, v.title, v.category_id, v.year
FROM $this->TABLE_vcd v
LEFT OUTER JOIN $this->TABLE_vcdtosources so ON v.vcd_id = so.vcd_id
LEFT OUTER JOIN $this->TABLE_imdb i ON so.external_id = i.imdb
WHERE v.title LIKE ".$this->db->quote($keyword)." OR i.title LIKE ".$this->db->quote($keyword)."
OR i.alt_title1 LIKE ".$this->db->quote($keyword)." OR i.alt_title2 LIKE ".$this->db->quote($keyword)."
ORDER BY v.title";
} else {
$query = "SELECT v.vcd_id, v.title, v.category_id, v.year
FROM $this->TABLE_vcd v
LEFT OUTER JOIN $this->TABLE_vcdtosources so ON v.vcd_id = so.vcd_id
LEFT OUTER JOIN $this->TABLE_imdb i ON so.external_id = i.imdb
WHERE (v.title LIKE ".$this->db->quote($keyword)." OR i.title LIKE ".$this->db->quote($keyword)."
OR i.alt_title1 LIKE ".$this->db->quote($keyword)." OR i.alt_title2 LIKE ".$this->db->quote($keyword).")
AND v.category_id <> ".$adult_cat."
ORDER BY v.title";
}
break;


What is this syntax, and how to make the stranslation between this syntax and the MySQL request I wrote before:
select record_id from vcd_MetaData where user_id = $user and type_id = 12 and metadata_value = 0;

Thanks
ketzaldev
 
Posts: 8
Joined: Tue Oct 13, 2009 4:25 pm

Re: New feature - Search all the movies I didn't see

Postby jantle » Tue Feb 16, 2010 11:44 am

I've done something similar some time ago, I added a "not seen"-Checkbox next to the "Show only my movies"-Checkbox. No need to create new pages or controllers, also I can search for not-seen-movies within categories.
To do so you would have to (meaning: what i have done)
- add a new parameter (like $notseen) to function getVcdByCategory within vcdSQL.php and extend the functions SQL-query.
- of course assign that new parameter when you call the function. This is done in VCDPageCategoryList.php, in function getMovieList()
- add the checkbox to page.categorylist.tpl and don't forget to add its associated onclick-function to main.js.

Of course you could also extend the search-function... it's SQL-query would look like:

Code: Select all
case 'unseen':
   $query = "SELECT v.vcd_id, v.title, v.category_id, v.year
   FROM $this->TABLE_vcd v
   LEFT OUTER JOIN $this->TABLE_metadata md ON (md.record_id = v.vcd_id AND md.type_id = 12 AND md.user_id = ".$user_id.")"
   WHERE (md.metadata_value = 0) OR (md.metadata_value IS NULL)
   ORDER BY v.title";
break;


since there is no $user_id -parameter in search-function you would have to add this parameter

jantle
jantle
 
Posts: 2
Joined: Mon Nov 16, 2009 1:57 pm


Return to General discussion, Suggestions and Feedback

Who is online

Users browsing this forum: No registered users and 1 guest

cron