Schaka / janitorr

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

GET http://jellyfin:8096/Library/VirtualFolders returns a html type response #46

Closed feroxib closed 1 month ago

feroxib commented 1 month ago

I just did a fresh install of janitorr using the documentation and the default application.yml template.

changed all the secrets, api keys, hosts and ports. janitorr has its own "service account" in jellyfin and all necessary permissions.

Firing up janitorr sadly led to nothing more than a: ERROR 1 --- [ scheduling-1] o.s.s.s.TaskUtils$LoggingErrorHandler : Unexpected error occurred in scheduled task

Whats going on here?

since i was trying to find out the error myself at first i know now that the log msg

feign.FeignException: Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false') at [Source: (BufferedReader); line: 1, column: 2] reading GET http://jellyfin:8096/Library/VirtualFolders

is telling me its seeing an < char in the awaited json response and cant process that (obviously...). did a GET http://jellyfin:8096/Library/VirtualFolders with insomnia and got:

<!doctype html> ......... (if requested ill post the rest of that)

since im new to janitorr and didnt see any obvious mistakes of mine (hopefully ;) ) id love to get some insight on what might be the culprit/fix or bug.

thank you in advance feroxib

Schaka commented 1 month ago

Can you please share your config with snesitive information redacted?

It seems that that URL is getting an HTML response (could potentially be from reverse proxy or invalid API key), as you've correctly identified. Does the user have access to all necessary libraries? Does your server even run on jellyfin:8096 and is reachable by janitorr under that URL?

When I make a get request wth the right API key to that URL for my server, I get:

