Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: automatically add new files from music directory? (Read 3733 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

automatically add new files from music directory?

Is there any plugin that can look into your music directory and automatically add any files not currently in your playlist? If not, i'd really like to see this!

automatically add new files from music directory?

Reply #1
I have never seen this plugin but this a good idea. 
Someone to program it?

automatically add new files from music directory?

Reply #2
When I used Winamp, I used this plugin.
I don't think it is not to hard to program:

1) option for selection the playlist, which should only contain files of a specific folder (including subfolder)
2) The harder part: Write a folderwatcher
3) On folderwatcher add a file, add it to the playlist

automatically add new files from music directory?

Reply #3
This has been asked a million times before.

Please use the search function.

automatically add new files from music directory?

Reply #4
Quote
2) The harder part: Write a folderwatcher


(psuedocode)
Code: [Select]
function check_folder_for_new_songs(string folder)
{
  while (file=getnextfile(folder))
  {
      if ( file_is_a_directory(file) )
          check_folder_for_new_songs(file);
      else if (! is_file_in_playlist(file,playlist) )
          add_file_to_playlist(playlist,file);
      sleep();  // give up the timeslice to prevent CPU hogging during this process
  }
}



automatically add new files from music directory?

Reply #5
Quote
This has been asked a million times before.

Please use the search function.

I only saw one in the General forum... Didnt get much attention.

Anyways, it could either watch the folder for new files, or have you press a button to load any new files? Either way would be great.

automatically add new files from music directory?

Reply #6
Quote
When I used Winamp, I used this plugin.
I don't think it is not to hard to program:

1) option for selection the playlist, which should only contain files of a specific folder (including subfolder)
2) The harder part: Write a folderwatcher
3) On folderwatcher add a file, add it to the playlist

I wrote a plugin for Winamp that did this.  It simply watched the specified folders for additions, deletions, name changes, etc.  and then updated the playlist accordingly.

There is an easy way to implement this using the Win32 API instead of using something like the pseudo-code posted a few replies back.

FindFirstChangeNotification
FindNextChangeNotification
FindCloseChangeNotification

is the API that makes this pretty simple to implement and it is efficient since it is event driven vs. polling the directory contents.

Also, I might be wrong here, but I got the impression from a quick look at the 0.8 change log that foobar is doing some type of file or folder monitoring.  If this is true, is this functionality exposed in the 0.8 SDK for use by third party components?

automatically add new files from music directory?

Reply #7
danz, afaik it does that only on files in the database / playlist to decide whether to reload tags from a file or not ... and from my observation it checks for size / date changes when it plays an item and maybe during any file-processing, i.e. when files are drag'n'dropped, added etc.

automatically add new files from music directory?

Reply #8
Quote
There is an easy way to implement this using the Win32 API instead of using something like the pseudo-code posted a few replies back.

FindFirstChangeNotification
FindNextChangeNotification
FindCloseChangeNotification

is the API that makes this pretty simple to implement and it is efficient since it is event driven vs. polling the directory contents.

True, except that using the change notifications thing will only tell you files that have changed since you started watching the folder in question. That is, you Start the first change notification, then get back what changes in there.. If something changed while your program was shut down, then you never notice it this way.

Oh, and if you run this for long periods of time, like in a service, it stops working for no reason after a while. You simply stop getting that event back. Never have figured out why it stops telling you when things change, it just happens. On NT systems it seemed to stop more often, but after a month or two of running, it stops working on 2K/XP systems as well. Polling on a timer and sleeps may be ugllier, but it's more reliable in the long term. It's also easier to port to other platforms (not that that matters in this case).

Anyway, I'm offtopic now.