akhilrex / podgrab

A self-hosted podcast manager/downloader/archiver tool to download podcast episodes as soon as they become live with an integrated player.
GNU General Public License v3.0
1.67k stars 93 forks source link

Episode playing order #190

Open fsmeets84 opened 2 years ago

fsmeets84 commented 2 years ago

Currently in the Podcast Player the only order to play episodes is from new to old. However in many cases podcast are in a storyline, where you would like to play the episode from old to new. Is there a possiblity to implement an option to choose the sorting order for the pocast player?

Ruthalas commented 1 year ago

I have been digging into this a little. (Disclaimer, I am a novice, so this may be off-base.)

Looking through the player page code, PodGrab seems to make use of AmplitudeJS to implement the playback UI. The function calls seem to match anyway.

As far as I can tell Amplitude doesn't have a re-order/sort functionality in its playlist. I think this is where Amplitude requests the playlist content from the backend:

        created(){
          const self=this;
          this.socket= getWebsocketConnection(function(event){
                const message= getWebsocketMessage("RegisterPlayer","")
                self.socket.send(message);
              },x=>{
                if(!x.data){
                  return
                }
                payload= JSON.parse(x.data);
                if(payload.messageType=="Enqueue"){
                  newItems=JSON.parse(payload.payload);
                  newItems.forEach(x=>{this.allItems.push(x)});
                    newSongs=self.getSongsFromItems(newItems);
                    newSongs.forEach(x=>{Amplitude.addSong(x)});
                }
              });
        },

The provided order sets the order in Amplitude's playlist. That payload needs to have an option (perhaps a toggle in Settings?) to provide a 'reverse' order, starting with oldest.

I'd really love for this to be an option. All the content I consume in PodGrab (and I assume a large portion of the content others consume) is narrative, or at least sequential, and cannot be listened to starting at the most recent episode.

I will keep looking in to this, and hopefully help this suggestion along.