Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating a New Music library view
04-03-2019, 12:29
Post: #1
Creating a New Music library view
Hi,
This may have been discussed previously in the minimserver forums, but I could not find it.
I have been using minimserver for many years now, and on different NAS systems, among others Synology, Netgear etc, and now on one of the recent QNAP ARM NAS systems. After the first few kinks, all installations worked flawlessly.
Although I was once a programmer in the dark ages of computing (i.e. I started way before GUI's like Windows and Mac became the norm), I can not come to grips with the innards of minimserver to include some tweaks. I can get it up & running and I'm always impressed with its speed and compatibility with many Android & iOS control point apps. Where other servers fail, minimserver always seems to deliver!

There is one feature that I desperately miss though, and that is a "New Music" library view, ultimately accessible in the control point software. The standard views are all there of course, but I don't have a clue as to how to create such a library view (if that's even the right term). An example of this would be the 'New Music' library view in 'My Music' of LMS. It's configurable as to how much items (albums!) it would hold (some 200 would do it) and over how many pages it will be displayed (divided). I attached a screen shot of a friend's LMS system showing the library views.
   
This library view would hold the 200 last added (or edited) albums. It seems to be based on the date & time of the files. They are presented as any other album, so not a collection of separate files, though one can drill down to file level, tag level and properties level etc., just like with any other album view. I have included a second screen shot (called "Inside 'New Music' library view") to display the contents of the "New Music" view.
   
My question is: can such a library view be implemented or added to minimserver? And if so, can anyone provide me with a step-by-step guide or a shell script to do so (remember: Dark Ages!). The best thing for me would obviously be that it would become a standard feature of future releases of minimserver, so that the library view is already there after installation.

Cheers,
Marco
Find all posts by this user
Quote this message in a reply
05-03-2019, 07:36
Post: #2
RE: Creating a New Music library view
It's on Simon's to-do I think.
There is a workaround but it requires tags.
Find all posts by this user
Quote this message in a reply
05-03-2019, 09:57
Post: #3
RE: Creating a New Music library view
Thanks for this post. There have been previous discussions of this feature and it is probably the most important and frequently requested feature that MinimServer doesn't provide.

There are some technical issues with adding this feature because of the way MinimServer is designed. In particular, the inclusion of albums based on the date the album was added or edited means that making tagging changes to a file would result in its moving up to the top of the list. A mass tagging operation that affects more than 200 albums would completely replace (effectively destroy) the list.

Solving this problem requires a change in how MinimServer holds information about the music library. This change could involve storing a "last added" date for every file, separate from the files themselves. Alternatively, MinimServer could maintain an ordered list of files added (most recent first). Either of these would be a substantial amount of work because it would affect other aspects of how MinimServer is designed and implemented. This work would need to fit in with other work on MinimServer and my available time taking into account various other commitments.

