Skip to content

Commit

Permalink
Fix #1148 - Restore radio station search functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelherger committed Sep 16, 2024
1 parent ca19eb6 commit 456be7f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
16 changes: 14 additions & 2 deletions Slim/Plugin/InternetRadio/TuneIn.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ package Slim::Plugin::InternetRadio::TuneIn;

use strict;

BEGIN {
use Exporter::Lite;
use constant PARTNER_ID => 15;
our @EXPORT_OK = qw(PARTNER_ID);
}

use Digest::MD5 ();
use Tie::IxHash;
use URI;
Expand Down Expand Up @@ -74,8 +80,7 @@ use constant MENUS => {
},
};

use constant PARTNER_ID => 15;
use constant MAIN_URL => 'http://opml.radiotime.com/Index.aspx?partnerId=' . PARTNER_ID;
use constant MAIN_URL => 'http://opml.radiotime.com/Index.aspx?partnerId=16';
use constant ERROR_URL => 'http://opml.radiotime.com/Report.ashx?c=stream&partnerId=' . PARTNER_ID;
use constant PRESETS_URL => 'http://opml.radiotime.com/Browse.ashx?c=presets&partnerId=' . PARTNER_ID;
use constant OPTIONS_URL => 'http://opml.radiotime.com/Options.ashx?partnerId=' . PARTNER_ID . '&id=';
Expand Down Expand Up @@ -135,6 +140,12 @@ sub parseMenu {
$item->{icon} = MENUS->{$key}->{icon} || MENUS->{'default'}->{icon};
$item->{iconre} = 'radiotime';
$item->{weight} = $weight;

while (my ($k, $v) = each %$item) {
$v =~ s/(partnerId=)16/$1${\PARTNER_ID}/ig;
$item->{$k} = $v;
}

push @$menu, $item;

# TTP 864, Use the string token for name instead of whatever translated name we get
Expand Down Expand Up @@ -208,6 +219,7 @@ sub fixUrl {

$rtinfo->{serial} ||= $class->getSerial($client);
$rtinfo->{partnerId} ||= PARTNER_ID;
$rtinfo->{partnerId} =~ s/(partnerId=)16\b/$1${\PARTNER_ID}/ig;
$rtinfo->{username} ||= $class->getUsername if $feed =~ /presets/;
$rtinfo->{formats} = join(',', @formats);
$rtinfo->{id} = $rtinfo->{sid} || $rtinfo->{id};
Expand Down
3 changes: 1 addition & 2 deletions Slim/Plugin/InternetRadio/TuneIn/Metadata.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use Slim::Formats::RemoteMetadata;
use Slim::Formats::XML;
use Slim::Music::Info;
use Slim::Networking::SimpleAsyncHTTP;
use Slim::Plugin::InternetRadio::TuneIn;
use Slim::Plugin::InternetRadio::TuneIn qw(PARTNER_ID);
use Slim::Utils::Cache;
use Slim::Utils::Log;
use Slim::Utils::Prefs;
Expand All @@ -24,7 +24,6 @@ my $log = logger('plugin.radio');
my $prefs = preferences('plugin.radiotime');
my $cache = Slim::Utils::Cache->new();

use constant PARTNER_ID => 16;
use constant META_URL => 'http://opml.radiotime.com/NowPlaying.aspx?partnerId=' . PARTNER_ID;
use constant CONFIG_URL => 'http://opml.radiotime.com/Config.ashx?c=api&partnerId=' . PARTNER_ID . '&serial=';
use constant ICON => 'plugins/TuneIn/html/images/icon.png';
Expand Down

0 comments on commit 456be7f

Please sign in to comment.