Thank you for your donation!


Recently Added Music
#11
(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 :-)
Reply
#12
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.

Regards,
Kent
Reply
#13
(03-29-2019, 12:21 PM)Tim Curtis Wrote:
(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 don't know too much about smart playlists but it seems like the above could be scripted and added to the api in /www/command/ ?

I would probably add three playlists, 30, 60 and 90 days compile files into those lists and then mpc load 90. If we do more stuff like that people can build their own web front ends as a way to manage moode without using ssh.

Thinking about the bash profile, it could be a UI that has a bunch of checkboxes that then generates and overwrites the bash profile based on what the user has configured in a wizard.
--

GitHub, Spotify and Resonate : @duracell80

My jam: ambient, lush vocals, synths and acoustic guitars
Reply
#14
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.
Reply


Forum Jump: