Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-12

Indexing files

11 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Krzysztof

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?
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?

Any tips, algorythms are welcome. Oh, I need this for linux and windows targets

Regards

Reply by email

Michael Van Canneyt
to Krzysztof
Krzysztof wrote 7 lines
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.

Reply by email

Marco van de Voort
to Michael Van Canneyt

In our previous episode, Michael Van Canneyt said:

Show quoted text 9 lines
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.

I think Ales was at some point working on having a common kevent +inotify support unit. (Kevent is the OSX/BSD variant)

Reply by email

Michael Van Canneyt
to Marco van de Voort
Marco van de Voort wrote 13 lines
In our previous episode, Michael Van Canneyt said: > 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. I think Ales was at some point working on having a common kevent +inotify support unit. (Kevent is the OSX/BSD variant)

Really ? Maybe it could be added to the fcl-base ?

Michael.

Reply by email

Tomas Hajny
to Michael Van Canneyt
Michael Van Canneyt wrote 17 lines
On Sun, 16 Dec 2012, Marco van de Voort wrote: > In our previous episode, Michael Van Canneyt said: >> 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. > > I think Ales was at some point working on having a common kevent +inotify > support unit. (Kevent is the OSX/BSD variant) Really ? Maybe it could be added to the fcl-base ?

If so, make sure to make it a separate unit and enable this unit in fpmake.pp for the supported targets only, because I don't think that such a functionality exists for OS/2 (not even mentioning other targets supporting fcl-base like go32v2)...

Tomas

Reply by email

Marco van de Voort
to Tomas Hajny

In our previous episode, Tomas Hajny said:

Show quoted text 9 lines
> > I think Ales was at some point working on having a common kevent +inotify > > support unit. (Kevent is the OSX/BSD variant) > > Really ? Maybe it could be added to the fcl-base ? If so, make sure to make it a separate unit and enable this unit in fpmake.pp for the supported targets only, because I don't think that such a functionality exists for OS/2 (not even mentioning other targets supporting fcl-base like go32v2)...

I think that was what it stalled on. Ales not wanting to abstract windows at that time.

IMHO packages in FCL should at least support the core platforms.

Reply by email

Michael Van Canneyt
to Marco van de Voort
Marco van de Voort wrote 15 lines
In our previous episode, Tomas Hajny said: >>> I think Ales was at some point working on having a common kevent +inotify >>> support unit. (Kevent is the OSX/BSD variant) >> >> Really ? Maybe it could be added to the fcl-base ? > > If so, make sure to make it a separate unit and enable this unit in > fpmake.pp for the supported targets only, because I don't think that > such a functionality exists for OS/2 (not even mentioning other > targets supporting fcl-base like go32v2)... I think that was what it stalled on. Ales not wanting to abstract windows at that time. IMHO packages in FCL should at least support the core platforms.

I will have a 's on my todo anyway.
If Ales has a OSX/BSD variant, then that would be helpful.

Michael.

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt: When indexing the first time they must see if a file is known or not. This takes time.…
Michael Van Canneyt wrote
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.

I created a truly single source cross-platform system for this. Register your interest (file, directory or everything), and a background thread does the work freeing up your UI. I don't use any OS specific API's, and it is still fast.

Regards,
- Graeme -

Reply by email

Reinier Olislagers
to Krzysztof: And which database you prefer? I don't need complicated functionality. The most important…
Krzysztof wrote
And which database you prefer? I don't need complicated functionality. The most important is insert speed and it must be embedded. I'm thinking of SQLight, DBF or Firebird Embedded

I'd probably go with SQLite or Firebird embedded.

SQlite is probably a bit easier to deploy and e.g. available on OSX by default anyway... however, I like Firebird's features and the fact that you can change to a client/server setup without changing code. So it depends on your requirements.

Reply by email