CollinHeist / TitleCardMaker

Automated title card maker for Plex, Jellyfin, and Emby
https://titlecardmaker.com/
GNU General Public License v3.0
466 stars 22 forks source link

Use Docker but the files on another system #292

Closed patan32 closed 1 year ago

patan32 commented 1 year ago

Hello,

Thanks for making this software available to us. I wanted to know if this Docker system of Titlecardmaker is possible if my Sonarr is running on another system and plex is on another system. My data is one another PC so the mounts can't be possible. I do run Sonarr in Docker.

Can this software work if the data and apps are on another server? I couldn't find anything online or in the Wiki that mentions this. I am currently running Plex Meta Manager and it works great since my system is not on the same server. Can this do the same?

Another question i have is does imagemagick use lot of CPU or resources?

CollinHeist commented 1 year ago

Hey!

Can this software work if the data and apps are on another server?

Yes. The cards do not need to be stored alongside the media, nor does TCM need to be run on the same machine as Sonarr or Plex. You'll just want to set the URL and API keys/tokens correctly, and then TCM will load the cards into Plex through the Plex API. Let me know if you need help getting all of that set up.

Another question i have is does imagemagick use lot of CPU or resources?

Not really. Your first run where you might create and load a few thousands cards might take a while, but on my i5 it uses like 30% of my CPU at most.

patan32 commented 1 year ago

This is my config i am starting with:

I am not sure what the paths should point to? Should i just remove the paths totally? Can you please help me get this working.

options: source: ./source/ series:

plex: url: http://xxxx:32400 # Your local plex IP address token: xxxx # Your Plex token verify_ssl: true watched_style: unique unwatched_style: blur integrate_with_pmm_overlays: true filesize_limit: 4 MB sync: file: ./yaml/plex_sync.yml mode: append compact_mode: true libraries:

sonarr: url: http://10.10.40.18:8989/api/v3/ # Your Sonarr IP address api_key: 97d9e173f6344e3084af090300df77ae # Your Sonarr API key verify_ssl: false sync: file: ./yaml/sonarr_sync.yml mode: append compact_mode: true monitored_only: true required_tags:

tmdb: api_key: xx # Your TMDb API key here retry_count: 5 minimum_resolution: 600x300 skip_localized_images: false

CollinHeist commented 1 year ago

@patan32 so there are a few things going on here. For starters under series in options you want to list the actual sync files themselves, or else TCM will write to them and never read them. This is noted here.

Next, you're listing a lot of options you don't need to list (as they're just the default values).

And finally, you probably don't want to sync to both Plex and Sonarr, and both are almost certainly not set up as my examples list. You will want to change the volumes, libraries, and tags to match what you have in your specific server.

All in all, your preference file should actually look like this:

options:
  source: ./source/
  series:
  - ./yaml/plex_sync.yml
  - ./yaml/sonarr_sync.yml
  sync_specials: false

plex:
  url: http://xxxx:32400/ # Your local plex IP address
  token: xxxx # Your Plex token
  unwatched_style: blur
  integrate_with_pmm_overlays: true
  filesize_limit: 4 MB
  sync:
    file: ./yaml/plex_sync.yml
    libraries:
    - Local TV Shows    # CHANGE OR REMOVE THIS
    volumes: # CHANGE THIS
    /plex/media/: /maker/media/

sonarr:
  url: http://10.10.40.18:8989/api/v3/ # Your Sonarr IP address
  api_key: 97d9e173f6344e3084af090300df77ae # Your Sonarr API key
  verify_ssl: false
  sync:
    file: ./yaml/sonarr_sync.yml
    monitored_only: true
    required_tags: # CHANGE THIS
    - ongoing
    volumes: # CHANGE THIS
      /sonarr/media/tv: /maker/media/tv
    plex_libraries: # CHANGE THIS
      /maker/media/tv: TV

tmdb:
  api_key: xx # Your TMDb API key here
  minimum_resolution: 600x300
patan32 commented 1 year ago

@CollinHeist

plex:
  url: http://xxxx:32400/ # Your local plex IP address
  token: xxxx # Your Plex token
  unwatched_style: blur
  integrate_with_pmm_overlays: true
  filesize_limit: 4 MB
  sync:
    file: ./yaml/plex_sync.yml
    libraries:
    - Local TV Shows    # CHANGE OR REMOVE THIS
    volumes: # CHANGE THIS
    /plex/media/: /maker/media/

sonarr:
  url: http://10.10.40.18:8989/api/v3/ # Your Sonarr IP address
  api_key: 97d9e173f6344e3084af090300df77ae # Your Sonarr API key
  verify_ssl: false
  sync:
    file: ./yaml/sonarr_sync.yml
    monitored_only: true
    required_tags: # CHANGE THIS
    - ongoing
    volumes: # CHANGE THIS
      /sonarr/media/tv: /maker/media/tv
    plex_libraries: # CHANGE THIS
      /maker/media/tv: TV

Why am i changing this? I have this library in my plex libraries:

This is the part i don't understand. My media is mounted as /mnt/Media/Plex_Upload/ and inside the container it's /mnt/Local TV Shows/. What do i need to put the volume as? Sorry for the bold letters. I am not trying to shout at you.

volumes: # CHANGE THIS
/plex/media/: /maker/media/

Do you want me to remove Sonarr from the config and use the Plex option only? I shouldn't be using Plex and Sonarr together? The problem is i have multiple Sonarr servers that do different libraries and i don't have one source of truth. Can i specify multiple Sonarr instances in the config file?

CollinHeist commented 1 year ago

@patan32

Why am i changing this? I have this library in my plex

Sorry, I thought that was from one of my examples. If that's the only TV library in your server that you want to sync from then that's fine to leave as-is.

My media is mounted as /mnt/Media/Plex_Upload/ and inside the container it's /mnt/Local TV Shows/. What do i need to put the volume as?

So think of the volumes specification as a folder "replacement" option. If you're syncing from Sonarr (but it's the same as if you were to sync from Plex), and Sonarr reports your media paths as /mnt/Local TV Shows/, then you have a few options:

  1. Don't specify any volumes (i.e. delete the option entirely) - this will have TCM create cards also at /mnt/Local TV Shows/, which you'll then want to mount into the container
  2. Specify a volumes replacement for some card directory within TCM - i.e.
    volumes:
     /mnt/Local TV Shows/: /config/cards/Local TV Shows/

    This will effectively have TCM convert all paths from Sonarr that are like /mnt/Local TV Shows/.../ into /config/cards/Local TV Shows/...

  3. Specify a volumes replacement that corresponds to the actual path of the media on your host OS - for example:
    volumes:
     /mnt/Local TV Shows/: /mnt/Media/Plex_Upload/

    Then just mount /mnt/Media/Plex_Upload/ into the container and TCM will convert the Sonarr paths into "true" paths.

Do you want me to remove Sonarr from the config and use the Plex option only? I shouldn't be using Plex and Sonarr together?

So you can sync from both Sonarr and Plex, it's just kind of redundant. The sync feature just allows you to get an automated list of what series TCM should create cards for. Syncing from Sonarr is faster (the API is faster), and more customizable (you can use tags to filter the sync and then assign different templates); but syncing from Plex is fine too. This is up to you. In general, my recommendation is for people to sync from Sonarr just because of the versatility and speed.

The problem is i have multiple Sonarr servers that do different libraries and i don't have one source of truth. Can i specify multiple Sonarr instances in the config file?

Yes, you can specify multiple Sonarr servers in your preferences file (this was just added recently). This is briefly described here, but let me know if you want help getting that set up.

patan32 commented 1 year ago

@CollinHeist I got it to work with this setting. I didn't need to specify the volume or paths. I didn't do this also -v "MEDIA_DIRECTORY":"/Media" \ in the docker.

options:
  source: /config/source/
  series:
  - /config/yaml/plex_sync.yml
  - /config/yaml/sonarr_sync.yml
  #episode_data_source: sonarr
  #image_source_priority: tmdb, plex
  card_type: Wdvh/WhiteTextStandard
  sync_specials: true

plex:
  url: http://10.10.10.26:32400         # Your local plex IP address
  token:           # Your Plex token
  watched_style: unique
  unwatched_style: unique
  integrate_with_pmm_overlays: false
  filesize_limit: 4 MB
  sync:
    file: /config/yaml/plex_sync.yml
    libraries:
    - Local TV Shows 

sonarr:
  url: # Your Sonarr IP address
  api_key:  # Your Sonarr API key
  verify_ssl: false
  sync:
    file: /config/yaml/sonarr_sync.yml
    monitored_only: true 

tmdb:
  api_key:         # Your TMDb API key here
  retry_count: 5
  minimum_resolution: 600x300
  skip_localized_images: false

I want to use azuravian/TitleColorMatch card but it keeps saying error on the logo part. How do i configure this logo type.

I saw this in the Wiki:

series:
  Peacemaker:
    year: 2022
    extras:
      logo: ./source/Peacemaker (2022)/logo.png
mytemplate:
  font:
    color: 'auto'

I don't know where i need to specify this and i don't want to manually do the logo for each series. Is there a better way to do this? I have some idea how this works but how do i implement this in the sonarr.yml file when it's automatically populated. I could have a wrong understanding and i am not very code focused mindset.

Can you please give me a config layout so i better understand it.

CollinHeist commented 1 year ago

So you need to specify a logo path that exists, and the example on the GitHub shows the typical setup for non-Docker users. You'll want to do logo: /config/source/Peacemaker (2022)/logo.png.

And defining a template called font might not be recommended as well, I'd put all of that into a template for the azuravian card type, like so:

templates:
  azuravian:
    card_type: azuravian/TitleColorMatch
    font:
      color: auto
    extras:
      logo: /config/source/<<title>> (<<year>>)/logo.png

series:
  Peacemaker (2022):
    template: azuravian

This will use the auto font color, use the logo file for that series, and the correct card type.

patan32 commented 1 year ago

I need to add in my preferences.yml like so?

options:
  source: /config/source/
  series:
  - /config/yaml/plex_sync.yml
  - /config/yaml/sonarr_sync.yml
  #episode_data_source: sonarr
  #image_source_priority: tmdb, plex
  card_type: azuravian/TitleColorMatch
  sync_specials: true

templates:
  azuravian:
    card_type: azuravian/TitleColorMatch
    font:
      color: auto
    extras:
      logo: /config/source/<<title>> (<<year>>)/logo.png

Where do i put this?

series:
  Peacemaker (2022):
    template: azuravian

I want to do this for all my series under sync mode and not just one. I don't want to define all my series manually either. I can't put it in this config file since it will make it invalid (sonarr.yml). I also have a plex_sync.yml file also.

libraries: {}
series:
  Reacher (2022): {media_directory: /tv/Reacher}
  White Collar (2009): {media_directory: /tv/White Collar}
CollinHeist commented 1 year ago

I need to add in my preferences.yml like so? [...]

No, what I typed above goes into your sync file (called a series YAML file).

I want to do this for all my series under sync mode and not just one. I don't want to define all my series manually either.

If you want every series to use that exact template, add this to the top of your sync file (sonarr_sync and/or plex_sync):

templates:
  azuravian:
    card_type: azuravian/TitleColorMatch
    font:
      color: auto
    extras:
      logo: /config/source/<<title>> (<<year>>)/logo.png

And then add add_template: azuravian to your sync specification in . It should look like this (for Sonarr):

sonarr:
  # URL and API key
  sync:
    file: /config/yaml/sonarr_sync.yml
    monitored_only: true
    add_template: azuravian

Where do i put this? [...]

That is an example of what is in your series YAML file - what you have as sonarr_sync.yml and plex_sync.yml.

libraries: {} series: Reacher (2022): {media_directory: /tv/Reacher} White Collar (2009): {media_directory: /tv/White Collar}

So this means your sync isn't set up to correctly detect your libraries, and TCM will never load the cards into Plex (automatically, it might if your filenames match). You should add the plex_libraries option. If you just have the one TV library this will look like:

