Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 24 additions & 18 deletions Slim/Utils/Misc.pm
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes don't belong in this PR, right?

Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ L<Slim::Utils::Misc> serves as a collection of miscellaneous utility
=cut

use strict;
use warnings;
use feature 'state';
use Exporter::Lite;

our @EXPORT = qw(assert msg msgf errorMsg specified dumpFiltered);
Expand Down Expand Up @@ -84,10 +86,6 @@ elsif ($^O =~/darwin/i) {
my ($userAgentString, $legacyUserAgentString);
my $tempdir;

my %pathToFileCache = ();
my %fileToPathCache = ();
my %mediadirsCache = ();
my %fixPathCache = ();
my @findBinPaths = ();

my $MAX_CACHE_ENTRIES = $prefs->get('dbhighmem') ? 512 : 32;
Expand Down Expand Up @@ -224,8 +222,10 @@ sub pathFromFileURL {
my $url = shift;
my $noCache = shift || 0;

if (!$noCache && $fileToPathCache{$url}) {
return $fileToPathCache{$url};
state $fileToPathCache = {};

if (!$noCache && $fileToPathCache->{$url}) {
return $fileToPathCache->{$url};
}

if ($url !~ /^file:\/\//i) {
Expand Down Expand Up @@ -275,8 +275,10 @@ sub pathFromFileURL {
}

if (!$noCache) {
%fileToPathCache = () if scalar keys %fileToPathCache > $MAX_CACHE_ENTRIES;
$fileToPathCache{$url} = $file;
if (scalar keys %$fileToPathCache > $MAX_CACHE_ENTRIES) {
%$fileToPathCache = ();
}
$fileToPathCache->{$url} = $file;
}

return $file;
Expand All @@ -291,8 +293,10 @@ sub pathFromFileURL {
sub fileURLFromPath {
my $path = shift;

if ($pathToFileCache{$path}) {
return $pathToFileCache{$path};
state $pathToFileCache = {};

if ($pathToFileCache->{$path}) {
return $pathToFileCache->{$path};
}

return $path if (Slim::Music::Info::isURL($path));
Expand Down Expand Up @@ -325,11 +329,11 @@ sub fileURLFromPath {
my $file = $uri->as_string;
$file =~ s%/$%% if $addedSlash;

if (scalar keys %pathToFileCache > $MAX_CACHE_ENTRIES) {
%pathToFileCache = ();
if (scalar keys %$pathToFileCache > $MAX_CACHE_ENTRIES) {
%$pathToFileCache = ();
}

$pathToFileCache{$path} = $file;
$pathToFileCache->{$path} = $file;

return $file;
}
Expand Down Expand Up @@ -452,13 +456,15 @@ sub fixPath {
return;
}

my $base = $_[1] && ( $fixPathCache{$_[1]} || Slim::Utils::Unicode::encode_locale($_[1]) );
state $fixPathCache = {};

my $base = $_[1] && ( $fixPathCache->{$_[1]} || Slim::Utils::Unicode::encode_locale($_[1]) );

if (scalar keys %fixPathCache > $MAX_CACHE_ENTRIES) {
%fixPathCache = ();
if (scalar keys %$fixPathCache > $MAX_CACHE_ENTRIES) {
%$fixPathCache = ();
}

$fixPathCache{$_[1]} ||= $base if $base;
$fixPathCache->{$_[1]} ||= $base if $base;

my $fixed;

Expand Down Expand Up @@ -1216,7 +1222,7 @@ sub userAgentString {
($osDetails->{'osArch'} || 'Unknown'),
$prefs->get('language'),
Slim::Utils::Unicode::currentLocale(),
'SqueezeCenter, Squeezebox Server, Lyrion Music Server',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry to say no: some outside systems rely on old UA strings parts. We'd break those integrations with this change. Unfortunately a similar situation as with real browsers, who all still use "Mozilla", or Chrome using "Safari" etc.

'Lyrion Music Server',
);

if ($legacy) {
Expand Down
3 changes: 2 additions & 1 deletion Slim/Web/HTTP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package Slim::Web::HTTP;
# version 2.

use strict;
use warnings;

use AnyEvent::Handle;
use CGI::Cookie;
Expand Down Expand Up @@ -405,7 +406,7 @@ sub processHTTP {
$response->header('Connection' => 'close');
$response->content_type('text/html');
$response->content_ref(filltemplatefile('html/errors/401.html', $params));
$response->www_authenticate(sprintf('Basic realm="%s"', string('SQUEEZEBOX_SERVER')));
$response->www_authenticate(sprintf('Basic realm="%s"', string('LYRION_MUSIC_SERVER')));

$httpClient->send_response($response);
closeHTTPSocket($httpClient);
Expand Down
5 changes: 4 additions & 1 deletion strings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,9 @@ PAUSED
SQUEEZEBOX_SERVER
EN Lyrion Music Server

LYRION_MUSIC_SERVER
EN Lyrion Music Server
Comment on lines +820 to +821
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is worth the additional string. Is it confusing to the developer? Maybe. But if a new string, then rather PRODUCT_NAME or similar, so we don't have to change again if needed... And wouldn't we have to update many more uses of the string token?


ABOUT
CS Lyrion Music Server V.%s, autor:
DA Lyrion Music Server V.%s, skrevet af:
Expand Down Expand Up @@ -18623,7 +18626,7 @@ SETUP_USETPE2ASALBUMARTIST_DESC
FI MP3-tagin muoto ei tarjoa standardinmukaista tapaa levyartistin määrittämiseen. Jotkin MP3-tunnistetyökalut käyttävät TPE2-kenttää levyartistille (iTunes, Winamp, Windows Media Player), joissakin toisissa työkaluissa kenttää taas saatetaan käyttää tarkoittamaan yhtyettä tai orkesteria. Valitse merkitys, jota haluat Lyrion Music Serverin käyttävän. Asetuksen muuttaminen käynnistää musiikkikirjaston uudelleentarkistuksen.
FR Les tags MP3 ne fournissent aucun moyen standard pour définir un artiste d'album. Certains outils de gestion de tags MP3 utilisent le champ TPE2 pour stocker l'artiste de l'album (iTunes, Winamp, Windows Media Player) tandis que d'autres peuvent l'utiliser en tant que "Groupe/Orchestre". Sélectionnez la signification que le Lyrion Music Server doit utiliser. La modification de ce paramètre lancera une nouvelle analyse de votre bibliothèque musicale.
HU Az MP3 címkeformátum nem biztosít szabványos módot az album előadójának meghatározására. Egyes MP3 címkéző eszközök a TPE2 mezőt használják az album előadójához (iTunes, Winamp, Windows Media Player), míg mások a „zenekar/zenekar” szándékolt jelentésére használhatják. Válassza ki a Lyrion Music Server használatának jelentését. A beállítás módosítása elindítja a zenei könyvtár újraellenőrzését.
IT Il formato dei tag MP3 non fornisce un metodo standard per specificare l'artista di un album. Alcuni strumenti per l'assegnazione dei tag MP3 utilizzano il campo TPE2 per specificare l'artista dell'album (iTunes, Winamp, Windows Media Player), mentre altri lo utilizzano per indicare il gruppo o l'orchestra. Selezionare il significato che si desidera utilizzare in SqueezeCenter. La modifica di questa impostazione avvierà di nuovo l'analisi della libreria musicale.
IT Il formato dei tag MP3 non fornisce un metodo standard per specificare l'artista di un album. Alcuni strumenti per l'assegnazione dei tag MP3 utilizzano il campo TPE2 per specificare l'artista dell'album (iTunes, Winamp, Windows Media Player), mentre altri lo utilizzano per indicare il gruppo o l'orchestra. Selezionare il significato che si desidera utilizzare in Lyrion Music Server. La modifica di questa impostazione avvierà di nuovo l'analisi della libreria musicale.
NL De mp3-tagindeling biedt geen standaardmanier om een albumartiest te definiëren. Sommige mp3-tagtools gebruiken het TPE2-veld voor Albumartiest (iTunes, Winamp, Windows Media Player) terwijl andere het gebruiken voor de beoogde betekenis van 'Band/orkest'. Selecteer de betekenis die Lyrion Music Server moet gebruiken. Wanneer je deze instelling wijzigt, wordt de mediabibliotheek opnieuw gescand.
NO Etikettformatet mp3 angir ikke en standardmåte å definere en albumartist på. Noen etikettverktøy for mp3 bruker TPE2-feltet til albumartist (iTunes, Winamp, Windows Media Player), mens andre bruker det for gruppe/orkester. Velg hvordan Lyrion Music Server skal tolke dette. Når du endrer denne innstillingen, startes et nytt søk i musikkbiblioteket.
PL Format znacznika pliku MP3 nie umożliwia definiowania wykonawcy albumu w standardowy sposób. Niektóre narzędzia do oznaczania plików MP3 używają do określenia wykonawcy albumu pola TPE2 (iTunes, Winamp, Windows Media Player), natomiast inne mogą używać go zgodnie z przeznaczeniem do określenia zespołu/orkiestry. Wybierz znaczenie, które ma być używane przez program Lyrion Music Server. Zmiana tego ustawienia powoduje ponowne przeszukanie biblioteki muzyki.
Expand Down