Skip to content

Commit

Permalink
Track DR enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
ArturSierzant committed Sep 8, 2018
1 parent 41cc6bc commit 7fe9555
Show file tree
Hide file tree
Showing 10 changed files with 151 additions and 37 deletions.
1 change: 1 addition & 0 deletions about.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ function about() {
<td>
<ul style="padding-left: 1em;">
<li> added 'Show favorite tracks' for selected genre</li>
<li> added info about Track Dynamic Range in track lists (settable in config.inc.php)</li>
<li> fixed bugs</li>
</ul>
<br>
Expand Down
11 changes: 7 additions & 4 deletions ajax-album-playlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@
<td class="textspace track-list-artist"></td>
<td class="time pl-genre"><?php if ($showGenre) echo'Genre'; ?></td>
<td></td>
<td align="right" class="time pl-tdr">DR</td>
<td align="right" class="time">Time</td>
<?php if ($cfg['show_DR']){ ?>
<td class="time pl-tdr">DR</td>
<?php } ?>
<td align="right" class="time time_w">Time</td>
<td class="space right"><div class="space"></div></td>
</tr>
<?php
Expand Down Expand Up @@ -191,13 +193,14 @@
<i class="fa fa-star<?php if (!$isFavorite) echo '-o'; ?> fa-fw" id="favorite_star-<?php echo $tid; ?>"></i>
</span>
</td>

<?php if ($cfg['show_DR']){ ?>
<td class="pl-tdr">
<?php
$tdr = $track['dr'];
$tdr = ($track['dr'] === NULL ? '-' : $track['dr']);
echo $tdr;
?>
</td>
<?php } ?>

<td align="right"><?php echo formattedTime($track['miliseconds']); ?></td>
<td></td>
Expand Down
17 changes: 14 additions & 3 deletions include/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,20 @@



// +------------------- NEW IN O!MPD 1.04 ----------------------------------+
// +------------------- NEW IN O!MPD 1.05 ----------------------------------+

// +------------------------------------------------------------------------+
// | Track dynamic range |
// +------------------------------------------------------------------------+
// | Show DR colum for track in Now Playing, album view and search results. |
// +------------------------------------------------------------------------+

$cfg['show_DR'] = false;


// +------------------- END OF NEW IN O!MPD 1.05 ---------------------------+




// +------------------------------------------------------------------------------+
Expand Down Expand Up @@ -128,8 +141,6 @@



// +------------------- END OF NEW IN O!MPD 1.04 ---------------------------+


// +------------------------------------------------------------------------+
// | Multi-disc |
Expand Down
46 changes: 41 additions & 5 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,10 @@ function view2() {
<td>Album&nbsp;</td>
<td class="time pl-genre">Genre&nbsp;</td>
<td class="icon"></td><!-- star -->
<td align="right" class="time">Time</td>
<?php if ($cfg['show_DR']){ ?>
<td class="time pl-tdr">DR</td>
<?php } ?>
<td align="right" class="time time_w">Time</td>
<td class="space right"></td>
</tr>

Expand All @@ -912,7 +915,7 @@ function view2() {
$search_string = get('artist');

$queryTA = mysqli_query($db,'SELECT * FROM
(SELECT track.artist as track_artist, track.title, track.featuring, track.album_id, track.track_id as tid, track.miliseconds, track.number, track.relative_file, track.genre, album.image_id, album.album, album.artist
(SELECT track.artist as track_artist, track.title, track.featuring, track.album_id, track.track_id as tid, track.miliseconds, track.number, track.relative_file, track.genre, track.dr, album.image_id, album.album, album.artist
FROM track
INNER JOIN album ON track.album_id = album.album_id '
. $filter_queryTA .
Expand Down Expand Up @@ -1005,6 +1008,15 @@ function view2() {
</span>
</td>

<?php if ($cfg['show_DR']){ ?>
<td class="pl-tdr">
<?php
$tdr = ($track['dr'] === NULL ? '-' : $track['dr']);
echo $tdr;
?>
</td>
<?php } ?>

<td align="right"><?php echo formattedTime($track['miliseconds']); ?></td>
<td></td>
</tr>
Expand Down Expand Up @@ -1109,7 +1121,10 @@ function view2() {
<td>Album&nbsp;</td>
<td class="time pl-genre">Genre&nbsp;</td>
<td class="icon"></td><!-- star -->
<td align="right" class="time">Time</td>
<?php if ($cfg['show_DR']){ ?>
<td class="time pl-tdr">DR</td>
<?php } ?>
<td align="right" class="time time_w">Time</td>
<td class="space right"></td>
</tr>

Expand All @@ -1118,7 +1133,7 @@ function view2() {
$FAV_ids = '';
$search_string = get('artist');
$filter_query = str_replace('artist ','track.artist ',$filter_query);
$queryFav = mysqli_query($db, 'SELECT track.artist as track_artist, track.title, track.featuring, track.album_id, track.track_id as tid, track.relative_file, track.miliseconds, track.number, track.genre, favoriteitem.favorite_id, album.album
$queryFav = mysqli_query($db, 'SELECT track.artist as track_artist, track.title, track.featuring, track.album_id, track.track_id as tid, track.relative_file, track.miliseconds, track.number, track.genre, track.dr, favoriteitem.favorite_id, album.album
FROM track
INNER JOIN favoriteitem ON track.track_id = favoriteitem.track_id
LEFT JOIN album ON track.album_id = album.album_id '
Expand Down Expand Up @@ -1201,6 +1216,15 @@ function view2() {
</span>
</td>

<?php if ($cfg['show_DR']){ ?>
<td class="pl-tdr">
<?php
$tdr = ($track['dr'] === NULL ? '-' : $track['dr']);
echo $tdr;
?>
</td>
<?php } ?>

<td align="right"><?php echo formattedTime($track['miliseconds']); ?></td>
<td></td>
</tr>
Expand Down Expand Up @@ -2169,6 +2193,9 @@ function view3all() {
<td><a <?php echo ($order_bitmap_album == '<span class="typcn"></span>') ? '':'class="sort_selected"';?> href="<?php echo $url; ?>&amp;order=album&amp;sort=<?php echo $sort_album; ?>">Album&nbsp;<?php echo $order_bitmap_album; ?></a></td>
<td class="time pl-genre">Genre&nbsp;</td>
<td></td>
<?php if ($cfg['show_DR']){ ?>
<td class="time pl-tdr">DR</td>
<?php } ?>
<td align="right" class="time">Time</td>
<td class="space right"></td>
</tr>
Expand All @@ -2179,7 +2206,7 @@ function view3all() {
//$query = mysqli_query($db, 'SELECT track.artist, track.title, track.number, track.featuring, track.album_id, track.track_id, track.miliseconds, track.relative_file, album.image_id, album.album FROM track, album ' . $filter_query . ' ' . $order_query);

$q = 'SELECT * FROM
(SELECT track.artist as track_artist, track.title, track.featuring, track.album_id, track.track_id as tid, track.miliseconds, track.number, track.relative_file, track.genre, album.image_id, album.album, album.artist
(SELECT track.artist as track_artist, track.title, track.featuring, track.album_id, track.track_id as tid, track.miliseconds, track.number, track.relative_file, track.genre, track.dr, album.image_id, album.album, album.artist
FROM track
INNER JOIN album ON track.album_id = album.album_id '
. $filter_query . ' ' . $order_query .') as a
Expand Down Expand Up @@ -2271,6 +2298,15 @@ function view3all() {
</span>
</td>

<?php if ($cfg['show_DR']){ ?>
<td class="pl-tdr">
<?php
$tdr = ($track['dr'] === NULL ? '-' : $track['dr']);
echo $tdr;
?>
</td>
<?php } ?>

<td align="right"><?php echo formattedTime($track['miliseconds']); ?></td>
<td></td>
</tr>
Expand Down
12 changes: 5 additions & 7 deletions playlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@
<td class="time">Artist</td>
<td class="time pl-genre">Genre</td>
<td class="time pl-year">Year</td>
<?php if ($cfg['show_DR']){ ?>
<td class="pl-tdr">DR</td>
<?php } ?>
<td class="time">Time</td>
<td class="iconDel"></td><!-- optional delete -->
</tr>
Expand Down Expand Up @@ -402,17 +404,13 @@
<a href="index.php?action=view2&order=artist&sort=asc&year=<?php echo $year ?>"><?php echo $year ?></a>
</td>

<?php
if ($table_track['dr'] === NULL) {
$tdr = '-';
}
else {
$tdr = $table_track['dr'];
}
<?php if ($cfg['show_DR']){
$tdr = ($table_track['dr'] === NULL ? '-' : $table_track['dr']);
?>
<td class="time pl-tdr">
<?php echo $tdr ?>
</td>
<?php } ?>

<td class="time"><?php if (isset($table_track['miliseconds'])) echo formattedTime($table_track['miliseconds']); ?></td>

Expand Down
55 changes: 46 additions & 9 deletions search.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ function album_artist() {
function track_artist() {
global $cfg, $db, $size, $search_string, $group_found, $match_found;

$query = mysqli_query($db,'SELECT track.artist as track_artist, track.title, track.featuring, track.album_id, track.track_id, track.miliseconds, track.number, album.image_id, album.album, album.artist
$query = mysqli_query($db,'SELECT track.artist as track_artist, track.title, track.featuring, track.album_id, track.track_id, track.miliseconds, track.number, track.dr, album.image_id, album.album, album.artist
FROM track
INNER JOIN album ON track.album_id = album.album_id
WHERE track.artist LIKE "%' . mysqli_real_escape_string($db,$search_string) . '%"
Expand Down Expand Up @@ -259,7 +259,10 @@ function track_artist() {
<td>Album&nbsp;</td>
<td class="time pl-genre">Genre&nbsp;</td>
<td></td>
<td align="right" class="time">Time</td>
<?php if ($cfg['show_DR']){ ?>
<td class="time pl-tdr">DR</td>
<?php } ?>
<td align="right" class="time time_w">Time</td>
<td class="space right"></td>
</tr>

Expand All @@ -268,7 +271,7 @@ function track_artist() {
$TA_ids = '';

$query = mysqli_query($db,'SELECT * FROM
(SELECT track.artist as track_artist, track.title, track.featuring, track.album_id, track.track_id as tid, track.miliseconds, track.number, track.relative_file, track.genre, album.image_id, album.album, album.artist
(SELECT track.artist as track_artist, track.title, track.featuring, track.album_id, track.track_id as tid, track.miliseconds, track.number, track.relative_file, track.genre, track.dr, album.image_id, album.album, album.artist
FROM track
INNER JOIN album ON track.album_id = album.album_id
WHERE track.artist LIKE "%' . mysqli_real_escape_string($db,$search_string) . '%"
Expand Down Expand Up @@ -369,9 +372,19 @@ function track_artist() {
<i class="fa fa-star<?php if (!$isFavorite) echo '-o'; ?> fa-fw" id="favorite_star-<?php echo $tid; ?>"></i>
</span>
</td>

<?php if ($cfg['show_DR']){ ?>
<td class="pl-tdr">
<?php
$tdr = ($track['dr'] === NULL ? '-' : $track['dr']);
echo $tdr;
?>
</td>
<?php } ?>


<td align="right"><?php echo formattedTime($track['miliseconds']); ?></td>
<td></td>
<td align="right"><?php echo formattedTime($track['miliseconds']); ?></td>
<td></td>
</tr>

<tr class="line">
Expand Down Expand Up @@ -519,7 +532,10 @@ function track_title() {
<td>Album&nbsp;</td>
<td class="time pl-genre">Genre&nbsp;</td>
<td></td>
<td align="right" class="time">Time</td>
<?php if ($cfg['show_DR']){ ?>
<td class="time pl-tdr">DR</td>
<?php } ?>
<td align="right" class="time time_w">Time</td>
<td class="space right"></td>
</tr>

Expand All @@ -537,7 +553,7 @@ function track_title() {
*/

$query = mysqli_query($db,'SELECT * FROM
(SELECT track.artist as track_artist, track.title, track.featuring, track.album_id, track.track_id as tid, track.miliseconds, track.number, track.relative_file, track.genre, album.image_id, album.album, album.artist
(SELECT track.artist as track_artist, track.title, track.featuring, track.album_id, track.track_id as tid, track.miliseconds, track.number, track.relative_file, track.genre, track.dr, album.image_id, album.album, album.artist
FROM track
INNER JOIN album ON track.album_id = album.album_id
WHERE track.title LIKE "%' . mysqli_real_escape_string($db,$search_string) . '%") as a
Expand Down Expand Up @@ -625,6 +641,15 @@ function track_title() {
</span>
</td>

<?php if ($cfg['show_DR']){ ?>
<td class="pl-tdr">
<?php
$tdr = ($track['dr'] === NULL ? '-' : $track['dr']);
echo $tdr;
?>
</td>
<?php } ?>

<td align="right"><?php echo formattedTime($track['miliseconds']); ?></td>
<td></td>
</tr>
Expand Down Expand Up @@ -721,7 +746,10 @@ function fav4genre($genre) {
<td>Album&nbsp;</td>
<td class="time pl-genre">Genre&nbsp;</td>
<td></td>
<td align="right" class="time">Time</td>
<?php if ($cfg['show_DR']){ ?>
<td class="time pl-tdr">DR</td>
<?php } ?>
<td align="right" class="time time_w">Time</td>
<td class="space right"></td>
</tr>

Expand All @@ -730,7 +758,7 @@ function fav4genre($genre) {
$TT_ids = '';

$query = mysqli_query($db,'SELECT * FROM
(SELECT track.artist as track_artist, track.title, track.featuring, track.album_id, track.track_id as tid, track.miliseconds, track.number, track.relative_file, track.genre, album.image_id, album.album, album.artist
(SELECT track.artist as track_artist, track.title, track.featuring, track.album_id, track.track_id as tid, track.miliseconds, track.number, track.relative_file, track.genre, track.dr, album.image_id, album.album, album.artist
FROM track
LEFT JOIN album ON track.album_id = album.album_id
LEFT JOIN favoriteitem on track.track_id = favoriteitem.track_id
Expand Down Expand Up @@ -819,6 +847,15 @@ function fav4genre($genre) {
</span>
</td>

<?php if ($cfg['show_DR']){ ?>
<td class="pl-tdr">
<?php
$tdr = ($track['dr'] === NULL ? '-' : $track['dr']);
echo $tdr;
?>
</td>
<?php } ?>

<td align="right"><?php echo formattedTime($track['miliseconds']); ?></td>
<td></td>
</tr>
Expand Down
6 changes: 6 additions & 0 deletions skin/dark_red/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,8 @@ div.playlist_status_on_border {
.pl-tdr {
font-size: 1em;
text-align: center;
width: 2em;
max-width: 2em;
}
#favorites,
#favorites1 {
Expand Down Expand Up @@ -1757,6 +1759,10 @@ td.time {
/* padding-left: 0.4em; */
padding: 2px 2px 2px 5px;
}
td.time_w {
width: 3em;
max-width: 3em;
}
td.small_cover,
td.small_cover_md {
width: 4.3em;
Expand Down
6 changes: 6 additions & 0 deletions skin/ompd_dark/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,8 @@ div.playlist_status_on_border {
.pl-tdr {
font-size: 1em;
text-align: center;
width: 2em;
max-width: 2em;
}
#favorites,
#favorites1 {
Expand Down Expand Up @@ -1757,6 +1759,10 @@ td.time {
/* padding-left: 0.4em; */
padding: 2px 2px 2px 5px;
}
td.time_w {
width: 3em;
max-width: 3em;
}
td.small_cover,
td.small_cover_md {
width: 4.3em;
Expand Down
6 changes: 6 additions & 0 deletions skin/ompd_default/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,8 @@ div.playlist_status_on_border {
.pl-tdr {
font-size: 1em;
text-align: center;
width: 2em;
max-width: 2em;
}
#favorites,
#favorites1 {
Expand Down Expand Up @@ -1757,6 +1759,10 @@ td.time {
/* padding-left: 0.4em; */
padding: 2px 2px 2px 5px;
}
td.time_w {
width: 3em;
max-width: 3em;
}
td.small_cover,
td.small_cover_md {
width: 4.3em;
Expand Down
Loading

0 comments on commit 7fe9555

Please sign in to comment.