Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Idea: Progress bar for scanning new library
#1
Lightbulb 
When you add a new library, and scan it for music, there is an indefinite progress icon near to the menu icon to indicate that it is working on scanning. It would be nice to have a progress bar to indicate how far along you are in the scanning process. To facilitate this use the following command,  "find dirctory -type d -links 2 | wc -l", to quickly find how many leaf directories (directories that do not contain sub-directories) are found in 'directory'. The command args are:

directory - where to search
-type d - only select file system objects that are directories
-links 2 - directories that only contain links to parent ('..') and self ('.'), no sub-directories
wc -l - count the number of directories returned by the find command

Then, as each directory is finished you can update the progress bar. Of course, this is assuming that directories containing music do not contain sub-directories.


Thanks!

----
Now, we can do this the hard way, or... well, actually there's just the hard way.

  -- Buffy Summers, "Buffy the Vampire Slayer"
Reply
#2
How do you determine "as each directory is finished"?
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#3
Some rough idea, you could update directory by directory with --wait directive, that way u know when each directory is done

Code:
IFS=$'\n'
directory=$(find -L /var/lib/mpd/music/ -type d -links 2 -printf '%P\n')

for d in $directory
do
   mpc update --wait d
   <update progress bar>
done
Reply
#4
Doing a progress bar for MPD DB update is tricky because MPD only emits events indicating start and end of update. I suppose the MPD log could be monitored since it records any updates made to files. There can also be multiple updates running / queued which could be a complication.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Forum Jump: