Calculation of the newest library entries #2000
Replies: 1 comment 1 reply
-
|
I am curious to know if a root cause was ever found on why the Latest feature was working fine in earlier releases but now gives different behavior in recent releases (via code review). Perhaps if would be easier to keep track of the Latest ("recently added") album(s) by evaluating the album titles(s) while rebuilding / updating the library. A field could be added to the MPD library (or similar data structure) to keep track of whether an album has already been added to the library or if it is new to the library since the last library update which would then be used to populate the Latest album list. This would also bypass the various issues of sorting behaviors, track date tag usage, what file format the music library is stored on, network (NFS, CIFS) or USB shares, etc. that you mentioned. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
EDIT Nov 21: Some typos
Some investigations (#1971 (reply in thread)) identified that the LATEST count and the LATEST albums are wrong in rAudio if one or more albums contain tracks with different tag values of "DATE", let's say (n) different "dates", than they are (n) equal entries in albumbyartist-year.
The tag value "DATE" is commonly used by the record company to store the release date of an album. But I think this a not the intended purpose of "DATE". For example, the FLAC specification explicitly defines the tag DATE as the date the track was recorded. That's the way I'm using the DATE tag.
@Sagnasty
Therefore let me present a different algorithm using linux shell commands (e.g. outside of the rAudio GUI) to sort the albums from newest to oldest ones together with their respective age.
I'm using a step-by-step approach for better understanding. (I'm not an experienced shell programmer at all.)
Step 1: Specify leaves in the directory tree, e.g. directories whithout subdirectories
Assumption: All audio files are contained in a leave directory .
You have to consider whether the music library is presented by a) a linux filesystem (e.g. ext4 filesystem connected via USB) or a NFS share (not tested) or b) a general algorithm which works on e.g. a NTFS formatted disk (USB) or a CIFS share.
First go to the root of your music library (all commands executed on rAudio):
cd /mnt/MPD/NAS # or cd /mnt/MPD/SD or cd /mnt/MPD/USBCase a) using the so-called link-count is particularly elegant and fast, but works only on a linux filesystem.
find . -type d -links 2 > ~/leaves.txtCase b) on the other side runs on any filesystem type:
find . -type d \( -exec sh -c 'find "$1" -mindepth 1 -maxdepth 1 -type d -print0 | grep -cz "^" >/dev/null 2>&1' _ {} \; -o -print \) > ~/leaves.txtComment: This command is a "hack" calling for improvement regarding readability.
Step 2: Compute an unsorted list of the age in days of the leaf directories
while IFS= read -r line; do sh -c "echo -n $(((($(date +%s) - $(date -r "$line" +%s)))/86400))"; echo " " $line; done <~/leaves.txt >~/unsorted.txtComments:
Step 3: Sort the list
These are the first lines of my sorted.list
Vivaldi is 4 days old, Harp Consort 7 days, Haydn 16 days.
Any comment is highly appreciated, be it questions, criticism, improvements, suggestions for integration in rAudio, ...
Beta Was this translation helpful? Give feedback.
All reactions