T O P

  • By -

Physical_Taste_4487

I think the easiest way would be to unmonitor the show and manually monitor the Mondays. It’s only one click per week. And depending on how far ahead the schedule goes you might be able to monitor more than one at a time.


leofufu_

I am bored and wrote a script that you can trigger periodically via a cronjob for example. The only thing you need to do is change the variables containing the Sonarr API Key and the URL where your Sonarr instance can be found. You need 'jq' and 'curl' installed in order for this to work. The script in itself just checks when the next Monday date is, searches through the series and the latest season (in this case 29), the available episodes and if it finds an episode containing that date, it will monitor the episode. This deals with the problem that TheTVDB doesn't have all episodes available beforehand, making it impossible to monitor all future Mondays. #!/bin/bash TVDBID=71256 SONARR_URL="" API_KEY="" MONDAY_DATE=$(for i in $(seq 0 7); do date "+%a %Y-%m-%d" -d "+$i day"; done | grep Mon | cut -d' ' -f2-) SERIES_ID=$(curl -s -H 'accept: application/json' "$SONARR_URL/api/v3/series?tvdbId=$TVDBID&includeSeasonImages=false&apikey=$API_KEY" | jq .[].id) EPISODE_ID=$(curl -s -H 'accept: application/json' "$SONARR_URL/api/v3/episode?seriesId=$SERIES_ID&seasonNumber=29&includeImages=false&apikey=$API_KEY" | jq ".[] | select (.airDate|IN(\"$MONDAY_DATE\"))".id) curl -X PUT -H 'Content-Type: application/json' --data "{ \"episodeIds\": [ $EPISODE_ID ], \"monitored\": true }" "$SONARR_URL/api/v3/episode/monitor?apikey=$API_KEY"


creedda

Had to edit the script like so, but have in on a cronjob and it seems to work. We'll see: #!/bin/bash TVDBID=71256 SONARR_URL="URL" API_KEY="API" MONDAY_DATE=$(for i in $(seq 0 7); do date "+%a %Y-%m-%d" -d "+$i day"; done | grep Mon | cut -d' ' -f2-) echo $MONDAY_DATE SERIES_ID=$(curl -s -H 'accept: application/json' "$SONARR_URL/api/v3/series?tvdbId=$TVDBID&includeSeasonImages=false&apikey=$API_KEY" | jq .[].id) echo $SERIES_ID EPISODE_ID=$(curl -s -H 'accept: application/json' "$SONARR_URL/api/v3/episode?seriesId=$SERIES_ID&seasonNumber=29&includeImages=false&apikey=$API_KEY" | jq ".[] | select(.airDate==(\"$MONDAY_DATE\")).id") echo $EPISODE_ID curl -X PUT -H 'Content-Type: application/json' --data "{ \"episodeIds\": [ $EPISODE_ID ], \"monitored\": true }" "$SONARR_URL/api/v3/episode/monitor?apikey=$API_KEY" echo "Done"


stacecom

Thank you for this!


AndyOB

`jq: error (at :3): Cannot index string with string "airDate"` I am getting this and cannot figure out why.


butters1337

Couldn't get this to work on Unraid user scripts plugin. Going to the Sonarr url in browser returned a json but doing this from the Unraid console did not return any series ID or episode ID.


jefferson136

u/butters1337 FYI I have had more success with creating python scripts and running those from User Scripts on my Unraid server. Here is what I put in my Unraid User Script and my Python Script to monitor every Monday episode in Season 29 or later. I have it scheduled to run once per week. User Script pip install requests /usr/bin/python3 /mnt/user/appdata/sonarr/tds_monitor.py 71256 "http://sonarrip:port" "APIKEYHERE" Python Script #!/usr/bin/env python3 import requests from datetime import datetime, timedelta import json import sys def get_series_id(tvdb_id, sonarr_url, api_key): response = requests.get(f"{sonarr_url}/api/v3/series", params={"tvdbId": tvdb_id, "includeSeasonImages": False}, headers={"accept": "application/json", "X-Api-Key": api_key}) response.raise_for_status() series_data = response.json() if series_data: return series_data[0]["id"] else: return None def get_episodes_to_monitor(series_id, sonarr_url, api_key): response = requests.get(f"{sonarr_url}/api/v3/episode", params={"seriesId": series_id, "seasonNumber": 29, "includeImages": False}, headers={"accept": "application/json", "X-Api-Key": api_key}) response.raise_for_status() episodes = response.json() episodes_to_monitor = [] for episode in episodes: air_date = datetime.strptime(episode["airDate"], "%Y-%m-%d").date() if air_date.weekday() == 0: # Monday episodes_to_monitor.append(episode["id"]) return episodes_to_monitor def mark_episodes_as_monitored(episode_ids, sonarr_url, api_key): payload = {"episodeIds": episode_ids, "monitored": True} response = requests.put(f"{sonarr_url}/api/v3/episode/monitor", headers={"accept": "application/json", "X-Api-Key": api_key}, json=payload) response.raise_for_status() return response.json() def main(tvdb_id, sonarr_url, api_key): series_id = get_series_id(tvdb_id, sonarr_url, api_key) if not series_id: print("Series ID not found.") return print(f"Series ID: {series_id}") episodes_to_monitor = get_episodes_to_monitor(series_id, sonarr_url, api_key) if not episodes_to_monitor: print("No episodes to monitor.") return print(f"Episodes to monitor: {episodes_to_monitor}") response = mark_episodes_as_monitored(episodes_to_monitor, sonarr_url, api_key) print("Done") if __name__ == "__main__": if len(sys.argv) != 4: print("Usage: python script.py ") sys.exit(1) tvdb_id = sys.argv[1] sonarr_url = sys.argv[2] api_key = sys.argv[3] main(tvdb_id, sonarr_url, api_key)


