[mythtv] patch: setsetting -> db

Andy Davidoff dert at pobox.com
Mon Feb 24 21:25:21 EST 2003


#if Isaac Richards /* Feb 24, 20:31 */
> Yes, since the 4 additional milliseconds (or even up to 80ms when using your 
> patch) it takes on exit to save is completely unacceptable.

It takes me longer than that, and I just don't know why I should have to
"settle" for inefficient code -- isn't that one of the main reasons this
project is written in C++?  80ms is a long time in C.

Don't worry, I won't trouble you with my patch.

> The slowdown is in generating the entire GUI tree of music data, and in doing 
> a CD lookup if needed, not in loading/saving the playlist (since that doesn't 
> even happen at the same time).  In my experience, hitting the CD takes much 
> longer than the rest of the data lookups.

Agreed.  Do you think it's the reading of file types for the icons or what?

> Things could be preloaded somewhat, but every track needs to be checked 
> against the default playlist in order to properly mark upper level tree items 
> as selected or not (ie, If every track in an album is in the playlist, then 
> the album should be selected.  If every album by an artist is selected, the 
> artist should be selected).  I need to make it a tri-state check someday, as 
> well.  
> 
> Separate artist/album/track database tables would probably help quite a bit, 
> as alternatively could pulling in all the information at once and parsing it 
> in the program instead of at the SQL server.  It'd also make sense to only 
> generate the tree once per execution and then just re-use and update it, but 
> I haven't gotten that far into optimizing things, since turning off the auto 
> CD lookup helps a _lot_ in terms of the speed of that dialog appearing.
#endif /* ijr at po.cwru.edu */

I agree WRT to the CD issue, however...

Using the playlist schema I submitted yesterday, you can already get a list
of artists and albums and their inclusion in the playlist, which let's you
mark your trees or populate your playlist array:

mysql> select musicplaylistmap.intid,musicmetadata.artist,musicmetadata.album,musicmetadata.title from musicmetadata left join musicplaylistmap using (intid) where album in ('Oh Mercy','Love and Theft') order by artist,album;
+-------+-----------+----------------+---------------------------------+
| intid | artist    | album          | title                           |
+-------+-----------+----------------+---------------------------------+
|  NULL | Bob Dylan | Love and Theft | Bye and Bye                     |
|  NULL | Bob Dylan | Love and Theft | Cry a While                     |
|  NULL | Bob Dylan | Love and Theft | Floater (Too Much To Ask)       |
|  NULL | Bob Dylan | Love and Theft | High Water (For Charley Patton) |
|   126 | Bob Dylan | Love and Theft | Honest With Me                  |
|   127 | Bob Dylan | Love and Theft | Lonesome Day Blues              |
|  NULL | Bob Dylan | Love and Theft | Mississippi                     |
|   129 | Bob Dylan | Love and Theft | Moonlight                       |
|   130 | Bob Dylan | Love and Theft | Po' Boy                         |
|   131 | Bob Dylan | Love and Theft | Sugar Baby                      |
|   132 | Bob Dylan | Love and Theft | Summer Days                     |
|  NULL | Bob Dylan | Love and Theft | Tweedle Dee & Tweedle Dum       |
|    65 | Bob Dylan | Oh Mercy       | Disease of Conceit              |
|    66 | Bob Dylan | Oh Mercy       | Everything is Broken            |
|  NULL | Bob Dylan | Oh Mercy       | Man in the Long Black Coat      |
|    68 | Bob Dylan | Oh Mercy       | Most of the Time                |
|  NULL | Bob Dylan | Oh Mercy       | Political World                 |
|    70 | Bob Dylan | Oh Mercy       | Ring Them Bells                 |
|    71 | Bob Dylan | Oh Mercy       | Shooting Star                   |
|    72 | Bob Dylan | Oh Mercy       | What Good am I                  |
|  NULL | Bob Dylan | Oh Mercy       | What Was it You Wanted          |
|    74 | Bob Dylan | Oh Mercy       | Where Teardrops Fall            |
+-------+-----------+----------------+---------------------------------+
22 rows in set (0.00 sec)

The columns where intid = NULL are tracks not in my playlist.  I've omitted
the playlist join here because it's trivial and irrelevant to the demo, and
it should also be clear that you can retrieve all the other metadata inside
the same query with no extra cost, which means that we could populate the
playlist objects and the "edit playlist" object tree at the same time in a
single query.

You can also just see if your branches need to be marked with something
like this, in which flag = 0 defines a mark and flag = 1 defines partial
selection of the album.  Obviously, you would probably alter the query to
only produce one or the other:

mysql> select isnull(musicplaylistmap.intid) as 'flag',musicmetadata.artist,musicmetadata.album from musicmetadata left join musicplaylistmap using (intid) where album in ('Oh Mercy','Love and Theft','Celtschmerz') group by artist,album,flag order by artist,album;
+------+------------------+----------------+
| flag | artist           | album          |
+------+------------------+----------------+
|    0 | Bob Dylan        | Love and Theft |
|    1 | Bob Dylan        | Love and Theft |
|    0 | Bob Dylan        | Oh Mercy       |
|    1 | Bob Dylan        | Oh Mercy       |
|    0 | Richard Thompson | Celtschmerz    |
+------+------------------+----------------+
5 rows in set (0.00 sec)

Again, these queries were all run against my schema changes from yesterday;
it's not as though this is magic, or complicated.  We're just using the extra
structure that was previously unavailable to us.


More information about the mythtv-dev mailing list