sonarr:
  # URL and API key
  sync:
    file: /config/yaml/sonarr_sync.yml
    monitored_only: true
    add_template: azuravian
    plex_libraries:
      /tv/: TV # CHANGE THIS TO YOUR LIBRARY NAME

And anytime you make any changes to your sync specification, you will want to delete the file and re-sync so those changes are pulled in. This is where entering the container and doing --sync is very convenient so you don't have to start/stop the container.

patan32 commented 1 year ago

I am not sure what you updated but the docker is broken now. I am getting this error now when i run the docker. I also see the docker container is little smaller in size.

image

CollinHeist commented 1 year ago

It's possible you got a bad docker image, or this is related to a possible bug of putting a remote card type as your global default card type. Either way, I'd try grabbing the latest image (docker pull collinheist/titlecardmaker:master) in about 5 minutes, and re-running. Let me know if it still persists.

patan32 commented 1 year ago

I just pulled a new image and seems like you updated it on docker hub. I am getting a different error now.

image

CollinHeist commented 1 year ago

@patan32 that should also be fixed now, let's pull and try again haha

patan32 commented 1 year ago

It's working now. You fixed the docker image. I ran the new config you gave me and it's working and i see the color in the titles.

image image

This is my preferences.yml

options:
  source: /config/source/
  series:
  - /config/yaml/plex_sync.yml
  - /config/yaml/sonarr_sync.yml
  #episode_data_source: sonarr
  #image_source_priority: tmdb, plex
  #card_type: azuravian/TitleColorMatch
  sync_specials: true

plex:
  url: http://10.10.10.26:32400         # Your local plex IP address
  token:          # Your Plex token
  watched_style: unique
  unwatched_style: unique
  integrate_with_pmm_overlays: false
  filesize_limit: 4 MB
  sync:
    file: /config/yaml/plex_sync.yml
    libraries:
    - Local TV Shows
    plex_libraries:
      /Local_tv/: Local TV Shows 

sonarr:
  url: http://10.10.10.26:8989/api/v3/ # Your Sonarr IP address
  api_key: 35146f24480441178ed0f644f39e6b9b # Your Sonarr API key
  verify_ssl: false
  sync:
    file: /config/yaml/sonarr_sync.yml
    monitored_only: true 
    add_template: azuravian
    plex_libraries:
      /tv/: Local TV Shows # CHANGE THIS TO YOUR LIBRARY NAME

sonarr.yml:

templates:
  azuravian:
    card_type: azuravian/TitleColorMatch
    font:
      color: auto
    extras:
      logo: /config/source/<<title>> (<<year>>)/logo.png
libraries:
  Local TV Shows:
    path: /tv
series:
  Reacher (2022): {library: Local TV Shows, template: azuravian, media_directory: /tv/Reacher}
  White Collar (2009): {library: Local TV Shows, template: azuravian, media_directory: /tv/White
      Collar}

plex yml

templates:
  azuravian:
    card_type: azuravian/TitleColorMatch
    font:
      color: auto
    extras:
      logo: /config/source/<<title>> (<<year>>)/logo.png
libraries:
  Local TV Shows:
    path: /local_tv
series:
  Reacher (2022): {library: Local TV Shows, media_directory: /local_tv/Reacher}
  White Collar (2009): {library: Local TV Shows, media_directory: /local_tv/White
      Collar}

I still see the : {library} part in the .yml file. Does this mean it's still not reading the paths properly? Once i get this working i can write a documentation because this is not well documented and it's hard to follow through. I am sure other people will find the issue i am in.

/local_tv is the mounted path in my plex container which links to TV Shows. Local TV Show is plex library name in the GUI.

CollinHeist commented 1 year ago

So you want to see the library option, that means that series will link with Plex. And in your case since your folders don't have the year, then it will also use list media_directory for each show. That file is almost exactly what I expect, except I would think you'd have template: azuravian for each series.

Finally, you don't need both Plex and Sonarr sync YAML's, especially with the same shows. That will just double how long it takes TCM to run each time (and also make is to you have a lot more to maintain)

patan32 commented 1 year ago

I didn't quiet get this part:

