Skip to content

Configurable Caching Option#46

Draft
mcinj wants to merge 7 commits intobbrown430:mainfrom
mcinj:cache
Draft

Configurable Caching Option#46
mcinj wants to merge 7 commits intobbrown430:mainfrom
mcinj:cache

Conversation

@mcinj
Copy link
Contributor

@mcinj mcinj commented Dec 16, 2024

Adds the following optionable configuration parameters. With cache_enabled=false the script will function as it currently does. Setting it to true and providing a relative or absolute path in cache_folder will turn caching on.

"cache_enabled": true,
"cache_folder": "cache"

image

image

json for an episode title card:

{
    "url": "https://mediux.pro/_next/image?url=https%3A%2F%2Fapi.mediux.pro%2Fassets%2F64ba0b05-78ad-4866-b20c-0af80062a6b3&w=3840&q=80",
    "source": "mediux",
    "title": "3 Body Problem",
    "year": 2024,
    "season": 1,
    "episode": 1,
    "show_backdrop": false,
    "show_cover_art": false,
    "season_cover_art": false,
    "uploaded_to_plex": true,
    "uploaded_datetime": "2024-12-16T14:01:21.615516",
    "path": "cache/tv_shows/3 Body Problem (2024)/s1/s1e1.jpg",
    "metadata_path": "cache/tv_shows/3 Body Problem (2024)/s1/s1e1.json"
}

Current logic:

  1. For a given mediux or posterdb url we scrape the page as usual.
  2. Once we go to upload to plex we check if caching is enabled.
  3. If not then upload.
  4. If enabled, check the cache for the metadata json file for that item.
  5. If that doesn't exist then download into the cache, and upload to plex.
  6. If it exists then we check the json to see if we've already upload to plex. If not, then attempt to upload. If so, skip.

I have some cleanup to do and a check for if the json url (mediux or posterdb) has changed. This change significantly brings the runtime down.

Attempt to solve #38

@tonywied17
Copy link
Contributor

tonywied17 commented Jan 4, 2025

oh nice! looks really good ;] I like the use of that MediaMetadata class for sure. Cache should be a nice feature to have Ima have to give this a pull and try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants