File tree 5 files changed +11
-7
lines changed
5 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,8 @@ sub getImageUrl {
114
114
sub typeOfItem {
115
115
my ($class , $item ) = @_ ;
116
116
117
+ return ' ' unless ref $item ;
118
+
117
119
if ( $item -> {type } && $item -> {type } =~ / (?:EXTURL|VIDEO)/ ) {}
118
120
elsif ( defined $item -> {hasPlaylists } && $item -> {path } ) {
119
121
return ' category' ;
@@ -153,7 +155,9 @@ sub cacheTrackMetadata {
153
155
my $entry = $_ ;
154
156
$entry = $entry -> {item } if $entry -> {item };
155
157
156
- my $oldMeta = $cache -> get( ' tidal_meta_' . $entry -> {id }) || {};
158
+ my $oldMeta = $cache -> get( ' tidal_meta_' . $entry -> {id });
159
+ $oldMeta = {} unless ref $oldMeta ;
160
+
157
161
my $icon = $class -> getImageUrl($entry , ' usePlaceholder' , ' track' );
158
162
my $artist = $entry -> {artist };
159
163
($artist ) = grep { $_ -> {type } eq ' MAIN' } @{$entry -> {artists }} unless $artist ;
Original file line number Diff line number Diff line change @@ -455,7 +455,7 @@ sub getFavorites {
455
455
456
456
# use cached data unless the collection has changed
457
457
my $cached = $cache -> get($cacheKey );
458
- if ($cached && ref $cached -> {items }) {
458
+ if (ref $cached && ref $cached -> {items }) {
459
459
# don't bother verifying timestamp unless we're sure we need to
460
460
return $cb -> ($cached -> {items }) unless $refresh ;
461
461
@@ -517,7 +517,7 @@ sub getCollectionPlaylists {
517
517
};
518
518
519
519
my $cached = $cache -> get($cacheKey );
520
- if ($cached && ref $cached -> {items }) {
520
+ if (ref $cached && ref $cached -> {items }) {
521
521
return $cb -> ($cached -> {items }) unless $refresh ;
522
522
523
523
$self -> getLatestCollectionTimestamp(sub {
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ sub scanAlbums { if (main::SCANNER) {
70
70
foreach my $album (@$albums ) {
71
71
my $albumDetails = $cache -> get(' tidal_album_with_tracks_' . $album -> {id });
72
72
73
- if ( $albumDetails && $albumDetails -> {tracks } && ref $albumDetails -> {tracks }) {
73
+ if ( ref $albumDetails && $albumDetails -> {tracks } && ref $albumDetails -> {tracks }) {
74
74
$progress -> update($album -> {title });
75
75
76
76
$class -> storeTracks([
Original file line number Diff line number Diff line change @@ -439,7 +439,7 @@ sub _menuTrackInfo {
439
439
440
440
# if we are here, the metadata of the track is cached
441
441
my $track = $cache -> get(" tidal_meta_$id " );
442
- $log -> error(" metadata not cached for $id " ) && return [] unless $track ;
442
+ $log -> error(" metadata not cached for $id " ) && return [] unless $track && ref $track ;
443
443
444
444
# play/add/add_next options except for skins that don't want it
445
445
my $base = _menuBase($api -> client, ' track' , $id , $params );
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ sub trackGain {
63
63
my $trackId = getId($url );
64
64
my $meta = $cache -> get( ' tidal_meta_' . ($trackId || ' ' ) );
65
65
66
- return unless $meta && defined $meta -> {replay_gain } && defined $meta -> {peak };
66
+ return unless ref $meta && defined $meta -> {replay_gain } && defined $meta -> {peak };
67
67
68
68
# TODO - try to get album gain information?
69
69
@@ -260,7 +260,7 @@ sub getMetadataFor {
260
260
my $meta = $cache -> get( ' tidal_meta_' . ($trackId || ' ' ) );
261
261
262
262
# if metadata is in cache, we just need to add bitrate
263
- if ($meta ) {
263
+ if (ref $meta ) {
264
264
# TODO - remove if we decide to move to our own cache file which we can version
265
265
$meta -> {artist } = $meta -> {artist }-> {name } if ref $meta -> {artist };
266
266
You can’t perform that action at this time.
0 commit comments