Skip to content

Commit 7a4a9e8

Browse files
committed
Refactor caching of a song's replayGain
This attribute actually belongs in the song object, which is basically a partial join of the client/player object and the track object. (You were right, @mherger ;-) Signed-off-by: Sam Y <syahres@gmail.com>
1 parent 168af58 commit 7a4a9e8

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

Slim/Control/Queries.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3962,7 +3962,7 @@ sub statusQuery {
39623962
$request->addResult('can_seek', 1);
39633963
}
39643964

3965-
my $trackGain = $client->replayGain();
3965+
my $trackGain = $song->replayGain();
39663966
if (defined $trackGain) {
39673967
$request->addResult('replay_gain', $trackGain);
39683968
}

Slim/Player/Client.pm

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ use constant KNOB_NOACCELERATION => 0x02;
132132
modeStack modeParameterStack playlist chunks
133133
shufflelist shuffleInhibit syncSelections searchTerm
134134
updatePending httpState
135-
disconnected replayGain
135+
disconnected
136136
));
137137
__PACKAGE__->mk_accessor('hash', qw(
138138
curSelection lastID3Selection
@@ -305,8 +305,6 @@ sub new {
305305
_pluginData => {},
306306
updatePending => 0,
307307
disconnected => 0,
308-
replayGain => undef,
309-
310308
);
311309

312310
$clientHash{$id} = $client;

Slim/Player/Song.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ my @_playlistCloneAttributes = qw(
7272
7373
samplerate samplesize channels totalbytes offset blockalign isLive
7474
75-
retryData
75+
retryData replayGain
7676
),
7777
);
7878
}
@@ -127,6 +127,7 @@ sub new {
127127
handler => $handler,
128128
_track => $track,
129129
streamUrl => $url, # May get updated later, either here or in handler
130+
replayGain => undef,
130131
);
131132

132133
$self->seekdata($seekdata) if $seekdata;

Slim/Player/StreamingController.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1316,7 +1316,7 @@ sub _Stream { # play -> Buffering, Streaming
13161316

13171317
$startedPlayers += $player->play( \%params );
13181318

1319-
$player->replayGain($replayGain); # store this for status queries
1319+
$song->replayGain($replayGain); # store this for status queries
13201320

13211321
$reportsTrackStart ||= $player->reportsTrackStart();
13221322
}

0 commit comments

Comments
 (0)