Closed Bug 1186146 Opened 7 years ago Closed 7 years ago

[gallery/music] Hide dotfiles in MediaDB

Categories

(Firefox OS Graveyard :: Gaia::Music, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: squib, Assigned: squib)

References

Details

Attachments

(1 file)

We've gone back and forth on this a bunch: see bug 838179 and bug 908140. However, as David mentioned in bug 908140, "Chris said he thought it should be fixed [to show dotfiles], so we fixed it. I disagree slightly with that decision, but unless there is a user-visible bug here, I don't think it is worth changing it now." There does appear to be a user-visible bug: on OS X, there hidden metadata files for each song, of the form "._filename.mp3", which will get copied over to the SD card if you just copy whole directories.

Since these metadata files are obviously invalid MP3s (but have the .mp3 extension), the music app attempts to parse them. It's possible that this can cause the scanning process to stall (which, if it does happen, is another bug), but even with the metadata parser 100% bulletproof, this can cause a significant performance penalty when scanning a batch of new files. The earlier we can bail out trying to scan these files, the faster the music app will be.

In general, I don't think users are going to name their songs with dots at the beginning. It's surely no more likely than naming folders with dots at the beginning, which we *do* hide.
Also ._ is the convention for "resource" on MacOS for filesystem that don't support it, so if you have file.mp3 and ._file.mp3 you can be almost certain that the second one is invalid.

We should skip then. As well as .DS_Store (case insensitively)
Assignee: nobody → squibblyflabbetydoo
Status: NEW → ASSIGNED
Comment on attachment 8660102 [details] [review]
[gaia] jimporter:mediadb-hide-dotfiles > mozilla-b2g:master

David: I know we've gone back and forth on this a lot. See my reasoning in comment 0 for why I think we should do this. Taking this patch will make the music app scan files faster for OS X users, and would also have hidden (but not truly fixed) bug 1191760.
Attachment #8660102 - Flags: review?(dflanagan)
Comment on attachment 8660102 [details] [review]
[gaia] jimporter:mediadb-hide-dotfiles > mozilla-b2g:master

Update the comment, please before landing.

I think it is safe to just ignore all dot files. But it is a potentially breaking change for the Gallery and Video apps, so also consider these alternatives:

1) Ignore . directories as we do now, and ignore ._ files, but not regular . files.

2) Put this change behind an option so that clients can choose to ignore dot files or not, and modify Music to set that option.

I'm okay if you land it like this, however.
Attachment #8660102 - Flags: review?(dflanagan) → review+
I think we should be safe to land this as-is (plus the comment). It should also be closer to users' expectations. Even if you'd expect a dotfile to be shown (and I'm not sure how many people would), it's hard to explain that we show dotfiles, but ignore things in dot-folders.

This could also help Gallery and Video for similar reasons as with Music, although I expect it doesn't matter as much there, since Gallery and Video will usually show files generated on the device itself.
I'm going to wait on landing this until *after* I land bug 1191760, since I want to get confirmation that I fixed the issue in that bug, and landing this will make it harder to reproduce bug 1191760.
Landed: https://github.com/mozilla-b2g/gaia/commit/566ca621e80c40d71b818d3aa8d39e2e96ff85d5
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.