@@ -237,6 +237,13 @@ class Grid extends react.Component {
237
237
}
238
238
239
239
render ( ) {
240
+ const expFeatures = JSON . parse ( localStorage . getItem ( "spicetify-exp-features" ) || "{}" ) ;
241
+ const isGlobalNav = expFeatures ?. enableGlobalNavBar ?. value !== "control" ;
242
+ const version = Spicetify . Platform . version . split ( "." ) . map ( ( i ) => Number . parseInt ( i ) ) ;
243
+
244
+ const tabBarMargin = {
245
+ marginTop : isGlobalNav || ( version [ 0 ] === 1 && version [ 1 ] === 2 && version [ 2 ] >= 45 ) ? "60px" : "0px" ,
246
+ } ;
240
247
return react . createElement (
241
248
"section" ,
242
249
{
@@ -246,6 +253,7 @@ class Grid extends react.Component {
246
253
"div" ,
247
254
{
248
255
className : "new-releases-header" ,
256
+ style : tabBarMargin ,
249
257
} ,
250
258
react . createElement ( "h1" , null , Spicetify . Locale . get ( "new_releases" ) ) ,
251
259
react . createElement (
@@ -318,14 +326,12 @@ async function getArtistEverything(artist) {
318
326
}
319
327
320
328
async function getPodcastList ( ) {
321
- const body = await CosmosAsync . get ( "sp://core-collection/unstable/@/list/shows/all?responseFormat=protobufJson" ) ;
322
- return body . item ?? [ ] ;
329
+ const body = await Spicetify . Platform . LibraryAPI . getShows ( { limit : 50000 } ) ;
330
+ return body . items ?? [ ] ;
323
331
}
324
332
325
333
async function getPodcastRelease ( uri ) {
326
- const body = await CosmosAsync . get ( `sp://core-show/v1/shows/${ uri } ?responseFormat=protobufJson` , {
327
- policy : { list : { link : true , name : true , publishDate : true } } ,
328
- } ) ;
334
+ const body = await Spicetify . Platform . ShowAPI . getContents ( uri , { limit : 50000 } ) ;
329
335
return body . items ;
330
336
}
331
337
@@ -372,28 +378,25 @@ async function fetchTracks() {
372
378
async function fetchPodcasts ( ) {
373
379
const items = [ ] ;
374
380
const itemTypeStr = Spicetify . Locale . get ( "card.tag.episode" ) ;
375
- for ( const obj of await getPodcastList ( ) ) {
376
- const podcast = obj . showMetadata ;
377
- const id = podcast . link . replace ( "spotify:show:" , "" ) ;
378
-
379
- const tracks = await getPodcastRelease ( id ) ;
381
+ for ( const podcast of await getPodcastList ( ) ) {
382
+ const tracks = await getPodcastRelease ( podcast . uri ) ;
380
383
if ( ! tracks ) continue ;
381
384
382
385
for ( const track of tracks ) {
383
- const time = new Date ( track . episodeMetadata . publishDate * 1000 ) ;
386
+ const time = new Date ( track . releaseDate . isoString ) ;
384
387
385
388
if ( today - time . getTime ( ) > limitInMs ) {
386
389
break ;
387
390
}
388
391
389
392
items . push ( {
390
- uri : track . episodeMetadata . link ,
391
- title : track . episodeMetadata . name ,
393
+ uri : track . uri ,
394
+ title : track . name ,
392
395
artist : {
393
396
name : podcast . name ,
394
- uri : podcast . link ,
397
+ uri : podcast . uri ,
395
398
} ,
396
- imageURL : podcast . covers . standardLink ,
399
+ imageURL : track . coverArt . reduce ( ( prev , curr ) => ( prev . width > curr . width ? prev : curr ) ) . url ,
397
400
time,
398
401
type : itemTypeStr ,
399
402
} ) ;
0 commit comments