Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Album duration possible?
07-08-2022, 16:54
Post: #21
RE: Album duration possible?
(07-08-2022 16:24)KreTR Wrote:  I am reading this thread and I cannot understand it. Is it possible to display the duration of an album? How can this be done?

The Lumïn app can give you this information in a couple of taps:
long tap on any album track
the track information window will show up
the first line is the album name, tap on it
… and the album with all tracks will show up, in the first line, on the right, the album duration is displayed (in minutes:seconds)


Attached File(s) Thumbnail(s)
       
Find all posts by this user
Quote this message in a reply
07-08-2022, 17:19
Post: #22
RE: Album duration possible?
(07-08-2022 16:24)KreTR Wrote:  I am reading this thread and I cannot understand it. Is it possible to display the duration of an album? How can this be done?

The responsibility to display album duration is that of your control point (I know BubbleUPnP does as does Lumin by the sounds of it), so if your control point of choice doesn't display it natively then the only way to display it would be as @entdgc suggested, create a tag and have MinimServer display it.
If you don't think you can follow the instructions that I laid out in this thread, or you're not on Windows then I think you're out of luck without changing control points.
Find all posts by this user
Quote this message in a reply
08-08-2022, 21:22
Post: #23
RE: Album duration possible?
The application I am using is DCS Mosaic. I can use a computer with Windows 10. Can I ask for a detailed step-by-step instruction on what to do to display the duration of the album. Best regards Robert
Find all posts by this user
Quote this message in a reply
08-08-2022, 23:33 (This post was last modified: 09-08-2022 08:44 by simbun.)
Post: #24
RE: Album duration possible?
(08-08-2022 21:22)KreTR Wrote:  The application I am using is DCS Mosaic. I can use a computer with Windows 10. Can I ask for a detailed step-by-step instruction on what to do to display the duration of the album. Best regards Robert

Before going through the process of adding the tags it might be worth manually adding the duration to an album and seeing what it looks like in your control point first.
The instructions below assume that you're using a tag called album_duration, so add that tag with a value of '53:28' (the default format used in the code below) to all the files belonging to an album.

I don't know where you want to see the album_duration tag, but let's add it to the album display:
Code:
itemTags: album_duration
tagFormat: Album.displayFormat={$album^$album_duration^ [^]}
Or just append '^$album_duration^ [^]' to your existing Album.displayFormat if you already have one.

Restart MinimServer and find the album in your control point. If you're happy with how it looks, move on to generating the tag for the rest of your files.

Here's a slightly updated version of the original instructions:

Firstly, create a directory containing copies of your music to play with. It doesn't have to be much, a dozen albums or so is probably enough (if you get comfortable with foobar it can produce truncated versions of your files useful for testing as they contain all the tags but only occupy a fraction of the space).

Download the latest foobar and the sqlite plugin.
  • Run foobar2000_v1.6.11.exe, choose 'Custom', choose 'Portable installation' and select a path.
  • Allow the installer to 'Run foobar2000' and pick the 'Album List + Properties (tabbed)' layout with whatever colour you want.
  • Select the menu item 'File > Preferences > Media Library' and specify the path of your test music.
  • Whilst still in the Preferences window, click 'Components > Install' and select foo_sqlite.fb2k-component.
  • Click 'Apply', then OK to restart, and foobar should scan your library and display the contents on the left hand side.
  • Go back to 'File > Preferences > Media Library > SQLite utilities > Playlist table' click 'Add defaults', then add the tag that you want to store the album duration in (just put the name in the Name property and click OK). The following sql assumes album_duration.
  • Drag some files from the left pane (Album List) to the right pane (playlist window).
  • Select 'Library > SQLite console' and a popup window should appear.
  • Copy the following code into the window and Execute it.

Code:
select album,
       coalesce("album artist", artist) as artist,
       date,
       format_length_hours(sum(length_seconds)) as album_duration
ffrom Playlist
where playlist_index = active_playlist()
group by album,
         coalesce("album artist", artist),
         date;
NOTE: Change ffrom to from (I had to change that to be able to post the code)

The above example assumes that [album AND ("album artist" OR artist) AND date] uniquely identifies an album, if that's not the case let us know how you achieve this in your collection.

You should see the total duration of each album in the grid below the sql.

The query is using the tracks you've added to the Playlist window, so if you've only added half an album, the duration will reflect that. You can use 'from MediaLibrary' instead of 'from Playlist where playlist_index = active_playlist()' in the query and that will act on your whole library, but you need to be careful, and you'd need to add the tag to the 'SQLite viewer > MediaLibrary table' just as you did earlier to the 'Playlist table'.

If you don't like the display of the duration it's possible to format it using printf e.g.
Code:
printf('%02dh:%02dm:%02ds', sum(length_seconds)/3600, (sum(length_seconds)%3600)/60, sum(length_seconds)%60) as album_duration

Assuming that the sql above is working, now you just need to run the code that updates the tags on the files in the playlist.

Code:
drop table if exists albumSummary;
ccreate temp table albumSummary as
  select album,
         coalesce("album artist", artist) as artist,
         date,
         format_length_hours(sum(length_seconds)) as album_duration
  ffrom Playlist
  where playlist_index = active_playlist()
  group by album,
           coalesce("album artist", artist),
           date;

uupdate PlaylistUpdatable
       set album_duration = albumSummary.album_duration
  ffrom albumSummary
  where     playlist_index = active_playlist()
        and PlaylistUpdatable.album = albumSummary.album
        and coalesce(PlaylistUpdatable."album artist", PlaylistUpdatable.artist) = albumSummary.artist
        and PlaylistUpdatable.date = albumSummary.date;

drop table if exists albumSummary;
NOTE: I've had to use ccreate, ffrom and uupdate on this one.

At that point, check your files tags to make sure it hasn't changed anything unexpected. If you're using flac it should be fine, if mp3 then there are options to check to make sure it's writing the correct version (File > Preferences > Advanced > Tagging).

Before you run it on any of your real music make sure you have a backup (which you should have anyway).
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


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