SamTV12345 / PodFetch

A sleek and efficient podcast downloader.
https://samtv12345.github.io/PodFetch
Apache License 2.0
347 stars 25 forks source link

Custom folder/file naming #114

Closed laurentlbm closed 1 year ago

laurentlbm commented 1 year ago

Clear and concise description of the problem

As a user, I would like the podcast folders and files to keep spaces in their names. I find it much easier to read outside the app.

Suggested solution

In the settings, we could provide options to define how the files are named. For example, we could give the following options for spaces: remove, keep, replace with '-' or '_'.

The same could be done with colons: remove or replace with ' - '.

It might also be useful to keep the episode number, if available, in the name, e.g. 35 - The episode.mp3

Alternative

No response

Additional context

Sonarr does this nicely, though it is much more complex: Screenshot_20230507-093244_Mull

Validations

SamTV12345 commented 1 year ago

Thanks for the issue. I'll postpone this for v4 as it requires a lot of rewriting/testing and the users might require to redownload episodes.

SamTV12345 commented 1 year ago

I implemented the feature. Could you please try it out on the dev tag @laurentlbm and check if this is what you proposed? Thanks.

laurentlbm commented 1 year ago

Thank you @SamTV12345, you are very quick!

The feature looks great and I'm glad that spaces are kept. There are a few small issues though:

  1. Colon replacement doesn't work: in the code, you do it after having removed illegal characters, so there's nothing left to replace. https://github.com/SamTV12345/PodFetch/blob/7cfffd6c874ce14669c7672fef9cf62f3a6edab1/src/service/file_service.rs#L155-L162
  2. The folder names of episodes are surrounded by single quotes, e.g. Podcast Name/'Episode tile'. https://github.com/SamTV12345/PodFetch/blob/7cfffd6c874ce14669c7672fef9cf62f3a6edab1/src/service/file_service.rs#L148
  3. It's not very clear how to use the fields Standard episode format and Standard podcast format. I personally don't need this feature at the moment, so maybe you should wait until someone else has a more specific need for it.
  4. There is an English translation missing: https://github.com/SamTV12345/PodFetch/blob/7cfffd6c874ce14669c7672fef9cf62f3a6edab1/ui/src/language/json/en.json#L126
  5. It should just be Dash and Dash separated with spaces (it's a space, not an underscore). https://github.com/SamTV12345/PodFetch/blob/7cfffd6c874ce14669c7672fef9cf62f3a6edab1/ui/src/language/json/en.json#L124-L125
SamTV12345 commented 1 year ago

Thank you @SamTV12345, you are very quick!

The feature looks great and I'm glad that spaces are kept. There are a few small issues though:

  1. Colon replacement doesn't work: in the code, you do it after having removed illegal characters, so there's nothing left to replace. https://github.com/SamTV12345/PodFetch/blob/7cfffd6c874ce14669c7672fef9cf62f3a6edab1/src/service/file_service.rs#L155-L162

  2. The folder names of episodes are surrounded by single quotes, e.g. Podcast Name/'Episode tile'. https://github.com/SamTV12345/PodFetch/blob/7cfffd6c874ce14669c7672fef9cf62f3a6edab1/src/service/file_service.rs#L148

  3. It's not very clear how to use the fields Standard episode format and Standard podcast format. I personally don't need this feature at the moment, so maybe you should wait until someone else has a more specific need for it.

  4. There is an English translation missing: https://github.com/SamTV12345/PodFetch/blob/7cfffd6c874ce14669c7672fef9cf62f3a6edab1/ui/src/language/json/en.json#L126

  5. It should just be Dash and Dash separated with spaces (it's a space, not an underscore). https://github.com/SamTV12345/PodFetch/blob/7cfffd6c874ce14669c7672fef9cf62f3a6edab1/ui/src/language/json/en.json#L124-L125

Thanks for the review. I'll try to implement it tomorrow. I'm currently thinking of how to make the download algorithm a little bit easier to maintain. 2. The single quotes are there to prevent unwanted behavior. E.g. a / in a date would mean a subdirectory or a .. could mean go one folder up. The single quotes prevent that behavior and makes adding podcasts with very specific titles easier to get working.

SamTV12345 commented 1 year ago

Could you please test again? I included your review. Thanks for that. I really overlooked these errors.

laurentlbm commented 1 year ago

Thank you! I'll try it out soon, but I'm swamped for the next few days!

SamTV12345 commented 1 year ago

No problem. Take your time. I did some intensive tests the last few days and couldn't find any errors in my code. But as always there may be characters out there that the library for deunicoding characters doesn't catch.