Bug 119004 - Automatic Folder Sorting Based on Mime-type
Summary: Automatic Folder Sorting Based on Mime-type
Status: CONFIRMED
Alias: None
Product: kget
Classification: Applications
Component: general (show other bugs)
Version: 0.8.4
Platform: FreeBSD Ports Linux
: NOR wishlist
Target Milestone: ---
Assignee: KGet authors
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-26 07:46 UTC by Eric Kjeldergaard
Modified: 2008-02-03 01:27 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Kjeldergaard 2005-12-26 07:46:14 UTC
Version:           0.8.4 (using KDE KDE 3.4.3)
Installed from:    FreeBSD Ports

kget appears to sort based on the "extension" of files only.  Well, I am often off and about downloading things, but as the internet is dynamic, often what I click on is a .php or .asp link and kget appears to use this extension for the folder that the download is sorted to.  Therefore, for an example, I go to download torrent files of the latest knoppix or what-have-you, and as I use btlaunchmanycurses.py ~/torrents/, I want the .torrent files downloaded to ~/torrents/.  However, as what I clicked was a .php, it asks me where I'd like to save it and I have to choose the directory appropriately.
Comment 1 Elias Probst 2008-02-03 01:15:09 UTC
There has been some discussion about this feature today at #kget.

Before posting this discussion, I'd like to add some additional thoughts on this topic:

- It seems, MIME type detection using filemagic isn't that trivial, because either you have to rely on the data provided by the server or you'll have to precache some data to identify the file. But as KMimeType also handles file extensions, the mechanisms used until now could still be used, just the options provided to the user could base on MIME groups or single selections - it wouldn't be needed anymore that the users types in *.jpg, *.png etc, - the user just selects the extensions from KDEs MIME-type list.

- The whole thing could extend the central KDE configuration (kcmshell4 filetypes) for MIME types by another tab (until now, there's 'General' and 'Embedding'.). KGet could provide an additional 'Download Directory' tab at this place.


But now the IRC discussion about this topic:

18:04:45 < eliasp> hi
18:35:24 < boom1992> uwolfer: ok :)
18:35:30 < boom1992> eliasp: hi
19:30:58 < eliasp> just read the article about KGet on planet.kde and was remembered an idea, i already had a long time ago for KGet in KDE 3.5... why isn't shared-mime-info used for defining default download directories? i think it would be way more comfortable defining a download directory for image/* instead of {*.jpg,*.png,*.bmp,*.gif,etc..} is this possible based on the MIME information provided by the download item?
19:31:52 < uwolfer> eliasp: that's an idea, but how can you check the real mimetype before the download is locally?
19:32:01 < uwolfer> we need to believe the server..
19:32:13 < uwolfer> boom1992, any comments?
19:32:55 < eliasp> yeah, but mostly (99,99%) the server is right about the mimetype... i just remember some rare cases, where you get strange things like 'force/download'
19:33:26 < boom1992> mmh
19:33:45 < boom1992> how can we get the shared-mime-info?
19:33:51 < boom1992> and is the filename included too?
19:34:09 < eliasp> another idea... preload some bytes and try to identify the file using the preloaded data... then, as soon as the DL is started [by the user] write the pre-cached block to disk + append the incoming data
19:34:16 < uwolfer> boom1992: the filename is included in the http header.. but we do not read that atm IMHO
19:34:19 < uwolfer> that should be changed
19:34:21 < eliasp> this would work at least for HTTP transfers
19:34:52 < eliasp> shared-mime-info should be provided by kdelibs... not sure about the class, responsible for MIME information...
19:35:08 < eliasp> there's already a MIME framework in KDE, as it's used in Konqueror etc.
19:35:40 < boom1992> eliasp, uwolfer: we need to know the dir/shared-mime-info before downloading anything...
19:35:41 < eliasp> http://api.kde.org/4.0-api/kdepimlibs-apidocs/kmime/html/index.html [wrong one... look below for the correct one..]
19:36:17 < uwolfer> yeah, that could be changed.. also the correct filename.
19:36:25 < uwolfer> but that's only possible for http imho
19:36:28 < boom1992> uwolfer: ok
19:36:30 < eliasp> boom1992: yeah, but when pre-caching some bytes of the DL, you should be able to identify the MIME type.. then, after it's identified, present the 'Save as' dialog to the user or save it directly to the matching directory
19:36:33 < boom1992> then it would be great
19:37:11 < eliasp> don't know how to do this for torrent.. i don't know any details about the torrent protocol, but probably something similar is possible there.. should ask the #ktorrent author
19:37:32 < uwolfer> eliasp: we are using the ktorrent lib ;)
19:37:53 < eliasp> yeah, that's why i thought about contacting it's author for more technical details about it...
19:37:57 < boom1992> eliasp: mmh isn't there any way to get the MIME without downloading or sth automated by kdelibs?
19:38:10 < eliasp> oups, sorry... was posting the wrong MIME things above... this looks like it's only for mail things
19:38:48 < boom1992> yeah :/
19:40:14 < eliasp> http://api.kde.org/4.0-api/kdelibs-apidocs/kdecore/html/classKMimeType.html looks more interesting
19:42:17 < boom1992> KMimeType::findByUrl
19:42:25 < boom1992> looks interesting for non http-hosts
19:43:00 < uwolfer> boom1992: ..or even for http...
19:44:00 < boom1992> but is not for HTTP ( cgi scripts! )
19:44:03 < boom1992> ?
19:44:16 < boom1992> seems that I not read all messages today :P :D
19:44:29 < uwolfer> :D
19:44:36 < uwolfer> ok
19:55:15 < eliasp> do you think MIME type based download directories are doable (at least for HTTP)
20:00:51 < boom1992> eliasp: not sure, but it would be cool... I think we should talk with manolo about this
20:01:54 < eliasp> ok, should i file a wish bug about it to remember it? or was it enough telling you about this idea...?
20:05:02 < boom1992> eliasp: pls file a wishlist, else I could forget it :PP