So you want to see the library option, that means that series will link with Plex. And in your case since your folders don't have the year, then it will also use list media_directory for each show. That file is almost exactly what I expect, except I would think you'd have template: azuravian for each series.

I do have folders with year. Are you talking about how Sonarr renames and creates folder when a show is downloaded?

So you want to see the library option, that means that series will link with Plex What is the difference with library option?

I would think you'd have template: azuravian for each series.

I thought i added the template in the yml file. Where else can i add this? I will disable plex. Is there a better way to only create shows that are on the disk or in plex. I might not have all the files in sonarr downloaded but i see it goes through all season and files and applies to what it needs to apply to at the end. I hope this makes sense.

Another question is can i centre the text in the azuravian card. I changed the fonts using the template and it worked but i couldn't find a setting to overide left text to centre. I was looking at Placement attribute but it only does top or bottom.

image

CollinHeist commented 1 year ago

I do have folders with year. Are you talking about how Sonarr renames and creates folder when a show is downloaded?

So I am not sure how you have your media folders created, but in the examples you included for Reacher and White Collar, the paths reported by Sonarr and Plex appear to not have the year in them - i.e. /tv/Reacher/ instead of /tv/Reacher (2022)/. This isn't a problem, I was just saying that's why TCM includes the media_directory: ... part - because the default folder name for TCM includes the year.

What is the difference with library option?

Not sure what you mean, but basically whenever a show has library: (SOME NAME) that tells TCM to load those cards into that series within that library in Plex. So for your examples, TCM will load the cards of Reacher and White Collar into the Local TV Shows library of your Plex Server.

I thought i added the template in the yml file. Where else can i add this?

So you added the template to the file itself, which is the first part. The last part is telling TCM to assign that template to each series it syncs. That is the add_template: azuravian part I mentioned earlier. This is required because a single file can have any number of templates, and you just need to tell TCM what shows use what templates. These are described in pretty good detail here.

Is there a better way to only create shows that are on the disk or in plex. I might not have all the files in sonarr downloaded but i see it goes through all season and files and applies to what it needs to apply to at the end.

Yes there is. So I'd still just sync from Sonarr (like you said), but go ahead and change your episode data source to plex - e.g. episode_data_source: plex. This can be done in a template, library, or globally. This tells TCM to get episode data only from Plex, which will only make cards for episodes you have in your server (as opposed to everything on Sonarr).

Another question is can i centre the text in the azuravian card. I changed the fonts using the template and it worked but i couldn't find a setting to overide left text to centre. I was looking at Placement attribute but it only does top or bottom.

So that is a user-made card type, not one of mine. I don't think that user (azuravian or Beedman) have added the ability to move the text. You could reach out to them on the Discord and they might add that, but I won't be changing their work. All of the card types I made and maintain are here. I could probably make you a version of that card that let's you adjust the text placement, but that might take me some time. Or you can make your own card type (although this is fairly technically difficult).

patan32 commented 1 year ago

My media layout is like this and this Sonarr default renaming scheme. image

I added the library bit because you asked me to add this under Sonarr. This creates another library attribute under the sonarr_sync.yml file. I added the add_template bit under sonarr section. Is this bit wrong or do i need add it somewhere else?

sonarr:
  url: http://10.10.10.26:8989/api/v3/ # Your Sonarr IP address
  api_key: 35146f24480441178ed0f644f39e6b9b # Your Sonarr API key
  verify_ssl: false
  sync:
    file: /config/yaml/sonarr_sync.yml
    monitored_only: true 
    add_template: azuravian
    plex_libraries:
      /tv/: Local TV Shows # CHANGE THIS TO YOUR LIBRARY NAME

Sorry i am asking all this questions. I want to better understand how all this works. I am just testing this on one test library but i have multiple libraries and sonarr servers that i need to configure.

If you can make a card type with those settings that would be great. I am not on discord but i will try join.

This my current config:

options:
  source: /config/source/
  series:
  - /config/yaml/sonarr_sync.yml
  episode_data_source: plex
  #image_source_priority: tmdb, plex
  #card_type: azuravian/TitleColorMatch
  sync_specials: true

plex:
  url: http://10.10.10.26:32400         # Your local plex IP address
  token:           # Your Plex token
  watched_style: unique
  unwatched_style: unique
  integrate_with_pmm_overlays: false
  filesize_limit: 4 MB

sonarr:
  url: http://10.10.10.26:8989/api/v3/ # Your Sonarr IP address
  api_key: 35146f24480441178ed0f644f39e6b9b # Your Sonarr API key
  verify_ssl: false
  sync:
    file: /config/yaml/sonarr_sync.yml
    monitored_only: true 
    add_template: azuravian
    plex_libraries:
      /tv/: Local TV Shows # CHANGE THIS TO YOUR LIBRARY NAME

tmdb:
  api_key:         # Your TMDb API key here
  retry_count: 5
  minimum_resolution: 600x300
  skip_localized_images: false
templates:
  azuravian:
    card_type: azuravian/TitleColorMatch
    font:
      color: auto
      file: /config/fonts/MR ROBOT.ttf
    extras:
      logo: /config/source/<<title>> (<<year>>)/logo.png
libraries:
  Local TV Shows:
    path: /tv
series:
  Reacher (2022): {library: Local TV Shows, template: azuravian, media_directory: /tv/Reacher}
  White Collar (2009): {library: Local TV Shows, template: azuravian, media_directory: /tv/White
      Collar}

Let me know if you want me to change anything or improve on.

CollinHeist commented 1 year ago

I added the library bit because you asked me to add this under Sonarr. This creates another library attribute under the sonarr_sync.yml file. I added the add_template bit under sonarr section. Is this bit wrong or do i need add it somewhere else?

Yeah all of this looks good.

Sorry i am asking all this questions. I want to better understand how all this works. I am just testing this on one test library but i have multiple libraries and sonarr servers that i need to configure.

It's no problem! New libraries can be added under the plex_libraries setting of the sync, and adding servers is done as described here.

This my current config: [...]

Only thing I'd recommend is to delete the plex sync (since you are not using it).

Let me know if you want me to change anything or improve on.

There are some minor improvements you can make, especially removing options where you specify the default value.

options:
  source: /config/source/
  series:
  - /config/yaml/sonarr_sync.yml
  episode_data_source: plex
  #card_type: azuravian/TitleColorMatch

plex:
  url: http://10.10.10.26:32400
  token:           # Your Plex token
  filesize_limit: 4 MB

sonarr:
  url: http://10.10.10.26:8989/api/v3/
  api_key: 35146f24480441178ed0f644f39e6b9b
  verify_ssl: false
  sync:
    file: /config/yaml/sonarr_sync.yml
    monitored_only: true 
    add_template: azuravian
    plex_libraries:
      /tv/: Local TV Shows # CHANGE THIS TO YOUR LIBRARY NAME

tmdb:
  api_key:         # Your TMDb API key here
  retry_count: 5
  minimum_resolution: 600x300
  skip_localized_images: false
patan32 commented 1 year ago

Thanks very much. I have another question:

If the logo doesn't exists in TMDB can it generate it on the fly and add it? There are few shows in TMDB that doesn't have logo and the script will fail. I don't want to sit and create them manually.

CollinHeist commented 1 year ago

Currently TCM cannot create logos for you - it has no way to know the style/layout/color of the logo (it'd just be the title of the show). You can try a different card type for the series (one that doesn't require a logo) or try a different source like TVDb or fanart.tv to get the logo.

patan32 commented 1 year ago

How do i use different source in the config file for example for TVDB?

CollinHeist commented 1 year ago

Sorry, that might have been confusing. For TVDb/fanart.tv you have you'll have to just go to the website and grab the logo manually. TCM can only search TMDb for logos automatically

patan32 commented 1 year ago

Would be nice if this can be automated. Thanks. Merry Christmas and Happy New Year.

CollinHeist commented 1 year ago

Sadly that’s not possible. TVDb’s API is paid, and fanart.tv has no suitable API. Thank you - you too!

patan32 commented 1 year ago

I will just use card that doesn't have a logo feature.