l3uddz / traktarr

Script to add new series & movies to Sonarr/Radarr based on Trakt lists.
GNU General Public License v3.0
584 stars 53 forks source link

Please consider adding a max search depth option #106

Open DaveidWeba opened 4 years ago

DaveidWeba commented 4 years ago

Love the service this provides, but one problem I frequently come across is at some point I feel like my automatic search for shows & movies is "scraping the bottom of the barrel" and adding low quality content that I would never add and likewise never watch. I've adjusted my intervals accordingly to try and avoid this problem, but it would be really nice to have a depth option so I can keep my intervals low and searches regular in case something new starts to trend or become popular.

For example: Currently, when Traktarr is searching for popular movies and I already have the first 500 in Trakt's list, it will download the 501st most popular movie. With a depth option of 100, if the first 100 results doesn't yield anything that I don't already have then it stops searching.

Thank you!

Genhawk25 commented 4 years ago

This 1000% times. I was so excited when I first heard about Traktarr, but this is the single reason have it turned off right now.

If I want Top 5 trending, I ONLY want Top 5. As it stands, Monday: Top 5, Tuesday: Top 5-10, Wednesday, Top 10-15, Thursday: Top 15-20, etc

Thanks,

tupadr3 commented 4 years ago

87 implements this feature

wellingssimon commented 4 years ago

I agree this is a great feature to be added although I'm not sure how to implement it in my config.json. I've added "limit_list_results": 5, to filters, movies but seems to have no effect. Can anybody advise on the correct way to enable it? Many thanks for the help, thanks to @tupadr3 for highlighting this and thanks to all those involved for this neat little program.

tupadr3 commented 4 years ago

@wellingssimon: Mine looks something like this:

....
    "movies": {
      "interval": 1,
      "anticipated": {
        "add_limit": 15,
        "results_limit": 15
      },
      "boxoffice": {
        "add_limit": 3,
        "results_limit": 3
      },
.....
wellingssimon commented 4 years ago

@tupadr3 Fantastic! I'll give that a try. Thanks.

wellingssimon commented 4 years ago

Hi @tupadr3 Ok.....I'm clearly missing something. I either get outright errors with my config or python errors (which also seem related to my config. My config is like this for testing which isn't working:

"automatic": { "movies": { "interval": 1, "anticipated": { "add_limit": 15, "results_limit": 15 }, "boxoffice": { "add_limit": 3, "results_limit": 3 }, } "shows": { "anticipated": 0, "interval": 1, "popular": 0, "trending": 0, "watched": 0 } },

I don't think I understand the correct syntax sufficiently. Would you mind sharing the full movies and tv shows section of your config?

Genhawk25 commented 4 years ago

image

I too am getting an error on load....

wellingssimon commented 4 years ago

I think my config is now correct (no json errors at least) "movies": { "anticipated": { "add_limit": 5, "results_limit": 5 }, "boxoffice": 0, "interval": 48, "popular": { "add_limit": 10, "results_limit": 10 }, "trending": { "add_limit": 10, "results_limit": 10 } }, "shows": { "anticipated": 0, "interval": 48, "popular": 0, "trending": 0 } },

Running the program gives me the below error: 2020-01-23 08:59:13,979 - ERROR - Traktarr - automatic_movies - Exception while automatically adding movies: Traceback (most recent call last): File "/usr/local/bin/traktarr", line 1429, in automatic_movies if limit <= 0: TypeError: unorderable types: dict() <= int()

After adding additional logging I can now see that the program is attempting to use "{'results_limit': 10, 'add_limit': 10}" as the value for "limit" which should just be an integer i.e. 10. It simply seems the code can't handle the addition of 2 separate limits for each trakt list. If this ever worked has the code been reverted at some time?

wellingssimon commented 4 years ago

Think I have it working. I had to do a fresh install of Traktarr using the code at the point of the #87 commit from https://github.com/l3uddz/traktarr/tree/bbcf52770484e9b56ed267379c7ec6a2a9eb1049 . My accepted config now looks like this:

Screenshot 2020-01-23 at 12 44 39

On the face of it, it appears to be working as expected.

Genhawk25 commented 4 years ago

How did you get it working? Been messing with it for hours now... Keep getting JSON errors. I have even tried your config file and still no go!

image

I think you're on to something. Some reason, the latest traktarr.py does not have the code in it for the results limit. Wonder why it was taken out?

wellingssimon commented 4 years ago