Although I cannot make a commitent to any specific timescale for doing this, I am aware of its importance and it is a hgh priority.
Find all posts by this user
Quote this message in a reply
05-03-2019, 12:05
Post: #4
RE: Creating a New Music library view
In the tagUpdate file is there any way of specifying a match instruction to match a missing/empty/* tag?

The reason I ask is because I was going to write a script that created a crude "most recently added" filter utilising the tagUpdate functionality, but I couldn't get it to work so gave up.

I was trying to use something like:
@RECENTLYADDED=
&ALBUM=The SMiLE Sessions
&ALBUMARTIST=Beach Boys, The
&DATE=2011
=RECENTLYADDED=1

then use 'RecentlyAdded=1' in indexTags.
Find all posts by this user
Quote this message in a reply
05-03-2019, 12:27
Post: #5
RE: Creating a New Music library view
Thanks guys, for the quick responses. I understand that it is not a trivial matter, much to my relief. Also, apparently you can't just use an existing open source software module because of MinimServer's structure.

As to changing tags of existing library items, that would indeed copy the changed files (as albums!) right back into the New Music view after a rescan. My friend demonstrated that with his fully up-to-date LMS 7.9.2 system. I tried LMS a few years back but wasn't impressed with either its performance (MinimServer really sets the benchmark here), LMS's (in)compatibility with a number of control point apps, its plugin system (some are very complicated e.g. the Airplay, UPnP and Chromecast plugins) and a number of quirks (bugs).

I'm guessing if a mass tagger application (mp3tag ?) would have the option to retain the original date/time stamp of the files, the retagged files would not return to the New Music view. However, my LMS friend also said that if one edits the tags of only **some** files of an album, only those edited files would be displayed within New Music --> Albums view or even duplicate Albums with different contents (one having the unedited files, the other the retagged ones), but luckily not in the standard library views AFAIK. Ideally a software routine would be needed to avoid this situation. To resolve this situation in LMS now, apparently a complete new library scan is needed, deleting the existing database and building a new database from the ground up.

Thanks & cheers,
Marco
Find all posts by this user
Quote this message in a reply
06-03-2019, 10:02
Post: #6
RE: Creating a New Music library view
(05-03-2019 12:05)simbun Wrote:  In the tagUpdate file is there any way of specifying a match instruction to match a missing/empty/* tag?

The reason I ask is because I was going to write a script that created a crude "most recently added" filter utilising the tagUpdate functionality, but I couldn't get it to work so gave up.

I was trying to use something like:
@RECENTLYADDED=
&ALBUM=The SMiLE Sessions
&ALBUMARTIST=Beach Boys, The
&DATE=2011
=RECENTLYADDED=1

then use 'RecentlyAdded=1' in indexTags.

You can't match a missing tag but there is no need to do this. To add a RECENTLYADDED tag to this album, you can put the following in your tag update file:

@ALBUM=The SMiLE Sessions
&ALBUMARTIST=Beach Boys, The
&DATE=2011
+RECENTLYADDED=1

or even simpler if you don't have any other albums with this title:

@ALBUM=The SMiLE Sessions
+RECENTLYADDED=1
Find all posts by this user
Quote this message in a reply
06-03-2019, 10:11
Post: #7
RE: Creating a New Music library view
(05-03-2019 12:27)Denon DL304 Wrote:  I'm guessing if a mass tagger application (mp3tag ?) would have the option to retain the original date/time stamp of the files, the retagged files would not return to the New Music view. However, my LMS friend also said that if one edits the tags of only **some** files of an album, only those edited files would be displayed within New Music --> Albums view or even duplicate Albums with different contents (one having the unedited files, the other the retagged ones), but luckily not in the standard library views AFAIK. Ideally a software routine would be needed to avoid this situation. To resolve this situation in LMS now, apparently a complete new library scan is needed, deleting the existing database and building a new database from the ground up.

Some taggers provide the option to leave the date/time of the file unchanged when editing tags. This isn't recommended with MinimServer because it can mean that MinimServer doesn't read the updated tags in the file when doing a rescan because it thinks there haven't been any changes.

The issues you have described are some examples of the complexities involved in implementing a solution that "just works" as users would expect.
Find all posts by this user
Quote this message in a reply
06-03-2019, 13:03
Post: #8
RE: Creating a New Music library view
(06-03-2019 10:11)simoncn Wrote:  Some taggers provide the option to leave the date/time of the file unchanged when editing tags. This isn't recommended with MinimServer because it can mean that MinimServer doesn't read the updated tags in the file when doing a rescan because it thinks there haven't been any changes.

Thanks for that info, quite important when messing about with tagging. So this might mean, as an example, that when I change a tag like Genre, from say "Classical" to "Opera" AND I apply an option like "Keep original time & date of files", a rescan would not pick that up? Or is this restricted to some tags and not others?

Cheers,
Marco
Find all posts by this user
Quote this message in a reply
06-03-2019, 16:19 (This post was last modified: 06-03-2019 16:23 by simoncn.)
Post: #9
RE: Creating a New Music library view
When you do a rescan, MinimServer checks the file length and timestamp. If both of these are the same as when the file was last scanned, the file is not scanned again. Minor tag changes often leave the file length the same.

You can force a full rescan of all files by setting the startupScan property to "full" before you rescan. You shouldn't use this as a permanent setting because it makes a rescan take much longer.
Find all posts by this user
Quote this message in a reply
06-03-2019, 18:26
Post: #10
RE: Creating a New Music library view
(06-03-2019 10:02)simoncn Wrote:  You can't match a missing tag but there is no need to do this. To add a RECENTLYADDED tag to this album, you can put the following in your tag update file:

@ALBUM=The SMiLE Sessions
&ALBUMARTIST=Beach Boys, The
&DATE=2011
+RECENTLYADDED=1

No idea how I missed that, sorry.

In that case my crude script will work. I only have flac so it searches for the latest 500 flac files (could be any number depending on how many albums you want to flag), loops through them in a time based order until it finds 10 albums (which are uniquely identified in my tags by ALBUM, ALBUMARTIST and DATE) then writes those out to a tagUpdate file.
I'm not addressing the scenario where I batch update files as I don't do that often. I then just have to add "RecentlyAdded=1" to indexTags.

This software continues to surprise me with how flexible it is!

Code:
#!/bin/bash

nLatestAlbums=10
musicRoot="/media/music"
tagUpdateFile="/media/music/tagUpdate.txt"


isInArray () {
  local e match="$1"
  shift
  for e; do
    [[ $e == $match ]] && return 0
  done
  return 1
}

nCount=0
> "$tagUpdateFile"

IFS='|'

# look at the first 500 files, modified in the last 60 days
find "$musicRoot"/ -name "*.flac" -type f -mtime -60 -printf '%T@ %p\n' | sort -k1,1nr | head -500 | cut -f2- -d" " |
{
while read fname; do

  albumKey=$(metaflac --list --block-type=VORBIS_COMMENT "$fname" | egrep -i ": (album=|albumartist=|date=)" | cut -f2- -d":" | sort -k1,1 -t'=' | cut -f2- -d"=" | tr '\n' '|')

  if [[ $albumKey != $lastAlbumKey ]]; then
    echo "$albumKey"

    isInArray "$albumKey" "${latestAlbums[@]}"
    if [[ $? -ne  0 ]]; then
      albumAttrs=($albumKey)
      echo "@ALBUM=${albumAttrs[0]}"$'\n'"&ALBUMARTIST=${albumAttrs[1]}"$'\n'"&DATE=${albumAttrs[2]}"$'\n'"+RECENTLYADDED=1" >> "$tagUpdateFile"

      nCount=$((nCount+1))
      if [[ $nCount -eq $nLatestAlbums ]]; then
        break
      fi
      latestAlbums+=("$albumKey")

    fi
    lastAlbumKey=$albumKey

  fi
done
}
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)