Open GoogleCodeExporter opened 9 years ago
Thanks for the report. Fixed in 53d95ff0d917.
Original comment by adrian.sampson
on 17 Jan 2012 at 1:10
Though this is a start I don't think this is a complete solution yet. It will
solve the problem on most *nix derivatives but doesn't do anything for Windows
users where a file starting with a dot is nothing more than that, starting with
a dot. Windows only hides files with the "hidden file" attribute flag and we
just might want to check for that too.
Then there's also extended attributes and other things used to hide a file.
As an example on OS X:
>>> xattr.listxattr("Oasis - 05 - I'm Outta Time.mp3")
()
Chell daenney$ chflags hidden Oasis\ -\ 05\ -\ I\'m\ Outta\ Time.mp3
>>> xattr.listxattr("Oasis - 05 - I'm Outta Time.mp3")
(u'com.apple.FinderInfo',)
I'd also expect os.stat("Oasis - 05 - I'm Outta Time.mp3) to show something in
st_flags but that never seems to happen.
The even more interesting bit is that chflags hidden $file will hide that file
in the Finder for you but will show it just fine on the command line.
Original comment by daniele.sluijters
on 17 Jan 2012 at 6:47
Just to add to it, stat actually sees a difference:
Chell: daenney$ stat Oasis\ -\ 05\ -\ I\'m\ Outta\ Time.mp3
234881028 616417 -rw-r--r-- 1 daenney staff 0 3979928 "Jan 17 19:30:05 2012"
"Jul 2 19:52:57 2011" "Jan 17 19:46:46 2012" "Jul 2 19:52:57 2011" 4096 7776
0 Oasis - 05 - I'm Outta Time.mp3
Chell: daenney$ chflags hidden Oasis\ -\ 05\ -\ I\'m\ Outta\ Time.mp3
Chell: daenney$ stat Oasis\ -\ 05\ -\ I\'m\ Outta\ Time.mp3
234881028 616417 -rw-r--r-- 1 daenney staff 0 3979928 "Jan 17 19:30:05 2012"
"Jul 2 19:52:57 2011" "Jan 17 19:53:55 2012" "Jul 2 19:52:57 2011" 4096 7776
0x8000 Oasis - 05 - I'm Outta Time.mp3
Notice the 0x8000, that's st_flags. Why os.stat isn't picking up on that, no
idea.
Original comment by daniele.sluijters
on 17 Jan 2012 at 6:56
Found it, you need to explicitly tell os.stat to give it to you:
>>> os.stat("/Users/daenney/Music/albums/Oasis/Oasis - [2008] Dig Out Your
Soul/Oasis - 05 - I'm Outta Time.mp3").st_flags
0
Chell: daenney$ chflags hidden Oasis\ -\ 05\ -\ I\'m\ Outta\ Time.mp3
>>> os.stat("/Users/daenney/Music/albums/Oasis/Oasis - [2008] Dig Out Your
Soul/Oasis - 05 - I'm Outta Time.mp3").st_flags
32768
Original comment by daniele.sluijters
on 17 Jan 2012 at 6:58
That flag, 0x8000 in hex, is UF_HIDDEN:
http://docs.python.org/library/stat.html#stat.UF_HIDDEN
It's evidently a Mac OS X-specific stat flag.
For Windows hidden files, you apparently need the win32api module:
http://code.activestate.com/recipes/303343-changing-file-attributes-on-windows/
While we should eventually do this, I think skipping Windows and Mac "hidden"
files is a little less important than .* files. In particular, many tools use
.* files for temporary scratch files (.AppleDouble and the file reported above
are examples), but as far as I know, Windows and Mac hidden files are generally
just used to keep the user out of places they shouldn't be in the Finder and
Windows Explorer. Anyway, it makes sense to do this eventually, but I haven't
had any reports of beets getting confused by looking at hidden-flag files.
Original comment by adrian.sampson
on 17 Jan 2012 at 7:54
Original comment by adrian.sampson
on 28 Nov 2012 at 4:27
Original issue reported on code.google.com by
Joris.Dobbelaer@gmail.com
on 13 Jan 2012 at 7:58