From fbcccdd6dc73711d2a3132e4161b232b2850b81e Mon Sep 17 00:00:00 2001 From: Luca Rullo Date: Fri, 3 Nov 2023 14:27:08 +0100 Subject: [PATCH] Update: Podcasts / Player Metadata View --- inc/src/app/app.component.ts | 13 +++++ inc/src/app/player.service.ts | 9 ++-- inc/src/assets/json/podcasts.json | 88 ++++++++++++++++++++++++++++--- 3 files changed, 98 insertions(+), 12 deletions(-) diff --git a/inc/src/app/app.component.ts b/inc/src/app/app.component.ts index 00d0336..e132275 100644 --- a/inc/src/app/app.component.ts +++ b/inc/src/app/app.component.ts @@ -47,6 +47,7 @@ export class AppComponent implements OnInit { this.http.get(this.url).subscribe(res => { this.podcasts = res; + this.podcasts = this.shuffle(this.podcasts); // console.log(this.podcasts) this.podcasts.map( (n:any) => { n.random = this.randomPos=this.randomPosition(); @@ -62,6 +63,18 @@ export class AppComponent implements OnInit { return Math.floor(Math.random() * (max - min + 1) + min) } + private shuffle(playlist:any[]) { + let currentIndex = playlist.length, randomIndex; + + while (currentIndex > 0) { + randomIndex = Math.floor(Math.random() * currentIndex); + currentIndex--; + [playlist[currentIndex], playlist[randomIndex]] = [ + playlist[randomIndex], playlist[currentIndex]]; + } + return playlist; + } + scrollTo(id:string) { let element:any = document.getElementById(id); element.scrollIntoView({ behavior: "smooth", block: "start", inline: "nearest" }); diff --git a/inc/src/app/player.service.ts b/inc/src/app/player.service.ts index 5069a9d..ce8d65f 100644 --- a/inc/src/app/player.service.ts +++ b/inc/src/app/player.service.ts @@ -135,12 +135,13 @@ export class PlayerService implements OnInit { if (res['icestats']['source'][index]) { //console.log(res.icestats.source[index].title) - this.audio_icy = res.icestats.source[index].title; + this.audio_icy = res.icestats.source[index].title.split("-").slice(1).join('-'); - //this._icy_metadata.next(res.icestats.source[index].title); - this._icy_metadata.next("El agua no tiene nombre"); + this._icy_metadata.next(res.icestats.source[index].title.split("-").slice(1).join('-')); + //this._icy_metadata.next("El agua no tiene nombre"); - this.last_icy_metadata=res.icestats.source[index].title; + this.last_icy_metadata=res.icestats.source[index].title.split("-").slice(1).join('-') + ; } }) } diff --git a/inc/src/assets/json/podcasts.json b/inc/src/assets/json/podcasts.json index 0f55c67..e189478 100644 --- a/inc/src/assets/json/podcasts.json +++ b/inc/src/assets/json/podcasts.json @@ -1,26 +1,98 @@ [ { "name": "podcast1", - "title": "Podcast 1", - "audio": "https://d3uq9vzdmwnq5u.cloudfront.net/v1/variant/8e7eb371-ddd5-51b1-8879-7c99fa0874d5.mp3?session_id=5a59c020-a475-5cef-98c5-e0f05b3cacfe&ct=DOWNLOAD&episode_id=116862422&show_id=2284011&user_id=33206696&organization_id=ivoox&tenant=IVOOX×tamp=1698802776&media_type=dynamic&fallback_url=https%3A%2F%2Fd3uq9vzdmwnq5u.cloudfront.net%2Fpoximamenteescucharefugio-canalescucharefugio-ivoox116862422.mp3%3Fct%3DDOWNLOAD%26episode_id%3D116862422%26show_id%3D2284011%26user_id%3D33206696%26organization_id%3Divoox%26tenant%3DIVOOX%26timestamp%3D1698802776%26media_type%3Dstatic%26Expires%3D1698975576%26Key-Pair-Id%3DK1J2BR3INU6RYD%26Signature%3Dkc74xwxozH7Wo5rQzRwB1J2TmQ3V~tlWW8sl~mTPQnFfeQkpQoCVqbGsS4sjQM598MDoeMFCqMqNGqx4UTqwZdF7Eq397ir2JnZJb4--Qm1zIPUModg5u5jZItNHd5k-EzbptqQjxqg-3x7BbdBPwwuM5nbHhLLgYfLoSoiC6cpJaqR-6Bovm5EnB3A1iQiV4iTyW1nljvAIP~kyURhAEbLUy95qWhnCqWeZoiohP3YM8qMBXauMAMNFQAYuIogjQ4ObzNazbrjkNEik5Dq8chB2WgxxkEA4JE6qBWV6kS9LpY-QfCyrV7c4U0kNNPmTpeCED9YOC8jrHLibECf8Hw__&Expires=1698975577&Key-Pair-Id=K1J2BR3INU6RYD&Signature=IkNUujU-zkM2cqFgnrJPlxIscHvf-rHq1vz~Jyu6ypGg3h0C02mimVMRZzllV-SZ~fuwjk-p6JpK2lhLvLswMczuvFjTSgEYea71EXpJ1W9Q-gOgpjMp84SZLaMa69IqzxPLNZFA6o1kGd5F12DV8myyosCxcFy~ZDIZsJss98IN7ebusGP5aZFVaXUSC3WBbkuMow1WQeERim7iK2RSXFzYNkiV1zjV6ZLGg8mZj2Gn-RoFB4DRS1vtkVl1~MTD9XmOItmmoThsqu~sMgnrKewEyQDwms~Y3aV4ClEsWxhAZMT9g4s5jQeRwRNjhriU5fY3GBkTWmBhekHA3ERK8Q__", + "title": "Podcast: El agua no tiene nombre", + "audio": "https://audio-lab.org/wp-content/uploads/2023/11/CEAR-elaguanotienenombre-podcast-20231102.mp3", "random": 0 }, { "name": "podcast2", - "title": "Podcast 2", - "audio": "https://d3uq9vzdmwnq5u.cloudfront.net/v1/variant/8e7eb371-ddd5-51b1-8879-7c99fa0874d5.mp3?session_id=5a59c020-a475-5cef-98c5-e0f05b3cacfe&ct=DOWNLOAD&episode_id=116862422&show_id=2284011&user_id=33206696&organization_id=ivoox&tenant=IVOOX×tamp=1698802776&media_type=dynamic&fallback_url=https%3A%2F%2Fd3uq9vzdmwnq5u.cloudfront.net%2Fpoximamenteescucharefugio-canalescucharefugio-ivoox116862422.mp3%3Fct%3DDOWNLOAD%26episode_id%3D116862422%26show_id%3D2284011%26user_id%3D33206696%26organization_id%3Divoox%26tenant%3DIVOOX%26timestamp%3D1698802776%26media_type%3Dstatic%26Expires%3D1698975576%26Key-Pair-Id%3DK1J2BR3INU6RYD%26Signature%3Dkc74xwxozH7Wo5rQzRwB1J2TmQ3V~tlWW8sl~mTPQnFfeQkpQoCVqbGsS4sjQM598MDoeMFCqMqNGqx4UTqwZdF7Eq397ir2JnZJb4--Qm1zIPUModg5u5jZItNHd5k-EzbptqQjxqg-3x7BbdBPwwuM5nbHhLLgYfLoSoiC6cpJaqR-6Bovm5EnB3A1iQiV4iTyW1nljvAIP~kyURhAEbLUy95qWhnCqWeZoiohP3YM8qMBXauMAMNFQAYuIogjQ4ObzNazbrjkNEik5Dq8chB2WgxxkEA4JE6qBWV6kS9LpY-QfCyrV7c4U0kNNPmTpeCED9YOC8jrHLibECf8Hw__&Expires=1698975577&Key-Pair-Id=K1J2BR3INU6RYD&Signature=IkNUujU-zkM2cqFgnrJPlxIscHvf-rHq1vz~Jyu6ypGg3h0C02mimVMRZzllV-SZ~fuwjk-p6JpK2lhLvLswMczuvFjTSgEYea71EXpJ1W9Q-gOgpjMp84SZLaMa69IqzxPLNZFA6o1kGd5F12DV8myyosCxcFy~ZDIZsJss98IN7ebusGP5aZFVaXUSC3WBbkuMow1WQeERim7iK2RSXFzYNkiV1zjV6ZLGg8mZj2Gn-RoFB4DRS1vtkVl1~MTD9XmOItmmoThsqu~sMgnrKewEyQDwms~Y3aV4ClEsWxhAZMT9g4s5jQeRwRNjhriU5fY3GBkTWmBhekHA3ERK8Q__", + "title": "El agua", + "audio": "https://audio-lab.org/wp-content/uploads/2023/11/CEAR-agua1.mp3", "random": 0 }, { "name": "podcast3", - "title": "Podcast 3", - "audio": "https://d3uq9vzdmwnq5u.cloudfront.net/v1/variant/8e7eb371-ddd5-51b1-8879-7c99fa0874d5.mp3?session_id=5a59c020-a475-5cef-98c5-e0f05b3cacfe&ct=DOWNLOAD&episode_id=116862422&show_id=2284011&user_id=33206696&organization_id=ivoox&tenant=IVOOX×tamp=1698802776&media_type=dynamic&fallback_url=https%3A%2F%2Fd3uq9vzdmwnq5u.cloudfront.net%2Fpoximamenteescucharefugio-canalescucharefugio-ivoox116862422.mp3%3Fct%3DDOWNLOAD%26episode_id%3D116862422%26show_id%3D2284011%26user_id%3D33206696%26organization_id%3Divoox%26tenant%3DIVOOX%26timestamp%3D1698802776%26media_type%3Dstatic%26Expires%3D1698975576%26Key-Pair-Id%3DK1J2BR3INU6RYD%26Signature%3Dkc74xwxozH7Wo5rQzRwB1J2TmQ3V~tlWW8sl~mTPQnFfeQkpQoCVqbGsS4sjQM598MDoeMFCqMqNGqx4UTqwZdF7Eq397ir2JnZJb4--Qm1zIPUModg5u5jZItNHd5k-EzbptqQjxqg-3x7BbdBPwwuM5nbHhLLgYfLoSoiC6cpJaqR-6Bovm5EnB3A1iQiV4iTyW1nljvAIP~kyURhAEbLUy95qWhnCqWeZoiohP3YM8qMBXauMAMNFQAYuIogjQ4ObzNazbrjkNEik5Dq8chB2WgxxkEA4JE6qBWV6kS9LpY-QfCyrV7c4U0kNNPmTpeCED9YOC8jrHLibECf8Hw__&Expires=1698975577&Key-Pair-Id=K1J2BR3INU6RYD&Signature=IkNUujU-zkM2cqFgnrJPlxIscHvf-rHq1vz~Jyu6ypGg3h0C02mimVMRZzllV-SZ~fuwjk-p6JpK2lhLvLswMczuvFjTSgEYea71EXpJ1W9Q-gOgpjMp84SZLaMa69IqzxPLNZFA6o1kGd5F12DV8myyosCxcFy~ZDIZsJss98IN7ebusGP5aZFVaXUSC3WBbkuMow1WQeERim7iK2RSXFzYNkiV1zjV6ZLGg8mZj2Gn-RoFB4DRS1vtkVl1~MTD9XmOItmmoThsqu~sMgnrKewEyQDwms~Y3aV4ClEsWxhAZMT9g4s5jQeRwRNjhriU5fY3GBkTWmBhekHA3ERK8Q__", + "title": "El agua 2", + "audio": "https://audio-lab.org/wp-content/uploads/2023/11/CEAR-agua2.mp3", "random": 0 }, { "name": "podcast4", - "title": "Podcast 4", - "audio": "https://d3uq9vzdmwnq5u.cloudfront.net/v1/variant/8e7eb371-ddd5-51b1-8879-7c99fa0874d5.mp3?session_id=5a59c020-a475-5cef-98c5-e0f05b3cacfe&ct=DOWNLOAD&episode_id=116862422&show_id=2284011&user_id=33206696&organization_id=ivoox&tenant=IVOOX×tamp=1698802776&media_type=dynamic&fallback_url=https%3A%2F%2Fd3uq9vzdmwnq5u.cloudfront.net%2Fpoximamenteescucharefugio-canalescucharefugio-ivoox116862422.mp3%3Fct%3DDOWNLOAD%26episode_id%3D116862422%26show_id%3D2284011%26user_id%3D33206696%26organization_id%3Divoox%26tenant%3DIVOOX%26timestamp%3D1698802776%26media_type%3Dstatic%26Expires%3D1698975576%26Key-Pair-Id%3DK1J2BR3INU6RYD%26Signature%3Dkc74xwxozH7Wo5rQzRwB1J2TmQ3V~tlWW8sl~mTPQnFfeQkpQoCVqbGsS4sjQM598MDoeMFCqMqNGqx4UTqwZdF7Eq397ir2JnZJb4--Qm1zIPUModg5u5jZItNHd5k-EzbptqQjxqg-3x7BbdBPwwuM5nbHhLLgYfLoSoiC6cpJaqR-6Bovm5EnB3A1iQiV4iTyW1nljvAIP~kyURhAEbLUy95qWhnCqWeZoiohP3YM8qMBXauMAMNFQAYuIogjQ4ObzNazbrjkNEik5Dq8chB2WgxxkEA4JE6qBWV6kS9LpY-QfCyrV7c4U0kNNPmTpeCED9YOC8jrHLibECf8Hw__&Expires=1698975577&Key-Pair-Id=K1J2BR3INU6RYD&Signature=IkNUujU-zkM2cqFgnrJPlxIscHvf-rHq1vz~Jyu6ypGg3h0C02mimVMRZzllV-SZ~fuwjk-p6JpK2lhLvLswMczuvFjTSgEYea71EXpJ1W9Q-gOgpjMp84SZLaMa69IqzxPLNZFA6o1kGd5F12DV8myyosCxcFy~ZDIZsJss98IN7ebusGP5aZFVaXUSC3WBbkuMow1WQeERim7iK2RSXFzYNkiV1zjV6ZLGg8mZj2Gn-RoFB4DRS1vtkVl1~MTD9XmOItmmoThsqu~sMgnrKewEyQDwms~Y3aV4ClEsWxhAZMT9g4s5jQeRwRNjhriU5fY3GBkTWmBhekHA3ERK8Q__", + "title": "Rio Arga", + "audio": "https://audio-lab.org/wp-content/uploads/2023/11/CEAR-ambiente-rio-arga.mp3", + "random": 0 + }, + { + "name": "podcast5", + "title": "Entrevista 1", + "audio": "https://audio-lab.org/wp-content/uploads/2023/11/CEAR-entrevista1.mp3", + "random": 0 + }, + { + "name": "podcast6", + "title": "Entrevista 2", + "audio": "https://audio-lab.org/wp-content/uploads/2023/11/CEAR-entrevista2.mp3", + "random": 0 + }, + { + "name": "podcast7", + "title": "Entrevista 3", + "audio": "https://audio-lab.org/wp-content/uploads/2023/11/CEAR-entrevista3.mp3", + "random": 0 + }, + { + "name": "podcast8", + "title": "Entrevista 4", + "audio": "https://audio-lab.org/wp-content/uploads/2023/11/CEAR-entrevista4.mp3", + "random": 0 + }, + { + "name": "podcast9", + "title": "Entrevista 5", + "audio": "https://audio-lab.org/wp-content/uploads/2023/11/CEAR-entrevista5.mp3", + "random": 0 + }, + { + "name": "podcast10", + "title": "Farsi - Afganistan", + "audio": "https://audio-lab.org/wp-content/uploads/2023/11/CEAR-espnol_farsi_afganistan.mp3", + "random": 0 + }, + { + "name": "podcast11", + "title": "Georgiano - Georgia", + "audio": "https://audio-lab.org/wp-content/uploads/2023/11/CEAR-georgiano_georgia.mp3", + "random": 0 + }, + { + "name": "podcast12", + "title": "Pashtun - Afganistan", + "audio": "https://audio-lab.org/wp-content/uploads/2023/11/CEAR-pashtun_afganistan.mp3", + "random": 0 + }, + { + "name": "podcast12b", + "title": "Español - Farsi - Afganistan", + "audio": "https://audio-lab.org/wp-content/uploads/2023/11/CEAR-espnol_farsi_afganistan.mp3", + "random": 0 + }, + { + "name": "podcast13", + "title": "Patois - Jamaica", + "audio": "https://audio-lab.org/wp-content/uploads/2023/11/CEAR-patois_jamaica.mp3", + "random": 0 + }, + { + "name": "pocast14", + "title": "Poema", + "audio": "https://audio-lab.org/wp-content/uploads/2023/11/CEAR-poema1.mp3", + "random": 0 + }, + { + "name": "pocast15", + "title": "Preparando té", + "audio": "https://audio-lab.org/wp-content/uploads/2023/11/CEAR-preparando-te.mp3", "random": 0 } ] \ No newline at end of file