johnsturgeon / plex-tools

Utilities and scripts for plex using the Plex API
MIT License
14 stars 0 forks source link

[Feature request] Option to add automatic sorting based on bitrate #13

Open jocxfin opened 4 months ago

jocxfin commented 4 months ago

Issue: I have a library with over 120 000 songs, and I ran this program, and there are 1034 duplicates found. There seems to be no option to just automatically go through the songs. It's unfortunately unusable for that reason.

Proposed solution: Add a feature, which asks the user if they want to use an automatic process, which uses few different methods for sorting. Some that came into my mind:

  1. Creation date: delete either the older or the newer duplicates
  2. Size: Delete either the larger one or smaller one
  3. Bitrate: Delete either the one with higher bitrate or the one with lower
  4. Album or single: If the track has album and single versions, select which one to prefer
  5. Regex recognition: for example if the track name has (1) in it, you could use regex to detect that

Those options could be merged so let's say "I want the songs where creation date does not matter, but if the track is bigger, and has larger bit rate and has (1) in the file name, delete it right away"

Justification: Better user experience for users with a tad larger libraries. Also helps users to gain more power over which versions they want to keep and which to delete.

jocxfin commented 4 months ago

hmm i actually wrote the code for this myself. can create a pr tomorrow

johnsturgeon commented 4 months ago

I'm very interested in your proposal. I agree that there might be more to it than just filename, for instance you might have one of the two copies that have higher play counts, or that you've rated (and one you haven't rated).

It would be nice to get the feature where we merge metadata done first, but let's take a look.

johnsturgeon commented 4 months ago

Quick question about your request, are you proposing the script 'auto delete' based on criteria? Or simply 'pre-select' songs for deletion which you then confirm song by song?

jocxfin commented 4 months ago

Hey! Sorry for the late response. My coding server unfortunately got corrupted and had to work on that so I lost everything I had on this, but to answer your question, there should be an option if the user wants to auto delete or just to pre-select them for later deletetion.

johnsturgeon commented 4 months ago

No problem! I think I can get this on my roadmap pretty quickly, I need to finish getting some basic unit tests in place / add CI workflows and pylint.

Once I do that I can pretty confidently move forward with new features.