[fpc-pascal] Indexing files
Michael Van Canneyt
michael at freepascal.org
Sat Dec 15 22:55:24 CET 2012
On Sat, 15 Dec 2012, Krzysztof wrote:
> Hi,
> I need similar functionality like mp3 players have (e.g rhythmbox, banshee, clementine). I have some experience with databases (I worked in company which make
> ERP systems), but don't know how to connect it with file handling.
>
> My general questions are:
> 1. I have big collection of music. First indexing in random music player take some time, but refreshing collection take only a second. How they do this? They
> are saving folders last change date?
When indexing the first time they must see if a file is known or not. This takes time.
During refresh they know the names, they just need to update.
> 2. Some players have option which detect when collection is changed and automatically can refresh it (even if player is actually running). How it works? Some
> hook for folders?
The inotify calls are available on Linux. It tells you when a file/folder changes:
function inotify_init: cint;
function inotify_init1(flags:cint):cint;
function inotify_add_watch(fd:cint; name:Pchar; mask:cuint32):cint;
These calls are available in the linux unit. I have an article that describes how it works, if you want.
There is a similar mechanism on windows, but I haven't had time to look at it yet:
I wanted to make a unified architecture for this kind of things.
Michael.
More information about the fpc-pascal
mailing list