Customize Sorting of Local Files

I am currently using Pi Musicbox 0.5.1RC. After some troubles setting it up (when library scan on startup was enabled, mopidy failed to start) i finally have it running. After importing some local files in the library, I’m wondering if i can customize the sorting behavior of the tracks. Currently it is not always the same depending on how i navigate to the Album:

via Artist --> Album:
sometimes the tracks are sorted by tracknumber, sometimes alphabetically by tracktitle

via Albums:
sorted by tracknumber (as I prefer)

via Release Year --> Album:
sorted alphabetically by tracktitle

EDIT: when browsing Artist --> Album some albums are empty (no tracks found), going directly via Albums all files show up

  • The inconsistent sort order is a bug in Mopidy-Local-SQLite, the Mopidy extension Pi Musicbox uses for browsing your local media. I opened a bug report at https://github.com/tkem/mopidy-local-sqlite/issues/38, so this can probably be resolved wth the next Pi Musicbox release (@woutervanwijk: do you a have a schedule for this?)

  • Regarding the empty albums issue: Could you please provide more information on that, i.e. the ID3 tags of the files belonging to that album, whether it’s a compilation, does the album show up under another artist’s name, etc.

The Albums I used for testing are all from single artists. My folder structure is Artist/Album. The ID3tags are usually edited with Puddletag (Linux). The track numbers are usually by artists (first album gets 1-12, second album 13 - 25 and so on).

The Albums don’t show up under another artists name. I also thought about different ID3tag versions or something like that. Tomorrow i will have some more time to further investigate this. Please tell me if there are some log files which could help to resolve this issue.

I don’t know about Puddletag, but since you’re on Linux, could you please post the ID3 tags as reported by exiftool for at least a single track that’s affected by this? I.e.

exiftool <filename>

If you don’t have exiftool installed, you can usually install it using your distribution’s package manager (the package is called libimage-exiftool-perl on Debian/Ubuntu).

My current guess is there’s some issue with track vs. album artist tags, but I’m still puzzled at the moment.

I did it for two files, the first on is in an album which has tracks when accessing via Artist, the second doesn’t.

First:
ExifTool Version Number : 9.70
File Name : Franz Ferdinand - 01 Jacqueline.mp3
Directory : .
File Size : 4.4 MB
File Modification Date/Time : 2013:11:17 16:54:13+01:00
File Access Date/Time : 2014:11:24 20:37:23+01:00
File Inode Change Date/Time : 2013:12:08 02:47:58+01:00
File Permissions : rw-------
File Type : MP3
MIME Type : audio/mpeg
MPEG Audio Version : 1
Audio Layer : 3
Sample Rate : 44100
Channel Mode : Joint Stereo
MS Stereo : On
Intensity Stereo : Off
Copyright Flag : False
Original Media : True
Emphasis : None
VBR Frames : 8769
VBR Bytes : 4592660
VBR Scale : 75
Encoder : LAME3.97
Lame VBR Quality : 2
Lame Quality : 5
Lame Method : VBR (new/mtrh)
Lame Low Pass Filter : 18.6 kHz
Lame Bitrate : 32 kbps
Lame Stereo Mode : Joint Stereo
Mp 3gain Minmax : 143,255
Mp 3gain Album Minmax : 143,255
Mp 3gain Undo : -002,-002,N
Replaygain Track Gain : -9.710000 dB
Replaygain Track Peak : 1.409404
Replaygain Album Gain : -9.310000 dB
Replaygain Album Peak : 1.409404
ID3 Size : 27786
Album : Franz Ferdinand
Artist : Franz Ferdinand
Title : Jacqueline
Track : 1
Recording Time : 2004
Genre : Indie
Picture Mime Type : image/jpeg
Picture Type : Front Cover
Picture Description :
Picture : (Binary data 27205 bytes, use -b option to extract)
Year : 2004
Comment :
Audio Bitrate : 160 kbps
Date/Time Original : 2004
Duration : 0:03:49 (approx)

Second: (affected by the problem)
ExifTool Version Number : 9.70
File Name : Franz Ferdinand - 25 Ulysses.mp3
Directory : .
File Size : 5.3 MB
File Modification Date/Time : 2013:11:17 16:54:23+01:00
File Access Date/Time : 2014:11:22 23:27:11+01:00
File Inode Change Date/Time : 2013:12:08 02:47:57+01:00
File Permissions : rw-------
File Type : MP3
MIME Type : audio/mpeg
MPEG Audio Version : 1
Audio Layer : 3
Sample Rate : 44100
Channel Mode : Joint Stereo
MS Stereo : On
Intensity Stereo : Off
Copyright Flag : False
Original Media : True
Emphasis : None
VBR Frames : 7320
VBR Bytes : 5111753
VBR Scale : 75
Encoder : LAME3.97
Lame VBR Quality : 2
Lame Quality : 5
Lame Method : VBR (new/mtrh)
Lame Low Pass Filter : 18.6 kHz
Lame Bitrate : 32 kbps
Lame Stereo Mode : Joint Stereo
Mp 3gain Minmax : 136,254
Mp 3gain Album Minmax : 136,254
Mp 3gain Undo : +001,+001,N
Replaygain Track Gain : -9.435000 dB
Replaygain Track Peak : 1.095014
Replaygain Album Gain : -8.705000 dB
Replaygain Album Peak : 1.095014
ID3 Size : 409738
Album : Tonight Franz Ferdinand
Artist : Franz Ferdinand
Title : Ulysses
Track : 25
Recording Time : 2009
Genre : Indie
Picture Mime Type : image/jpeg
Picture Type : Front Cover
Picture Description :
Picture : (Binary data 142343 bytes, use -b option to extract)
Year : 2009
Comment :
Audio Bitrate : 214 kbps
Date/Time Original : 2009
Duration : 0:03:11 (approx)

Thanks for the tags; unfortunately, they look perfectly normal for both files, so no clue in there…

So, just to get this right, you can browse

Artists -> Franz Ferdinand -> Franz Ferdinand -> Jacqueline

but when you browse

Artists -> Franz Ferdinand -> Tonight Franz Ferdinand

no tracks are displayed?

One more question (which I should have asked earlier): What client are you using? The Pi MusicBox Web client or an MPD client? And have you tried both options, and do they show the same result?

Regarding log files: I’m no expert on Pi MusicBox, which handles some things differently, but usually Mopidy’s log files are stored under /var/log/mopidy/; could you please check if you can see anything possibly related in there (i.e. errors, warnings, …).

To exclude any client-related issues, could you please test this using mpc (an MPD command-line client, usually installable from your distribution’s packet manager). Please try

mpc -h <PiMusicBox-IP> ls "Local media/Artists/Franz Ferdinand/Franz Ferdinand"

and if that works, please try

mpc -h <PiMusicBox-IP> ls "Local media/Artists/Franz Ferdinand/Tonight Franz Ferdinand"

My setup gives this for the “Franz Ferdinand” album (your exact output may vary, and I don’t have the “Tonight” album):

$ mpc -h 192.168.1.3 ls "Local media/Artists/Franz Ferdinand/Franz Ferdinand"
local:track:Franz%20Ferdinand/Franz%20Ferdinand/01%20-%20Jacqueline.mp3
local:track:Franz%20Ferdinand/Franz%20Ferdinand/02%20-%20Tell%20Her%20Tonight.mp3
local:track:Franz%20Ferdinand/Franz%20Ferdinand/03%20-%20Take%20Me%20Out.mp3
local:track:Franz%20Ferdinand/Franz%20Ferdinand/04%20-%20The%20Dark%20of%20the%20Matin%C3%A9e.mp3
local:track:Franz%20Ferdinand/Franz%20Ferdinand/05%20-%20Auf%20Achse.mp3
local:track:Franz%20Ferdinand/Franz%20Ferdinand/06%20-%20Cheating%20on%20You.mp3
local:track:Franz%20Ferdinand/Franz%20Ferdinand/07%20-%20This%20Fire.mp3
local:track:Franz%20Ferdinand/Franz%20Ferdinand/08%20-%20Darts%20of%20Pleasure.mp3
local:track:Franz%20Ferdinand/Franz%20Ferdinand/09%20-%20Michael.mp3
local:track:Franz%20Ferdinand/Franz%20Ferdinand/10%20-%20Come%20On%20Home.mp3
local:track:Franz%20Ferdinand/Franz%20Ferdinand/11%20-%2040%E2%80%B2.mp3

Thanks,
Thomas

Exactly. It happens with Pi MusicBox Web client and in MPDroid. MPDroid is kind of strange though: Even when i update the library in the app-settings, not all Artists are showing up (same problem after deleting all app data and setting it up fresh). When i go to the file view in the MPDroid library, i get the same options like in the Web client (local media, tunein, podcasts …) with the same albums not having any tracks in them.

Same problem for:
Browse -> Local Media -> Folders -> MusicBox --------> gives “no tracks found” (that’s the folder where my music is in)

There are no errors or warnings in the mopidy log files.

EDIT: i will try the thing with mpc later

      To exclude any client-related issues, could you please test this using mpc (an MPD command-line client, usually installable from your distribution's packet manager).  Please try

mpc -h ls “Local media/Artists/Franz Ferdinand/Franz Ferdinand”

and if that works, please try

mpc -h ls “Local media/Artists/Franz Ferdinand/Tonight Franz Ferdinand”

My setup gives this for the “Franz Ferdinand” album (your exact output may vary, and I don’t have the “Tonight” album):

$ mpc -h 192.168.1.3 ls “Local media/Artists/Franz Ferdinand/Franz Ferdinand”
local:track:Franz%20Ferdinand/Franz%20Ferdinand/01%20-%20Jacqueline.mp3
local:track:Franz%20Ferdinand/Franz%20Ferdinand/02%20-%20Tell%20Her%20Tonight.mp3
local:track:Franz%20Ferdinand/Franz%20Ferdinand/03%20-%20Take%20Me%20Out.mp3
local:track:Franz%20Ferdinand/Franz%20Ferdinand/04%20-%20The%20Dark%20of%20the%20Matin%C3%A9e.mp3
local:track:Franz%20Ferdinand/Franz%20Ferdinand/05%20-%20Auf%20Achse.mp3
local:track:Franz%20Ferdinand/Franz%20Ferdinand/06%20-%20Cheating%20on%20You.mp3
local:track:Franz%20Ferdinand/Franz%20Ferdinand/07%20-%20This%20Fire.mp3
local:track:Franz%20Ferdinand/Franz%20Ferdinand/08%20-%20Darts%20of%20Pleasure.mp3
local:track:Franz%20Ferdinand/Franz%20Ferdinand/09%20-%20Michael.mp3
local:track:Franz%20Ferdinand/Franz%20Ferdinand/10%20-%20Come%20On%20Home.mp3
local:track:Franz%20Ferdinand/Franz%20Ferdinand/11%20-%2040%E2%80%B2.mp3

Thanks,
Thomas

With mpc i can find the Franz Ferdinand Album, but not the Tonight Franz Ferdinand album.
terminal output: error: Not found

MPDroid, as most MPD client apps out there, tries – AFAIK, anybody please correct me if I’m wrong – to be “too clever” by trying to cache all tracks on the client side. Depending on the size of your library, the speed of your local WiFi, and the app developer’s ability to provide clear and understandable error messages, this may cause some weird kinds of problems :wink:

So I always make sure when using MPDroid I browse through “Library -> Files -> Local media -> Artists” and not just “Library ->Artists”, because this seems to bypass MPDroid’s cache (well, on my device it’s actually “Bibliothek -> Dateien -> Local media”, so I don’t know if the translation is consistent with current MPDroid versions; hope you get the idea, though).

But since the same issue occurs with the MusicBox Web client, this is probably unrelated…

But when browsing, the album title appears as “Tonight Franz Ferdinand”, does it?
As reported by exiftool?

As a side note, you used to be able to disable MPDroid’s Album cache in the library settings since it didn’t make a whole lot of sense with Spotify.

yes. that is correct. do i get it right, that there has to be some bug in the mpd program pi musicbox uses? is upmpdcli used for that? (because upnp also doesn’t work for me, seems to be this issue https://github.com/woutervanwijk/Pi-MusicBox/issues/153)

Well, this really beats me. After importing the file I received from you via PM, I can browse it through “Albums” and “Artists” without problems:

$ mopidy -v local scan
[...]
DEBUG    2014-11-26 05:42:27,833 [4062:MainThread] mopidy_local_sqlite.schema
  SQLite insert statement: INSERT OR REPLACE INTO album (images, name, artists, date, musicbrainz_id, uri, num_discs, num_tracks) VALUES (?, ?, ?, ?, ?, ?, ?, ?) [None, u'Tonight Franz Ferdinand', None, None, None, u'local:album:md5:bd03e3c047524ff1faba27df6372f614', None, 0]
DEBUG    2014-11-26 05:42:27,835 [4062:MainThread] mopidy_local_sqlite.schema
  SQLite insert statement: INSERT OR REPLACE INTO artist (musicbrainz_id, uri, name) VALUES (?, ?, ?) [None, u'local:artist:md5:6f6bf7b57aac6466487a9a0c95b0eee5', u'Franz Ferdinand']
DEBUG    2014-11-26 05:42:27,836 [4062:MainThread] mopidy_local_sqlite.schema
  SQLite insert statement: INSERT OR REPLACE INTO track (comment, composers, disc_no, genre, last_modified, artists, date, bitrate, album, name, performers, uri, length, track_no, musicbrainz_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [None, None, None, u'Indie', 1416976898, u'local:artist:md5:6f6bf7b57aac6466487a9a0c95b0eee5', '2009-01-01', 96000, u'local:album:md5:bd03e3c047524ff1faba27df6372f614', u'Ulysses', None, 'local:track:Franz%20Ferdinand%20-%2025%20Ulysses.mp3', 191216L, 25, None]
DEBUG    2014-11-26 05:42:27,838 [4062:MainThread] mopidy.local.commands
  Added local:track:Franz%20Ferdinand%20-%2025%20Ulysses.mp3
[...]
$ mpc ls "Local media/Albums/Tonight Franz Ferdinand"
local:track:Franz%20Ferdinand%20-%2025%20Ulysses.mp3
$ mpc ls "Local media/Artists/Franz Ferdinand/Tonight Franz Ferdinand"
local:track:Franz%20Ferdinand%20-%2025%20Ulysses.mp3

The only thing I noticed about your tags (after a good night of sleep, finally) is that they only contain an “artist” tag, but no “albumartist” tag. Although this should be handled by the latest version of Mopidy-Local-SQLite, you might try adding an “albumartist” tag and see if this changes anything.

Sorry for the inconvenience,
Thomas

this solved the problem. but i had to delete the files, update the library and add them again with updated tags. thank you for your help! I guess i have to update the tags of all my music files.

Well, strange. As I said before, this case (artist tag, but no albumartist) should be handled by the latest version of Mopidy-Local-SQLite, and it seems to work on my installation (which is not MusicBox-based, though).

@woutervanwijk: What exact version of Mopidy-Local-SQLite is included in Pi MusicBox?

the latest at the moment of release. RC1 was 0.8 or 0.7.x I think

Just a suggestion: Would it be possible to publish the exact versions installed with each MusicBox release, either as part of the release notes, or a link therein? I couldn’t find this information anywhere (please correct me if I missed it). This would make life for extension developers who don’t happen to run MusicBox a little easier :wink: Just posting the output of mopidy deps on a freshly installed MusicBox would be sufficient, I think.