anytime_podcast_player icon indicating copy to clipboard operation
anytime_podcast_player copied to clipboard

Feature/automatically remove downloaded played episodes

Open senzidee opened this issue 1 year ago • 10 comments

I have added switch in settings section for enable/disable automatic erase of played downloaded episodes. Erasing occurs as a result of the event AudioProcessingState.completed in audio player service. I also write test for settings page but I don't know how to simulate the player event and then write a test for this new feature.

Close #112

senzidee avatar Feb 19 '24 09:02 senzidee

If you want, give me some pointers. I could add also Italian language.

senzidee avatar Feb 23 '24 17:02 senzidee

I have been testing this. It seems to work OK on an emulator, but I am getting issues on real devices. With the option enabled, at the end of an episode playback stalls and the episode is not deleted. I suspect a lock somewhere.

Have you have any similar issues testing this on real devices?

amugofjava avatar Apr 18 '24 12:04 amugofjava

No, but I can test on other device. Test it and report again.

senzidee avatar Apr 18 '24 15:04 senzidee

Hi @amugofjava, in the last two weeks I have tested on a physical device, my Oppo Android Phone. I have used it to listen to several podcasts of different lengths and have never encountered any uncertainties or problems. Can I do some more tests?

senzidee avatar May 05 '24 19:05 senzidee

Hi @mrkrash,

Thanks for the update. I'll do some more testing here, see if I can reproduce the issue. From memory, when it happened to me I had a few episodes of Podnews Daily queued up. These are short episodes and when it finished episode one, and tried to start episode two it stalled when the auto delete option was enabled.

I'll let you know what I find. Thanks.

amugofjava avatar May 06 '24 08:05 amugofjava

Hi @mrkrash,

I have managed to reproduce the issue. What is happening is that, when the delete option is enabled it is being called at the end of every episode and not just for those that have been downloaded.

To reproduce, enable the delete option and then stream an episode rather than playing a downloaded one. At the end of the episode an exception will be raised and playback will stop.

amugofjava avatar May 21 '24 15:05 amugofjava

Hi @amugofjava, I have added a control that proceed with deletion only if episode has download status to downloaded. I have tested it on my android phone and work but, when you have two minutes, can you test?

senzidee avatar May 31 '24 22:05 senzidee

Hi @mrkrash,

Sorry for the slow response, I've had a busy few weeks. I've given this update a quick test and for me the episodes are not deleting once played. I will dive into the code when I can to see what's going on, but giving you a heads up so you can take a look too.

Is it all working for you? If you queue up a mix of downloaded and streamed episodes, are all the episodes played successfully and do all the downloaded episodes get removed?

amugofjava avatar Jun 22 '24 14:06 amugofjava

Hi @amugofjava, I haven't test a mixed queue, sorry. I'll test it and verify where is the error.

senzidee avatar Jul 02 '24 08:07 senzidee

Hi @amugofjava, I'm sorry for my late reply. I have just end test on my iPhone emulator and on my Android Phone. There was an error on a condition and now the episodes are now deleted correctly. I have rebased this PR and test it with mixed queue. In the queue, episode have a length of five minutes (I couldn't find any shorter ones).

senzidee avatar Oct 03 '24 10:10 senzidee

I'll try and get this tested soon @mrkrash - just been really busy the past few weeks. Thanks.

amugofjava avatar Nov 05 '24 12:11 amugofjava

Thanks @mrkrash looks good and I will merge your PR.

There are a couple of small issues, but I am happy to handle these:

  1. There is an edge case when using the sleep timer and setting it to 'End of episode'. At the end of the episode playback stops, but as it's at the end the mp3 is deleted which causes an exception.
  2. Needs translations for Italian & German.

amugofjava avatar Nov 20 '24 12:11 amugofjava