[
    {
        "Name": "Movies",
        "Locations": [
            "/data/media/movies"
        ],
        "CollectionType": "movies",
        "LibraryOptions": {
            "Enabled": true,
            "EnablePhotos": true,
            "EnableRealtimeMonitor": true,
            "EnableLUFSScan": false,
            "EnableChapterImageExtraction": true,
            "ExtractChapterImagesDuringLibraryScan": true,
            "EnableTrickplayImageExtraction": false,
            "ExtractTrickplayImagesDuringLibraryScan": false,
            "PathInfos": [
                {
                    "Path": "/data/media/movies"
                }
            ],
            "SaveLocalMetadata": true,
            "EnableInternetProviders": false,
            "EnableAutomaticSeriesGrouping": false,
            "EnableEmbeddedTitles": true,
            "EnableEmbeddedExtrasTitles": false,
            "EnableEmbeddedEpisodeInfos": false,
            "AutomaticRefreshIntervalDays": 0,
            "PreferredMetadataLanguage": "en",
            "MetadataCountryCode": "DE",
            "SeasonZeroDisplayName": "Specials",
            "MetadataSavers": [
                "Nfo"
            ],
            "DisabledLocalMetadataReaders": [],
            "LocalMetadataReaderOrder": [
                "Nfo"
            ],
            "DisabledSubtitleFetchers": [],
            "SubtitleFetcherOrder": [],
            "SkipSubtitlesIfEmbeddedSubtitlesPresent": false,
            "SkipSubtitlesIfAudioTrackMatches": false,
            "SubtitleDownloadLanguages": [],
            "RequirePerfectSubtitleMatch": true,
            "SaveSubtitlesWithMedia": true,
            "SaveLyricsWithMedia": false,
            "AutomaticallyAddToCollection": true,
            "AllowEmbeddedSubtitles": "AllowAll",
            "TypeOptions": [
                {
                    "Type": "Movie",
                    "MetadataFetchers": [
                        "TheMovieDb",
                        "The Open Movie Database"
                    ],
                    "MetadataFetcherOrder": [
                        "TheMovieDb",
                        "The Open Movie Database"
                    ],
                    "ImageFetchers": [
                        "TheMovieDb",
                        "The Open Movie Database",
                        "Embedded Image Extractor",
                        "Screen Grabber"
                    ],
                    "ImageFetcherOrder": [
                        "TheMovieDb",
                        "The Open Movie Database",
                        "Embedded Image Extractor",
                        "Screen Grabber"
                    ],
                    "ImageOptions": []
                }
            ]
        },
        "ItemId": "f137a2dd21bbc1b99aa5c0f6bf02a805",
        "PrimaryImageItemId": "f137a2dd21bbc1b99aa5c0f6bf02a805",
        "RefreshStatus": "Idle"
    },

The header to access that URL is

MediaBrowser Token="${properties.apiKey}", Client="Janitorr", Device="Spring Boot", DeviceId="Janitorr-Device-Id", Version="1.0"
feroxib commented 1 month ago

Hi thanks for the reply

my config

server:
  port: 8979

# File system access (same mapping as Sonarr, Radarr and Jellyfin) is required to delete TV shows by season and create "Leaving Soon" collections in Jellyfin
# Currently, Jellyfin does not support an easy way to add only a few seasons or movies to a collection, we need access to temporary symlinks
# Additionally, checks to prevent deletion on currently still seeding media currently require file system access as well
file-system:
  access: true
  validate-seeding: true # validates seeding by checking if the original file exists and skips deletion - turning this off will send a delete to the *arrs even if a torrent may still be active
  leaving-soon-dir: "/media/leaving-soon" # A directory this container can write to and Jellyfin can find under the same path - this will contain new folders with symlinks to files for Jellyfin's "Leaving Soon" collections
  from-scratch: true # Clean up entire "Leaving Soon" directory and rebuild from scratch - this can help with clearing orphaned data - turning this off can save resources (less writes to drive)
  free-space-check-dir: "/data" # This is the default directory Janitorr uses to check how much space is left on your drives. By default, it checks the entire root - you may point it at a specific folder

application:
  dry-run: false
  whole-tv-show: false # activating this will treat as a whole show as recently download/watched from a single episode, rather than that episode's season - shows will be deleted as a whole
  whole-show-seeding-check: false # Turning this off, disables the seeding check entirely if whole-tv-show is enabled. Activating this check will keep a whole TV show if any season is still seeding (requires file access).
  leaving-soon: 14d # 14 days before a movie is deleted, it gets added to a "Leaving Soon" type collection (i.e. movies that are 76 to 89 days old)
  exclusion-tag: "janitorr_keep" # Set this tag to your movies or TV shows in the *arrs to exclude media from being cleaned up

  media-deletion:
    enabled: true
    movie-expiration:
      # Percentage of free disk space to expiration time - if the highest given number is not reached, nothing will be deleted
      # If filesystem access is not given, disk percentage can't be determined. As a result, Janitorr will always choose the largest expiration time.
      5: 15d # 15 days
      10: 30d # 1 month - if a movie's files on your system are older than this, they will be deleted
      15: 30d # 2 months
      20: 90d # 3 months
    season-expiration:
      5: 15d # 15 days
      10: 20d # 20 days - if a season's files on your system are older than this, they will be deleted
      15: 60d # 2 months
      20: 120d # 4 months

  tag-based-deletion:
    enabled: true
    minimum-free-disk-percent: 100
    schedules:
      - tag: 5 - demo
        expiration: 30d
      - tag: 10 - demo
        expiration: 7d

  episode-deletion: # This ignores Jellystat. Only grab history matters. It also doesn't clean up Jellyfin. There is NO seeding check either.
    enabled: true
    tag: janitorr_daily # Shows tagged with this will have all episodes of their LATEST season deleted by the below thresholds
    max-episodes: 10 # maximum (latest) episodes of this season to keep
    max-age: 30d # Maximum age to keep any episode at all - even the last 10 episodes would expire after 30 days in this example

clients:
  sonarr:
    enabled: true
    url: "http://sonarr:8989"
    api-key: "******************************92"
    delete-empty-shows: true # If a show that was "touched" by Janitorr contains no files and has no monitored seasons at all, it will get deleted as part of orphan cleanup
  radarr:
    enabled: true
    url: "http://radarr:7878"
    api-key: "*******************************8b"

  ## You can only choose one out of Jellyfin or Emby.
  ## User login is only needed if deletion is enabled.
  jellyfin:
    enabled: true
    url: "http://**.**.**.*:8096"
    api-key: "******************************ac"
    username: janitorr
    password: "********************************************************************************************************************"
    delete: true # Jellyfin setup is required for JellyStat. However, if you don't want Janitorr to send delete requests to the Jellyfin API, disable it here

  jellyseerr:
    enabled: true
    url: "http://jellyseerr:5055"
    api-key: "***************************************=="
    match-server: false # Enable if you have several Radarr/Sonarr instances set up in Jellyseerr. Janitorr will match them by the host+port supplied in their respective config settings.
  jellystat:
    enabled: false
    whole-tv-show: false # Enabling this will make Jellystat consider TV shows as a whole if any episode of any season has been watched
    url: "http://jellystat:3000"
    api-key: "jellystat-key"
Schaka commented 1 month ago

You didn't really answer any of my other questions. Based on your censoring the jellyfin host, I guess it's public? Try accessing it through the internal host.

I can't see anything obviously wrong, but there must be something wrong elsewhere with your setup. If you access your Jellyfin server, you get SOME form of HTML response and this can only happen if a reverse proxy incorrectly forwards data or you're accessing the wrong server altogether.

One reason could be that it doesn't forward the headers.

Schaka commented 1 month ago

Closing this, no response in over a week.