[KPhotoAlbum] Patch: file type as subcategory of media type

Michael J Gruber michaeljgruber+gmane at fastmail.fm
Wed Feb 21 09:34:25 GMT 2007


Shawn Willden venit, vidit, dixit 2007-02-20 20:47:
> On Tuesday 20 February 2007 12:01, Baptiste MATHUS wrote:
>> 2007/2/20, Michael J Gruber:
>>> A while ago I submitted a patch which implements file type subcategories:
>>>
>>> Extensions are converted to lower case, so "JPG" and "jpg" are the same,
>>> but "jpeg" and "jpg" are not. I'm not sure if they should be.
>> I guess they should (jpg, jpeg, jpe, like the gimp, for example).
>> Maybe you could have a look at The Gimp to use the same extension
>> groupings. See attached screenshot.
> 
> A better approach might be to use KDE's infrastructure to classify them by 
> MIME type.  That would handle grouping of different extensions and would 
> allow the user to manage the set of extensions that map to a particular group 
> (in KControl, KDE Components->File Associations).  It would also take care of 
> different extension cases, and it's even possible that KDE can use 
> information other than file extension to identify MIME type, like the output 
> of "file -i".
> 
> The only downside I can see is if you might want the extensions grouped 
> differently in KPA than they are in the file association mappings.  For 
> example, the "image/x-raw" type subsumes all known RAW images, and maybe you 
> want your NEFs to be listed separately from your CR2s.
> 
> Poking throught the KDE libs documentation, I think you want to use 
> KMimeType::findByPath() to get the KMimeType.  KMimeMagic looks slightly 
> better (since it says it will examine the file if the extension doesn't 
> provide enough info), but it is deprecated.
> 
> 	Shawn.

This would certainly be the more systematic approach. Downside is that
(I don't know I would have the ability/time implement it and) it takes
too too. If you want to "do it right" (identifying by
KMimeType/KMimeMagic) then the file needs to be read, at least the first
few bytes. With the current approach only the file extension is used, so
that it's relatively cheap to do it on the fly. Besides, it works for me ;)

Michael




More information about the Kphotoalbum mailing list