jsaddiction / TrailerTech

Download Trailers for you movies
MIT License
12 stars 4 forks source link

Folder fails to lookup in tmdb because of `-` and `:` #59

Open jessedobbelaere opened 8 months ago

jessedobbelaere commented 8 months ago

I'm retroactively scanning for missing trailers, but when a movie has a - instead of : in the folder name, the lookup in TMDB seems to fail. In many OS filesystems, a colon : cannot be used so - is added instead.

Example:

The TMDB API gets checked using the following snippet. A quick test to replace the special characters, makes it work with a lot of movies.

# https://github.com/jsaddiction/TrailerTech/blob/main/providers/tmdb.py#L198
        for result in response['results']:
-            if str(year) in result['release_date'] and result['title'].lower() == title.lower():
+            if str(year) in result['release_date'] and result['title'].lower().replace(":", "") == title.lower().replace(" -", ""):
                return result['id']

Ideally, we strip out special characters in this string matcher?

jsaddiction commented 8 months ago

I like where you mind is on this. Honestly, this script has taken a back seat for now. I am rewriting several scripts to manage kodi library based on several events triggered by the *arr apps in a smart converged library way. After I have filled that gap, I will eventually get to rewriting this script. I think better integration with Radarr and a local database within the script will prove to be much more efficient. This script scans your entire library every time it's called unless a specific path is given. To me we should already know what we have. Additionally, I'd like to cache result from TMDB and look for updates weekly and act on TMDB's changes rather than searching over and over. Moreover, I am a quality nerd so accurate analysis of resolution and bit rate of all available trailers should be determined and stored (TMDB sometimes lies). Potential upgrades should be downloaded, evaluated, stored in the db and replace the original if better. Just some thoughts.

As for your current issue, you are welcome to fork this repo, make the edits and use to your liking. For me, this script is fairly stale and desperately needs some upgrades.