Skip to content

Commit

Permalink
[music-library.php] Improve rate fetch from dsf/dff files
Browse files Browse the repository at this point in the history
- Fallback to "file" command when mediainfo return is empty for dsf/dff files.
- Refer to this comment
// NOTE: Mediainfo called via sysCmd() i.e. exec() returns nothing if the file name contains accented chars

Co-Authored-By: improve <[email protected]>
Co-Authored-By: some <[email protected]>
  • Loading branch information
3 people committed Feb 5, 2025
1 parent 75e0f98 commit d8eac5a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions www/inc/music-library.php
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,13 @@ function getEncodedAt($songData, $displayFormat, $calledFromGenLib = false) {
} else if ($ext == 'dsf' || $ext == 'dff') {
// DSD file
$result = sysCmd('mediainfo --Inform="Audio;file:///var/www/util/mediainfo.tpl" ' . '"' . MPD_MUSICROOT . $songData['file'] . '"');
if ($result[1] == '') {
$result = syscmd('file -b ' . '"' . MPD_MUSICROOT . $songData['file'] . '"' .
' | grep -o "2822400\|5644800\|11289600\|22579200\|45158400"');
$result[1] = $result[0];
$result[2] = '2';
}

if ($result[1] == '') {
$encodedAt = '?';
} else {
Expand Down

0 comments on commit d8eac5a

Please sign in to comment.