@Genhawk25 Yeah, it does appear that the code has been reverted. I had a mare as well getting my syntax correct in the config file. I'll share a sanitised copy of my config that you can just amend the values in and should work. I wouldn't delete any sections or try to add new, it's bound to go wrong again then. Simply amend the values you want and add your api keys etc.

Let me know how you get on. I'm interested to know whether this will work on another system or if I've just stumbled upon something that gets it working on mine.

https://drive.google.com/file/d/1VNSZ1FuA3EHNPCHJ9m1bu5EOeiS7SSwd/view?usp=sharing

I'll leave the file available for a few days.

tupadr3 commented 4 years ago

I use the pull request directly:

# linux+docker required

# install jq 2 format json
sudo apt update && sudo apt install jq -y

git clone git@github.com:l3uddz/traktarr.git
cd traktarr
git fetch origin pull/87/head:Aethaeran
git checkout Aethaeran 
mkdir config -p
jq . <<< '{"automatic":{"movies":{"interval":1,"anticipated":{"add_limit":15,"results_limit":15},"boxoffice":{"add_limit":3,"results_limit":3},"played":{"add_limit":10,"results_limit":10},"popular":{"add_limit":50,"results_limit":50},"recommended":{"add_limit":0,"results_limit":0},"trending":{"add_limit":10,"results_limit":10},"watched":{"add_limit":10,"results_limit":10},"watchlist":{},"lists":{}},"shows":{"interval":1,"anticipated":{"add_limit":15,"results_limit":15},"played":{"add_limit":10,"results_limit":10},"popular":{"add_limit":20,"results_limit":20},"recommended":{"add_limit":0,"results_limit":0},"trending":{"add_limit":5,"results_limit":5},"watched":{"add_limit":10,"results_limit":10},"watchlist":{},"lists":{}}},"core":{"debug":false},"filters":{"movies":{"allowed_countries":["us","gb","ca"],"allowed_languages":[],"blacklist_title_keywords":["untitled","barbie","ufc"],"blacklisted_genres":["music","sporting-event","film-noir","fan-film"],"blacklisted_max_year":2021,"blacklisted_min_runtime":60,"blacklisted_min_year":2000,"blacklisted_tmdb_ids":[],"disabled_for":[],"rating_limit":""},"shows":{"allowed_countries":["us","gb","ca"],"allowed_languages":[],"blacklisted_min_runtime":15,"blacklisted_min_year":2010,"blacklisted_max_year":2021,"blacklisted_genres":["animation","game-show","talk-show","home-and-garden","children","reality","anime","news","special-interest"],"blacklisted_networks":["twitch","nickelodeon","hallmark","reelzchannel","cnn","cbbc","the movie network","teletoon","cartoon network","espn","fox sports","yahoo!"],"blacklisted_tvdb_ids":[],"disabled_for":[]}},"notifications":{"verbose":true},"omdb":{"api_key":""},"radarr":{"api_key":"XXXXXXXXXXXXXXXX","minimum_availability":"released","profile":"Any","root_folder":"/movies","url":"https://XXXXXXXXXXXXXXXXXXXXX.com"},"sonarr":{"api_key":"XXXXXXXXXXXXXXXXXXx","profile":"Any","root_folder":"/tv","tags":{},"url":"https://XXXXXXXXXXXXXXXXXXXXXXX.com"},"trakt":{"client_id":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","client_secret":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"}}' > config/config.json
cat config/config.json

# change config settings
nano config/config.json

# build docker image
docker build -f docker/Dockerfile -t traktarr:Aethaeran .
docker run -it --rm --name='traktarr-eng' \
 -e PUID=1000 -e PGID=1000 -e UMASK=2 \
 -e TRAKTARR_CONFIG=/config/config.json \
 -e TRAKTARR_LOGFILE=/config/traktarr.log \
 -e TRAKTARR_CACHEFILE=/config/cache.db \
 -v ${PWD}/config:/config:rw \
 tpdr3-traktarr:develop \
 run --run-now --add-delay 5
SalkinDK commented 4 years ago

Any News on merging this into master?

ejalal commented 1 year ago

Well I assumed traktarr had a limit as described in this feature request, but it ended up importing crap series and movies as the first few hundreds/thousands items are already present in my sonarr/radarr instances... could be nice to scrap only the first X (number configured) items from each list and imports only the new ones (not just always import X items from each list no matther what their order in the list is)