Page 1 of 1

Not all songs from a certain album are imported to library

PostPosted: Mon Feb 04, 2013 11:31 am
by giskard41
Hey,

I found another problem yesterday. I don't know if it is subsonic or musiccabinet problem ...

I was browsing the music library when I noticed there was only 1 song for 1 album.


https://docs.google.com/file/d/0B3sRN4O ... sp=sharing

I was pretty sure that i had the whole album so I checked the file structure and as I suspected I have the whole album here

https://docs.google.com/file/d/0B3sRN4O ... sp=sharing

So I decided to look in musiccabinet database to see if other songs from this were imported to database or not.

https://docs.google.com/file/d/0B3sRN4O ... sp=sharing

There was only 1 song for this album in database.

So I checked all songs by this artist. I was looking for songs from this album
https://docs.google.com/file/d/0B3sRN4O ... sp=sharing


I found two songs with the same name.

Then I tried to see which albums this two songs belong to and found that that one song is without album (the other is in different album). So I am guessing that the song was imported properly to the music.track table but wasn’t linked to the album (in library.track table).

https://docs.google.com/file/d/0B3sRN4O ... sp=sharing

Is any of this familiar?

Re: Not all songs from a certain album are imported to libra

PostPosted: Mon Feb 04, 2013 12:01 pm
by hakko
Can you run this:

Code: Select all
select artist.artist_name, album_artist.artist_name album_artist_name, album.album_name, track.track_name, f.filename from library.directory d
inner join library.file f on f.directory_id = d.id
inner join library.filetag ft on ft.file_id = f.id
inner join music.artist artist on ft.artist_id = artist.id
inner join music.artist album_artist on ft.album_artist_id = album_artist.id
inner join music.album album on ft.album_id = album.id
inner join music.track track on ft.track_id = track.id
where upper(d.path) = upper('c:\path\to\your\folder')


.. to check which files have been found in there, and what tags they have?

music.track holds information of songs that an artist have been associated with at some point (it could be top tracks that you've never had on your computer), while library.track is songs that are currently in your library.

Re: Not all songs from a certain album are imported to libra

PostPosted: Mon Feb 04, 2013 2:17 pm
by giskard41
I did a quick search using your query and i only get 1 file.

So is this subsonic or musiccabiner error?

Re: Not all songs from a certain album are imported to libra

PostPosted: Mon Feb 04, 2013 2:30 pm
by hakko
I've written all the code for that, so I can't blame Sindre. Do the files that don't appear have both artist and track tags? Would you bother uploading one of them or send it by email to musiccabinet@dilerium.se and I'll have a look why they don't get scanned.

You could also check the musiccabinet.log file for errors (see About view for location).

Re: Not all songs from a certain album are imported to libra

PostPosted: Mon Feb 04, 2013 3:01 pm
by PoGo
Hello hakko,

Is there a way to get from the db all the files that are not imported because of missing/incomplete tags ?
I noticed that MusicCabinet is printing an error in the log file when it encounter such file, but only once.
If I want to fix this problem later, I have to use another way.

I'm using this "onliner" that I found on Internet.
Code: Select all
find . -type f -name '*.[Mm][Pp]3' -exec id3 -Rl {} + -o \
              -name '*.[Ff][Ll][Aa][Cc]' -exec metaflac --show-md5sum \
                 --with-filename --export-tags-to=- {} + -o \
              -name '*.[Oo][Gg][Gg]' -exec sh -c 'echo "$0";vorbiscomment -lRe "$0"' {} \; |
awk 'BEGIN {
   id3n        = split("album artist title track",          id3_tags)
   vorbisn     = split("album artist title tracknumber", vorbis_tags)
   vorbisfile  = "\\.([Ff][Ll][Aa][Cc]|[Oo][Gg][Gg])$"   
   ignorepatt  = "^ *(unknown|track *[0-9]*)* *$"   
   }

/^Filename/ || $1 ~ vorbisfile {
   if (fn)
     fn ~ vorbisfile ? check_tags(vorbisn, vorbis_tags) : check_tags(id3n, id3_tags)
   fn = /^Filename/ ? $2 : $1; f = x       
    }

{
   if (split($0, tmp, "=") == 2) { $1 = tmp[1]; $2 = tmp[2] }
   tags[tolower($1)] = $2
     }

END { fn ~ vorbisfile ? check_tags(vorbisn, vorbis_tags) : check_tags(id3n, id3_tags) 
     printf "\n"
     }

func check_tags(limit, tagarray,    f) {
  for (i = 1; i <= limit; i++) {
     if (tolower(tags[tagarray[i]]) ~ ignorepatt) {
       invalid_tags[tagarray[i]] = tags[tagarray[i]]; f || f++
       }
     }
   if (f) {
     printf "%s%s *** missing/invalid tags: ", RS, fn
       for (t in invalid_tags)
         printf "[%s=\"%s\"]", t, invalid_tags[t]
     printf " ***" 
     }   
   split(x, tags); split(x, invalid_tags)
   
   }' FS=:


It needs some improvments, but this can do the trick.
Then, I use beet in order to set the tags properly.

But I hope that MusicCabinet could give me the answer in a quicker/cleaner way ;)

Re: Not all songs from a certain album are imported to libra

PostPosted: Mon Feb 04, 2013 3:16 pm
by hakko
You could ask the database.

Code: Select all
select d.path, f.filename from library.file f
inner join library.directory d on f.directory_id = d.id
where not exists (select 1 from library.filetag ft where ft.file_id = f.id)
order by d.path, f.filename


This will give you all files that are indexed by MusicCabinet, but lacks metadata. This will however include album artwork and other non-music files too so you'd need some more where clauses. But I guess it's something?

Re: Not all songs from a certain album are imported to libra

PostPosted: Tue Feb 05, 2013 6:47 am
by giskard41
Hakko, I've sent you the file you requested.

Re: Not all songs from a certain album are imported to libra

PostPosted: Tue Feb 05, 2013 10:05 pm
by hakko
I ran it trough hexdump -C, couldn't see anything wrong. I then simply tried removing the id3v1.1 header (as it also has an id3v2.3 header) and then it scans fine. Cant tell if JAudioTagger is buggy or if the file is wrongly encoded. Do you need both headers for some reason?

Re: Not all songs from a certain album are imported to libra

PostPosted: Wed Feb 06, 2013 5:45 am
by giskard41
No. Will try that and let you know how it goes.

Re: Not all songs from a certain album are imported to libra

PostPosted: Sat Feb 09, 2013 7:02 am
by giskard41
I finally had some time, so I tried the above. I turns out the problem was in ID3 v2 tag. So I removed all tags and filled them from scratch and then musiccabinet scanned the files. Thx hakko.

Re: Not all songs from a certain album are imported to libra

PostPosted: Wed Feb 13, 2013 8:06 pm
by hakko
From now on, files that weren't read due to missing tags are kept track of and displayed on the Media Folders settings page: viewtopic.php?f=4&t=9777&p=52975#p52975