Re: Online music service integration - how to test

thniels <thniels.amw68n-NUepA2SMhDQqspMVqqL2D+4xXEVPTSb/[email protected]> Fri, 1 Jul 2022 16:14:31 +0000
Newsgroups gmane.music.equipment.slimdevices.devel
Organization Logitech Squeezebox Forums
Message-ID <[email protected]>
I was looking at Importer.pm...


Code:
--------------------
    sub scanAlbums { if (main::SCANNER) {
  my ($class, $accounts) = @_;
  
  my $progress;
  
  foreach my $account (@$accounts) {
  if ($progress) {
  $progress->total($progress->total + 1);
  }
  else {
  $progress = Slim::Utils::Progress->new({
  'type'  => 'importer',
  'name'  => 'plugin_tidal_albums',
  'total' => 1,
  'every' => 1,
  });
  }
  
  main::INFOLOG && $log->is_info && $log->info("Reading albums for $account...");
  $progress->update(string('PLUGIN_TIDAL_PROGRESS_READ_ALBUMS', $account));
  
  my $accountName = "tidal:$account" if scalar @$accounts > 1;
  
  my $albumsResponse = $http->get(Slim::Networking::SqueezeNetwork::Sync->url(sprintf(ALBUMS_URL, $account)));
  my $albums = eval { from_json($albumsResponse->content) } || [];
  
  $@ && $log->error($@);
  
  $progress->total($progress->total + scalar @$albums);
  
  main::INFOLOG && $log->is_info && $log->info(sprintf("Importing album tracks for %s albums...", scalar @$albums));
  main::DEBUGLOG && $log->is_debug && $log->debug(Data::Dump::dump($albums));
  foreach my $album (@$albums) {
  * if (!ref $album) {
  $log->error("Invalid data: $album");
  next;
  }*
  
  $progress->update($account . string('COLON') . ' ' . $album->{title});
  Slim::Schema->forceCommit;
  
  my $tracks = delete $album->{tracks};
  
  $class->storeTracks([
  map { _prepareTrack($_, $album) } @$tracks
  ], undef, $accountName);
  }
  
  Slim::Schema->forceCommit;
  }
  
  $progress->final() if $progress;
  } }
  
--------------------


I presume this is the source of the error message from the previous log
file. If the array @$albums contains my account number as well as
$albums then I find that a bit odd. I think it's time I find a computer
I can use as a testing ground.



Thomas Nielsen
-I breathe music...-
------------------------------------------------------------------------
thniels's Profile: http://forums.slimdevices.com/member.php?userid=71094
View this thread: http://forums.slimdevices.com/showthread.php?t=111442