[mythtv] Bootstrapping DB settings

Bruce Markey mythtv-dev@snowman.net
Wed, 04 Dec 2002 19:10:50 -0800


Matt Zimmerman wrote:
> On Wed, Dec 04, 2002 at 07:05:32AM -0800, Bruce Markey wrote:
...

> Try dropping the recordingprofiles table and recreating it using the new
> 0-7-to-0-8.sql script.  I think this was happening because the row is
> filled in one column at a time, but some of the columns were set to be NOT
> NULL.  Let me know if this fixes the problem; I can't test it right now.

It's still not right but it's easier to see what's going
on. It appears that if the matching name is already in
the recordingprofiles everything is changed by SQL UPDATEs
and works correctly. If the name is not present, each
field in recordingprofiles is entered with an SQL INSERT
(creating a new AUTO_INCREMENT value) and the value used
for "profile" in codecparams is 0. When creating a new
profile, it probably ought to do an INSERT for the name
first then SELECT to find the id and proceed just as it
does when editing an existing profile.

A workaround for now is to simply INSERT names into the
recordingprofiles then edit them. It appears that only
profile "1" is used currently.

--  bjm


//
// Start form scratch:
//

mysql> select * from recordingprofiles;
Empty set (0.00 sec)

mysql> select * from codecparams;
Empty set (0.00 sec)

//
// Go through the wizard once:
//

mysql> select * from recordingprofiles;
+----+--------+------------+------------+
| id | name   | videocodec | audiocodec |
+----+--------+------------+------------+
|  1 | Custom | NULL       | NULL       |
|  2 | NULL   | RTjpeg     | NULL       |
|  3 | NULL   | NULL       | MP3        |
+----+--------+------------+------------+
3 rows in set (0.00 sec)

mysql> select * from codecparams;
+---------+-------------------------+-------+
| profile | name                    | value |
+---------+-------------------------+-------+
|       0 | width                   | 640   |
|       0 | height                  | 480   |
|       0 | rtjpegquality           | 170   |
|       0 | rtjpeglumafilter        | 0     |
|       0 | rtjpegchromafilter      | 0     |
|       0 | mpeg4bitrate            | 2200  |
|       0 | mpeg4maxquality         | 2     |
|       0 | mpeg4minquality         | 15    |
|       0 | mpeg4qualdiff           | 3     |
|       0 | hardwaremjpegquality    | 100   |
|       0 | hardwaremjpegdecimation | 2     |
|       0 | samplerate              | 32000 |
|       0 | mp3quality              | 7     |
+---------+-------------------------+-------+
13 rows in set (0.00 sec)

//
// Empty tables then INSERT names
//

mysql> delete from recordingprofiles;
Query OK, 0 rows affected (0.00 sec)

mysql> delete from codecparams;
Query OK, 0 rows affected (0.00 sec)

mysql> insert into recordingprofiles (name) values('Custom');
Query OK, 1 row affected (0.00 sec)

mysql> insert into recordingprofiles (name) values('Movies');
Query OK, 1 row affected (0.00 sec)

mysql> select * from recordingprofiles;
+----+--------+------------+------------+
| id | name   | videocodec | audiocodec |
+----+--------+------------+------------+
|  1 | Custom | NULL       | NULL       |
|  2 | Movies | NULL       | NULL       |
+----+--------+------------+------------+
2 rows in set (0.00 sec)

//
// Go through the wizard to edit "Custom":
//

mysql> select * from recordingprofiles;
+----+--------+------------+------------+
| id | name   | videocodec | audiocodec |
+----+--------+------------+------------+
|  1 | Custom | MPEG-4     | MP3        |
|  2 | Movies | NULL       | NULL       |
+----+--------+------------+------------+
2 rows in set (0.00 sec)

mysql> select * from codecparams;
+---------+-------------------------+-------+
| profile | name                    | value |
+---------+-------------------------+-------+
|       1 | width                   | 352   |
|       1 | height                  | 480   |
|       1 | rtjpegquality           | 170   |
|       1 | rtjpeglumafilter        | 0     |
|       1 | rtjpegchromafilter      | 0     |
|       1 | mpeg4bitrate            | 1128  |
|       1 | mpeg4maxquality         | 2     |
|       1 | mpeg4minquality         | 15    |
|       1 | mpeg4qualdiff           | 3     |
|       1 | hardwaremjpegquality    | 100   |
|       1 | hardwaremjpegdecimation | 2     |
|       1 | samplerate              | 44100 |
|       1 | mp3quality              | 7     |
+---------+-------------------------+-------+
13 rows in set (0.01 sec)

//
// Attempt to create a new profile "Test":
//

mysql> select * from recordingprofiles;
+----+--------+------------+------------+
| id | name   | videocodec | audiocodec |
+----+--------+------------+------------+
|  1 | Custom | MPEG-4     | MP3        |
|  2 | Movies | NULL       | NULL       |
|  3 | NULL   | RTjpeg     | NULL       |
|  4 | NULL   | NULL       | MP3        |
+----+--------+------------+------------+
4 rows in set (0.00 sec)

mysql> select * from codecparams;
+---------+-------------------------+-------+
| profile | name                    | value |
+---------+-------------------------+-------+
|       1 | width                   | 352   |
|       1 | height                  | 480   |
|       1 | rtjpegquality           | 170   |
|       1 | rtjpeglumafilter        | 0     |
|       1 | rtjpegchromafilter      | 0     |
|       1 | mpeg4bitrate            | 1128  |
|       1 | mpeg4maxquality         | 2     |
|       1 | mpeg4minquality         | 15    |
|       1 | mpeg4qualdiff           | 3     |
|       1 | hardwaremjpegquality    | 100   |
|       1 | hardwaremjpegdecimation | 2     |
|       1 | samplerate              | 44100 |
|       1 | mp3quality              | 7     |
|       0 | width                   | 640   |
|       0 | height                  | 480   |
|       0 | rtjpegquality           | 170   |
|       0 | rtjpeglumafilter        | 0     |
|       0 | rtjpegchromafilter      | 0     |
|       0 | mpeg4bitrate            | 2200  |
|       0 | mpeg4maxquality         | 2     |
|       0 | mpeg4minquality         | 15    |
|       0 | mpeg4qualdiff           | 3     |
|       0 | hardwaremjpegquality    | 100   |
|       0 | hardwaremjpegdecimation | 2     |
|       0 | samplerate              | 32000 |
|       0 | mp3quality              | 7     |
+---------+-------------------------+-------+
26 rows in set (0.00 sec)

mysql>