Thank you for your donation!

Recently Added Music
(03-29-2019, 09:55 AM)ibeex Wrote: in mean time you can ssh to moode and use this to add n last days

pi@moode:~$ cat .bash_profile
function add-recents {
  find /media -type f -mtime -$1 | sed 's/\/media/USB/g' | mpc add

then 'add-recents 60' adds last 60 days off music

Nice :-)
I love hacks which respect the Tao of Unix and create a pipeline of commands. Very nice.

For the Unix/Linux-challenged user, however, we should point out that this function is a basically a proof of concept. 

<the following are notes for the unwary, not criticism of the concept, which I think is cool.>

As written, it looks for new files only on locally mounted (USB) drives. More work is needed to make it also look for new files on a remote NAS or even on the SDCARD. 

Also, this function will point MPD to any file which meets the age criterion. If, say, such a file happens to be a PDF file (perhaps containing album-liner notes), MPD will spit out an "error adding <the PDF file>: No such directory" message and not add any tracks to the playlist (don't ask me how I know!). I expect it will choke the same way on other unexpected file types.

No doubt the work item on Tim's TODO list will include refinements to the proof of concept  Rolleyes

Finally, it may not be obvious to a new user that the .bash_profile file containing the function definition has to be created in the home directory or edited to include the definition if the file already exists. That "cat .bash_profile" command in the @ibeex's post is merely echoing the content of his existing file.

Our project needs additional developers to code and test all these nice ideas otherwise they will just gather dust because the TODO list is already way under funded.

Forum Jump: