[mythtv] embedded albumart working in current master?

Mike Rice mikerice1969 at gmail.com
Tue Jan 5 05:11:05 UTC 2016


On Mon, Jan 4, 2016 at 3:11 PM, Paul Harrison <mythtv at sky.com> wrote:

> On 03/01/16 23:07, Mike Rice wrote:
>
>>
>> The double /usr1/music looks like the problem. We used to store the full
> path to each file in the DB at some point that was changed to only store
> the path minus the start path and now we just look for that relative path
> in the Music storage group. It looks like the migration has gone wrong
> somewhere.
>
> Fixing that doesn't seem to help me a whole lot though. Still no albumart.
>>
>> I'd like to debug and/or fix this but I think I need a hint or two.  :)
>>
>> Thanks.
>>
>>
> A quick fix would be just to clear the music tables (there is a button on
> the general settings pages to do that) and perform a scan for music but it
> would be nice to figure out what went wrong here first.
>
> The place to start would be the music tables and the files paths stored in
> there.
>
> The tables of interest are music_songs, music_albumart, and
> music_directories. I'm too tired to figure out the proper queries but
> something like this will get you started :)
>
> select song_id, name, directory_id from music_songs where song_id=12345;
> select * from music_albumart where song_id=12345;
> select * from music_directories where directory_id=9876;
>
>
I should have mentioned this is a testbox backend/frontend combo that I
built new.  The database is new from 0.28 and doesn't contain anything from
any older mythtv versions.  I did use the clear music tables button several
times when investigating this followed by a rescan.  It still does not
work.

The tables look reasonable to me:

mysql> select song_id, name, directory_id,filename from music_songs where
song_id=1;
+---------+-------------------+--------------+----------------------------------------+
| song_id | name              | directory_id | filename
          |
+---------+-------------------+--------------+----------------------------------------+
|       1 | Because The Night |            1 | 10,000 Maniacs - Because The
Night.mp3 |
+---------+-------------------+--------------+----------------------------------------+
1 row in set (0.00 sec)

mysql> select * from music_albumart where song_id=1;
+-------------+-------------+--------------+-----------+---------+----------+----------+
| albumart_id | filename    | directory_id | imagetype | song_id | embedded
| hostname |
+-------------+-------------+--------------+-----------+---------+----------+----------+
|           1 | 1-front.jpg |            0 |         1 |       1 |        1
| testbox  |
+-------------+-------------+--------------+-----------+---------+----------+----------+
1 row in set (0.00 sec)

mysql> select * from music_directories where directory_id=1;
+--------------+-------------+-----------+
| directory_id | path        | parent_id |
+--------------+-------------+-----------+
|            1 | /usr1/music |         0 |
+--------------+-------------+-----------+
1 row in set (0.00 sec)

mysql> select * from storagegroup where groupname like 'Music%';
+----+-----------+----------+-----------------+
| id | groupname | hostname | dirname         |
+----+-----------+----------+-----------------+
| 23 | Music     | testbox  | /usr1/music/    |
| 25 | MusicArt  | testbox  | /usr1/musicart/ |
+----+-----------+----------+-----------------+
2 rows in set (0.02 sec)

root at testbox:/home/mike# ls -ld /usr1/music*
drwxrwxrwx 2 root root 147456 Jan  4 19:28 /usr1/music
drwxrwxrwx 3 root root   4096 Jan  4 19:28 /usr1/musicart

No files ever appear in /usr1/musicart.

Like I mentioned I think there is at least a problem in the mythutil
--extractimage where FindFile is called with the full path:

In ExtractImage in mythutil/musicmetautils.cpp the MusicMetadata is
obtained with MusicMetadata::createFromID.  Looking there you will see
m_filename is set from:

"CONCAT_WS('/', music_directories.path, music_songs.filename) AS filename,

And then FindFile is called but doesn't expect a full path and fails.  When
I fix createFromID to set the relative path I can get mythutil
--extractimage to place files in /usr1/musicart/AlbumArt but MythMusic
still didn't locate and use it.  At that point I thought I better stop and
make sure I understand what is supposed to happen since it doesn't appear
this could be working as it.

So is this correct:

Initial music scan just creates the tables above.  It looks it the mp3 to
see if it has albumart and sets the embedded column to TRUE.  It doesn't do
any extraction.

When the track is played MythMusic will try to get the embedded image.  To
find it it can:
1. Look for it in a local cache (~feuser/.mythtv/MythMusic/AlbumArt ?)
2. Look for it in /usr1/musicart
3. If not found, execute mythutil --extractimage to extract it to
/usr1/musicart
4. When event says it has been generated the image is obtained from
/usr1/musicart and displayed by MythMusic.

If that understanding is correct I think I can make progress debugging it.

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-dev/attachments/20160104/7a4b1ad2/attachment.html>


More information about the mythtv-dev mailing list