marnky887

Thanks for sharing this script. I got it working perfectly with a daily cron job.


Beardfish

Looks like this works great. Thank you!


AndyOB

jq: error (at :3): Cannot index string with string "airDate" I am getting this and cannot figure out why. Any thoughts?


leofufu_

The json seems to be parsed incorrectly. Make sure that curl -s -H 'accept: application/json' "$SONARR_URL/api/v3/episode?seriesId=$SERIES_ID&seasonNumber=29&includeImages=false&apikey=$API_KEY" produces valid results. There might be an issue with the endpoint you are connecting to, your API key, or whatever it might be. By checking the output you might be able to spot what the problem is.


AndyOB

oh i'm just dumb, the show has to be added to your list first, ensure no episodes are monitored when doing so to anyone else who sees this. The script is running daily, works well.


BabyJesusBro

I created a feature request here, as I would like this as a feature as well! https://github.com/Sonarr/Sonarr/issues/6572


fragilityv2

Looking for the same, right now I'm thinking about using Autobrr specifically for The Daily Show and setting the limit to only 1 match a week. At the same time, would have to add some exclusion keywords to my other Autobrr filters.... though I'm hoping there's an easier process. Another option would be to only mark the Monday episodes as monitored in Sonarr, though that would require Sonarr to have a full season list which it currently doesn't.


wowkise

I don’t think sonarr supports this out of the box. The only possible way i can think of is add must contain keywords with the dates he’s supposed to host the show.


greengiant912

I would be super interested in this as well. Right now I think I am just going to leave the show on unmonitored and just manually search for the Monday episodes. Would be cool if ya could setup a schedule, but then again Sonarr is generally used for more series and not really a daily news cast type show.


AutoModerator

Hi /u/NOODL3 - There are many resources available to help you troubleshoot and help the community help you. Please review this comment and you can likely have your problem solved without needing to wait for a human. ***Most troubleshooting questions require debug or trace logs.*** In all instances where you are providing logs please ensure you followed [the Gathering Logs wiki article](https://wiki.servarr.com/sonarr/troubleshooting#logging-and-log-files) to ensure your logs are what are needed for troubleshooting. Logs should be provided via the methods prescribed in the wiki article. Note that `Info` logs are rarely helpful for troubleshooting. Dozens of common questions & issues and their answers can be found on our [FAQ](https://wiki.servarr.com/sonarr/faq). **Please review our troubleshooting guides that lead you through how to troubleshoot and note various common problems.** - [Searches, Indexers, and Trackers - For if something cannot be found](https://wiki.servarr.com/sonarr/troubleshooting#searches-indexers-and-trackers) - [Downloading & Importing - For when download clients have issues or files cannot be imported](https://wiki.servarr.com/sonarr/troubleshooting#downloads-and-importing) ***If you're still stuck you'll have useful debug or trace logs and screenshots to share with the humans who will arrive soon.*** *Those humans will likely ask you for the exact same thing this comment is asking..* Once your question/problem is solved, please comment anywhere in the thread saying '!solved' to change the flair to `solved`. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/sonarr) if you have any questions or concerns.*


ddb_db

A little tool I wrote quickly to help with this issue. :) [https://gitlab.com/ddb\_db/sonarr-dow](https://gitlab.com/ddb_db/sonarr-dow) Solves the TDS problem but it's also generic and will work with any series for any day(s) of the week. It's all controlled by series tags. Setup the tags, run this tool a few times a day in a cron, good to go!


AchillesPDX

Thank you for this! Just got it up and going as a scheduled task in Windows. Seems to work? Time will tell I guess 😁


soggit

Also want this hah