[haiku-bugs] Re: [Haiku] #10067: Extension should determine file type with same sniffer rule
- From: "Giova84" <trac@xxxxxxxxxxxx>
- Date: Fri, 03 Jun 2016 13:18:49 -0000
#10067: Extension should determine file type with same sniffer rule
---------------------------------+-----------------------------------
Reporter: humdinger | Owner: bonefish
Type: enhancement | Status: new
Priority: normal | Milestone: R1
Component: Servers/registrar | Version: R1/Package Management
Resolution: | Keywords:
Blocked By: | Blocking: 10917
Has a Patch: 0 | Platform: All
---------------------------------+-----------------------------------
Comment (by Giova84):
Hi, I have a suggestion for the implementing of this enhancement.
For those which aren't aware, there is an Haiku app called Filer
(Humdinger certainly know this app ;-) ):
https://github.com/HaikuArchives/Filer
Well, let's see the readme of this app:
[[BR]]
Filer is an automatic file organizer. It takes the files it's opened with
or that are dropped on it and moves, renames, copies or does all sorts of
other things with them according to rules created by the user.
Filer is accompanied by AutoFiler. Instead of working on a set of files
provided by the user, it can be started (automatically with Haiku) to
monitor certain folders and deal with new files appearing there according
to the user-defined rules.
[[BR]]
In practice, the "Autofiler" element, [#point2 is able to monitor folders
on the system and automatically performs a bunch of actions, also
including shell commands; for some parts it acts like a sort of
registrar.]
'''The following is an example on my system:'''
As Humdinger stated
''RAR archives and CBR (a comic book archive, consisting of rar-archived
images) both have the rule '("Rar!")'. Naturally, since they are both RAR
archives. In this case, the file extension should decide if it's a .rar or
a .cbr.''
Well, on my system I manage *.cbr files (I can open them using a QT *cbr
and *cbz reader), and when I place them in my system (inside of certain
folders), AutofileFiler, thanks to Filer, will automatically launch the
following commands on such files, which end with the *.cbr and *.cbr
extension
{{{
settype -t application/x-cbr
settype -t application/x-cbz
}}}
[[Image(
http://s33.postimg.org/6fb28674v/Autofiler_CBR_Rule.png)]]
In this way I finally avoid the confusion with *.zip and *.rar archives
(because if i set the same sniffing rule for *.cbr and *.cbz, zip and rar
files will be mistakenly marked as cbr and cbz).
In facts now I lowered the value of the sniffing rule:
{{{
Rule for *.cbr
0.10 ("Rar!")
}}}
{{{
Rule for *.cbz
0.10 ("PK")
}}}
But thanks to Filer/AutoFiler, these files are properly recognized also
with the lower value "0.10"
[=#point2]So: would be the case to grab/borrow the code from
Filer/AutoFiler and implement this feature inside the registrar?
--
Ticket URL: <
https://dev.haiku-os.org/ticket/10067#comment:3>
Haiku <
https://dev.haiku-os.org>
Haiku - the operating system.
Other related posts: