-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Song/track/handler for url refactoring attempt #612
Changes from all commits
7b30413
b0b071a
828675e
1f58ad6
749dfca
cb1cc4e
68b9cd3
b647d71
016847d
8f2184f
d6267c1
853c4cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
package Slim::Player::SongStreamController; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mostly cosmetic to make it inherit from accessor. Also, I've changed protocolHandler to urlHandler so that we have consistent naming between songHandler (for $song), streamHandler (for $sock) and urlHandler (for $song->streamUrl) |
||
|
||
|
||
# Logitech Media Server Copyright 2001-2020 Logitech. | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License, | ||
|
@@ -9,23 +8,30 @@ package Slim::Player::SongStreamController; | |
use bytes; | ||
use strict; | ||
|
||
use base qw(Slim::Utils::Accessor); | ||
|
||
use Slim::Utils::Log; | ||
|
||
my $log = logger('player.source'); | ||
|
||
my $_liveCount = 0; | ||
|
||
{ | ||
__PACKAGE__->mk_accessor('ro', qw(song streamHandler streamUrlHandler)); | ||
__PACKAGE__->mk_accessor('rw', qw(playerProxyStreaming)); | ||
} | ||
|
||
sub new { | ||
my ($class, $song, $streamHandler) = @_; | ||
|
||
my $self = $class->SUPER::new; | ||
|
||
my $self = { | ||
$self->init_accessor( | ||
song => $song, | ||
streamHandler => $streamHandler, | ||
protocolHandler => my $handler = Slim::Player::ProtocolHandlers->handlerForURL($song->streamUrl()), | ||
}; | ||
streamUrlHandler => Slim::Player::ProtocolHandlers->handlerForURL($song->streamUrl()), | ||
); | ||
|
||
bless $self, $class; | ||
|
||
$_liveCount++; | ||
if (main::DEBUGLOG && $log->is_debug) { | ||
$log->debug("live=$_liveCount"); | ||
|
@@ -45,41 +51,32 @@ sub DESTROY { | |
} | ||
} | ||
|
||
sub song {return shift->{'song'};} | ||
sub streamHandler {return shift->{'streamHandler'};} | ||
sub protocolHandler {return shift->{'protocolHandler'};} | ||
|
||
sub songProtocolHandler {return shift->song()->handler();} | ||
|
||
sub close { | ||
my $self = shift; | ||
|
||
my $fd = $self->{'streamHandler'}; | ||
my $fd = $self->streamHandler; | ||
|
||
if (defined $fd) { | ||
Slim::Networking::Select::removeError($fd); | ||
Slim::Networking::Select::removeRead($fd); | ||
$fd->close; | ||
delete $self->{'streamHandler'}; | ||
} | ||
} | ||
|
||
sub songHandler { | ||
return shift->song->handler(); | ||
} | ||
|
||
sub isDirect { | ||
return shift->{'song'}->directstream() || 0; | ||
return shift->song->directstream() || 0; | ||
} | ||
|
||
sub streamUrl { | ||
return shift->{'song'}->streamUrl(); | ||
return shift->song->streamUrl(); | ||
} | ||
|
||
sub track { | ||
return shift->{'song'}->currentTrack(); | ||
} | ||
|
||
sub playerProxyStreaming { | ||
my $self = shift; | ||
$self->{'playerProxyStreaming'} = shift if @_; | ||
return $self->{'playerProxyStreaming'}; | ||
return shift->song->currentTrack(); | ||
} | ||
|
||
1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a plugin which uses
wmaMeta
to override the metadata shown. This no longer work, as$current
is not true. Where shall I start the investigation?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the PR with what I think is the solution: need to check for the track and currentTrack as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, the new one, of course.