Schaka / janitorr

Cleans your Radarr, Sonarr, Jellyseerr and Jellyfin before you run out of space
GNU General Public License v3.0
263 stars 5 forks source link

collectionType NULL issue #12

Closed coltondick closed 6 months ago

coltondick commented 6 months ago

I've implemented Janitorr, but I am running into an issue with all of my movies not having a collectionType set. I have verified this by writing this python script:

Verifying that NULL values exist

from pyarr import RadarrAPI

# Radarr API URL and API key
api_url = "https://radarr.domain.tld"  # Replace with your Radarr instance URL
api_key = "8ed34aXXXXXXXXXXXXXXXXXXXXXXXXXX"  # Replace with your actual API key

# Create a RadarrAPI object
radarr = RadarrAPI(host_url=api_url, api_key=api_key)

def list_movies_with_null_collection_type():
    try:
        # Fetch all movies
        movies = radarr.get_movie()

        # Iterate and find movies with null 'CollectionType'
        for movie in movies:
            if movie.get("collectionType") is None:
                print(f"Title: {movie['title']} - CollectionType is null")

    except Exception as e:
        print(f"An error occurred: {e}")

# Call the function
list_movies_with_null_collection_type()

Sample output from above

╰─ python3 find_collectionType_radarr.py                                                                                                                                                                                                                                                                                                                                    ─╯
Title: From Up on Poppy Hill - CollectionType is null
Title: CKY - CollectionType is null
Title: Ready or Not - CollectionType is null
Title: The Conjuring: The Devil Made Me Do It - CollectionType is null
Title: Rogue One: A Star Wars Story - CollectionType is null
Title: I Am Jane Doe - CollectionType is null
Title: Sex Trafficking in America - CollectionType is null
Title: Beetlejuice - CollectionType is null
Title: Black Panther - CollectionType is null
Title: Remember Me - CollectionType is null
Title: Benny & Joon - CollectionType is null
Title: Fear and Loathing in Las Vegas - CollectionType is null
Title: The Texas Chainsaw Massacre - CollectionType is null
Title: Drop Dead Fred - CollectionType is null
Title: The Rocky Horror Picture Show - CollectionType is null
Title: The Notebook - CollectionType is null
Title: Bram Stoker's Dracula - CollectionType is null
Title: The Descent - CollectionType is null
Title: The Chronicles of Narnia: The Lion, the Witch and the Wardrobe - CollectionType is null
Title: Nine Lives - CollectionType is null
Title: Brokeback Mountain - CollectionType is null
Title: The Hills Have Eyes - CollectionType is null
Title: The Hills Have Eyes 2 - CollectionType is null
Title: When a Stranger Calls - CollectionType is null
Title: Cold Creek Manor - CollectionType is null
Title: The Manson Family - CollectionType is null

Janitorr Log

feign.FeignException: Instantiation of [simple type, class com.github.schaka.janitorr.jellyfin.library.items.MediaFolderItem] value failed for JSON property CollectionType due to missing (therefore NULL) value for creator parameter CollectionType which is a non-nullable type
 at [Source: (BufferedReader); line: 1, column: 8840] (through reference chain: com.github.schaka.janitorr.jellyfin.library.items.ItemPage["Items"]->java.util.ArrayList[8]->com.github.schaka.janitorr.jellyfin.library.items.MediaFolderItem["CollectionType"]) reading GET https://jellyfin.colton.sh/Library/MediaFolders
        at feign.FeignException.errorReading(FeignException.java:167) ~[feign-core-13.1.jar:na]
        at feign.InvocationContext.decode(InvocationContext.java:120) ~[feign-core-13.1.jar:na]
        at feign.InvocationContext.proceed(InvocationContext.java:88) ~[feign-core-13.1.jar:na]
        at feign.ResponseHandler.handleResponse(ResponseHandler.java:63) ~[feign-core-13.1.jar:na]
        at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:114) ~[feign-core-13.1.jar:na]
        at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:70) ~[feign-core-13.1.jar:na]
        at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:99) ~[feign-core-13.1.jar:na]
        at jdk.proxy2/jdk.proxy2.$Proxy75.getAllItems(Unknown Source) ~[na:na]
        at com.github.schaka.janitorr.jellyfin.JellyfinRestService.cleanupTvShows(JellyfinRestService.kt:37) ~[classes/:na]
        at com.github.schaka.janitorr.CleanupSchedule.deleteTvShows(CleanupSchedule.kt:67) ~[classes/:na]
        at com.github.schaka.janitorr.CleanupSchedule.runSchedule(CleanupSchedule.kt:39) ~[classes/:na]
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[na:na]
        at org.springframework.scheduling.support.ScheduledMethodRunnable.runInternal(ScheduledMethodRunnable.java:130) ~[spring-context-6.1.2.jar:6.1.2]
        at org.springframework.scheduling.support.ScheduledMethodRunnable.lambda$run$2(ScheduledMethodRunnable.java:124) ~[spring-context-6.1.2.jar:6.1.2]
        at io.micrometer.observation.Observation.observe(Observation.java:499) ~[micrometer-observation-1.12.1.jar:1.12.1]
        at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:124) ~[spring-context-6.1.2.jar:6.1.2]
        at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-6.1.2.jar:6.1.2]
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[na:na]
        at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source) ~[na:na]
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) ~[na:na]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[na:na]
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[na:na]
        at java.base/java.lang.Thread.run(Unknown Source) ~[na:na]

Can this be updated to accept NULL values, or is there something I am missing in my configuration that isn't setting this value correctly.

Schaka commented 6 months ago

The collectionType is actually referring to Jellyfin - it's this API call: https://api.jellyfin.org/#tag/Library/operation/GetMediaFolders

I can technically make Janitorr accept NULL values here. It shouldn't affect functionality. So I'll have the fix out and you can pull the latest tag.

Thank you for your report.