mannyrothman 10 Posted June 24, 2024 Posted June 24, 2024 Movies are tagged in Radarr with who requested them via Overseerr. For example, if I requested a movie, the movie will be tagged with “1 - manny” in Radarr. Is there any way to have those same movies tagged with “1 - manny” in Emby?
Happy2Play 9835 Posted June 24, 2024 Posted June 24, 2024 I would assume you have to have Radarr write nfo files. But might create other issues.
mannyrothman 10 Posted June 24, 2024 Author Posted June 24, 2024 6 minutes ago, Happy2Play said: I would assume you have to have Radarr write nfo files. But might create other issues. I see. How can I have Radarr generate an nfo file that includes it's tag for each movie?
Happy2Play 9835 Posted June 24, 2024 Posted June 24, 2024 A fellow user will have to comment as I don't use any of the *arrs. I wouldn't think it would be that hard to test.
Solution Neminem 1747 Posted June 25, 2024 Solution Posted June 25, 2024 4 hours ago, mannyrothman said: Is there any way to have those same movies tagged with “1 - manny” in Emby? Not sure if this is needed, You should see tags here. Never used Radarr tags. But enabling this in Radarr will write the nfo file.
mannyrothman 10 Posted June 25, 2024 Author Posted June 25, 2024 30 minutes ago, jaycedk said: Not sure if this is needed, You should see tags here. Never used Radarr tags. But enabling this in Radarr will write the nfo file. This is perfect! I’ll enable this. Thank you!
KloudZ 0 Posted February 5, 2025 Posted February 5, 2025 On 6/25/2024 at 11:57 AM, mannyrothman said: This is perfect! I’ll enable this. Thank you! Have you tried? Are they compatible?
Happy2Play 9835 Posted February 5, 2025 Posted February 5, 2025 (edited) One would have to post a *arrs nfo file showing an example of them not working to potentially check compatibility. But it is a pretty simple field. <tag>3d</tag> <tag>alien</tag> <tag>alien planet</tag> <tag>anti war</tag> <tag>battle</tag> <tag>culture clash</tag> <tag>future</tag> <tag>futuristic</tag> <tag>love affair</tag> <tag>marine</tag> <tag>mind and soul</tag> <tag>power relations</tag> <tag>romance</tag> <tag>society</tag> <tag>soldier</tag> <tag>space</tag> <tag>space colony</tag> <tag>space travel</tag> <tag>space war</tag> <tag>tribe</tag> I believe nested also <Tags> <Tag>culture clash</Tag> <Tag>future</Tag> <Tag>space war</Tag> <Tag>space colony</Tag> <Tag>society</Tag> <Tag>space travel</Tag> <Tag>futuristic</Tag> <Tag>romance</Tag> <Tag>space</Tag> <Tag>alien</Tag> <Tag>tribe</Tag> <Tag>alien planet</Tag> <Tag>marine</Tag> <Tag>soldier</Tag> <Tag>battle</Tag> <Tag>love affair</Tag> <Tag>anti war</Tag> <Tag>power relations</Tag> <Tag>mind and soul</Tag> <Tag>3d</Tag> </Tags> But think the bigger issues is how ofton the *arrs touch the nfo files causing Emby to reread. Edited February 5, 2025 by Happy2Play
SuperCitizenEmb 33 Posted May 15 Posted May 15 (edited) Hi guys, abit late here. I have a reliable but slightly crude method of updating my radarr/sonarr tags to emby. basically it works like this: - query radarr/sonarr for list of tags - go the movie/tv show location - for radarr tagging :check if <movie name>.nfo exists in root of emby movie folder - for sonarr tagging: check if tvshow.nfo exists in root of emby series folder - if the respective tag is not in there already, appends tag to end of the respective nfo file. Please note: - this only adds tags, will not delete or update - in my radarr/sonarr containers, i mount: `- /mnt/media/:/data` but since im running this script outside the containers, i need to modify nfo files on the host system (which doesn't know about container "/data" path - this is why i replace "/data/" with "/mnt/media/" to find the file on my host system. You may or may not this part. Proper solution would be to not modify nfo files directly on filesystem, but to use Emby API. I would ideally make a radarr and sonarr version of the script and add them to each container as import hooks. If i get time i'll look into it. Surely a proper solution already exists, but i haven't found one. The aforementioned solution seems by @Neminem seems to give radarr/sonarr full power to modify emby nfo files, which takes emby away from being the real metadata manager for the media, which can result in problems described here: Ideally, i want to create a proper solution where we only copy tags from radarr/sonarr --> emby while keeping emby as the full metadata manager for media. Currently, there is no option in radarr/sonarr to sync only tags to emby metadata. my script (pip install pyarr): from pyarr import Sonarr, Radarr import os radarr_url = '<radarr url>' radarr_api = '<radarr api token>' radarr = Radarr(radarr_url, radarr_api) sonarr_url = '<sonarr url>' sonarr_api = '<sonarr api token' sonarr = Sonarr(sonarr_url, sonarr_api) # Radarr Tagging print("========== Radarr --> Emby tags ==========") tag_details = radarr.tag.get_detail() for tag in tag_details: label = tag["label"] movie_ids = tag["movieIds"] print(f"{label}: {len(movie_ids)}") for movie_id in movie_ids: movie = radarr.movie.get(movie_id) try: movie_path = movie["movieFile"]["path"].replace( "/data/", "/mnt/media/") except: continue movie_root_path = os.path.split(movie_path)[0] movie_file_name = os.path.split(movie_path)[1] nfo_file_name = movie_file_name.replace( ".mp4", ".nfo").replace(".mkv", ".nfo") nfo_file_path = os.path.join(movie_root_path, nfo_file_name) if os.path.exists(nfo_file_path): with open(nfo_file_path, "r") as file: nfo_data = file.read() if f"<tag>{label}</tag>" in nfo_data: # print("ALREADY TAGGED. SKIPPING...") continue nfo_new = nfo_data.replace( "</movie>", f" <tag>{label}</tag>\n</movie>") with open(nfo_file_path, "w") as file: file.write(nfo_new) print(f"{nfo_file_path} tagged with {label}") # Sonarr Tagging print("========== Sonarr --> Emby tags ==========") sonarr_tag_details = sonarr.tag.get_detail() for tag in sonarr_tag_details: label = tag["label"] series_ids = tag["seriesIds"] print(f"{label}: {len(series_ids)}") for series_id in series_ids: try: series = sonarr.series.get(series_id) series_path = series["path"].replace("/data/", "/mnt/media/") nfo_file_path = os.path.join(series_path, "tvshow.nfo") if os.path.exists(nfo_file_path): with open(nfo_file_path, "r") as file: nfo_data = file.read() if f"<tag>{label}</tag>" in nfo_data: continue nfo_new = nfo_data.replace( "</tvshow>", f" <tag>{label}</tag>\n</tvshow>") with open(nfo_file_path, "w") as file: file.write(nfo_new) print(f"{nfo_file_path} tagged with {label}") except Exception as e: print(f"Error processing series {series_id}: {e}") continue Edited May 15 by embylad892746
SuperCitizenEmb 33 Posted May 16 Posted May 16 (edited) if you want to delete all tags from your emby nfo files before running a fresh sync from radarr/sonarr --> emby: import os import sys # REMOVES ALL TAGS FOUND IN NFO FILES MEDIA_DIRS = [ "/mnt/media/movies", "/mnt/media/tv", ] def remove_tags_from_nfo(nfo_file_path): """Remove all lines containing both '<tag>' and '</tag>' from an NFO file.""" with open(nfo_file_path, "r") as file: nfo_data = file.read() lines = nfo_data.splitlines(keepends=True) cleaned_lines = [line for line in lines if not ("<tag>" in line and "</tag>" in line)] cleaned_data = "".join(cleaned_lines) if cleaned_data != nfo_data: with open(nfo_file_path, "w") as file: file.write(cleaned_data) return True return False def main(): total_cleaned = 0 total_scanned = 0 for media_dir in MEDIA_DIRS: if not os.path.exists(media_dir): print(f"WARNING: {media_dir} does not exist, skipping...") continue print(f"Scanning {media_dir}...") for root, dirs, files in os.walk(media_dir): for filename in files: if filename.endswith(".nfo"): nfo_path = os.path.join(root, filename) total_scanned += 1 try: if remove_tags_from_nfo(nfo_path): print(f" Cleaned: {nfo_path}") total_cleaned += 1 except Exception as e: print(f" ERROR: {nfo_path} - {e}") print(f"\nDone. Scanned {total_scanned} NFO files, cleaned tags from {total_cleaned}.") if __name__ == "__main__": main() Edited May 16 by embylad892746 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now