[mythtv-users] mythmusic and MySQL

Alex Butcher mythlist at assursys.co.uk
Mon Aug 4 10:07:05 UTC 2008


On Sun, 3 Aug 2008, Yan Seiner wrote:

> I'm seeing some sort of weirdness with my music collection.  Songs
> appear 1 to 4 times.  I've wiped out all the mythmusic tables, reset the
> version, and myth dutifully recreated all my music - again with the
> duplicates.
>
> There must be some SQL query that will a) find all duplicate titles and
> b) print out the offending files as
> Title - location
>
> Could some SQL guru take a shot at that?

No SQL guru, but something like:

CREATE TEMPORARY TABLE dupesongs SELECT name,count(name) AS numoccurrences
FROM music_songs GROUP BY name HAVING(COUNT(name)>1);

SELECT music_songs.name,filename,music_directories.path FROM
music_songs join music_directories JOIN dupesongs WHIRE
music_songs.directory_id=music_directories.directory_id AND 
music_songs.name=dupesongs.name ORDER BY
music_songs.name,album_id,artist_id;

Seems to work for me, and identifies my duplicate track names (live
versions, and sampler discs for me)

> Thanks,
> --Yan

Best Regards,
Alex.


More information about the mythtv-users mailing list