#Working with Collections

1 messages · Page 1 of 1 (latest)

outer yacht
#

I have some questions regarding collection building. I am creating a collection of seasonal moves. I want to remove some movies that are being added and want to add some movies that are being left out. The ones left out may be local only and cant be found on imdb/tmdb.

fiery narwhalBOT
#

Welcome @outer yacht!

Someone from <@&938443185347244033> will assist when they're available.

Including meta.log from the beginning is a huge help. Type !logs for more information.

After attaching your log, do not forget to hit the green check boxes when prompted by our bot.

#

You can press the "Close Post" button above or type /close at any time to close this post.

outer yacht
#
collections:
    # -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
    # Seasonal
    # Summary: Seasonal and Holiday
    # -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
    Seasonal:
      imdb_list:
        - https://www.imdb.com/list/ls040154031/
      trakt_list: 
        - https://trakt.tv/users/del74/lists/christmas-movies
        - https://trakt.tv/users/pauls67/lists/christmas-movies
        - https://trakt.tv/users/johnthebarber/lists/christmas-movies
        - https://trakt.tv/users/cinhd/lists/christmas-movies
      filters:
        title.not:            
          - "Iron Man"
          - "Little Women (1994) {tmdb-9587}"
          - "The Changeling (1980) {tmdb-13550}"
          - "Harry Potter and the Philosopher's Stone (2001) {tmdb-671}"
          - "Willy Wonka & the Chocolate Factory (1971) {tmdb-252}"
          - "Richard Pryor - Here and Now (1983) {tmdb-21921}"
          - "Bridget Jones's Diary (2001) {tmdb-634}"
          - "Eyes Wide Shut (1999) {tmdb-345}"
          - "Iron Man (2008) {tmdb-1726}"
          - "Little Women (1994) {tmdb-9587}"
          - "The Changeling (1980) {tmdb-13550}"
          - "Harry Potter and the Philosopher's Stone (2001) {tmdb-671}"
          - "Willy Wonka & the Chocolate Factory (1971) {tmdb-252}"
          - "Richard Pryor - Here and Now (1983) {tmdb-21921}"
          - "Bridget Jones's Diary (2001) {tmdb-634}"
          - "Eyes Wide Shut (1999) {tmdb-345}"
      sort_title: "!000_Seasonal"
      collection_order: random
      sync_mode: sync
      summary: "Christmas and Seasonal Movies"
      schedule: range(11/01-01/09)
      visible_home: range(11/01-01/09)
      visible_shared: range(11/01-01/09)
      delete_not_scheduled: true 
#

Also.. at the bottom of the collection there's some additional section called "Movies in Seasonal Collection" that shouldn't be there. No idea how that got there, but the pink panther christmas movie should be included in the top.

devout heart
outer yacht
#

Is this the correct way to filter out movies I don't wnat in the list?

devout heart
outer yacht
#

correct. i am mixing tmm stuff with plex. i removed that.

devout heart
#

That seems like part of the file path.

#

In which case you could try

  filters:
    filepath.not:
      - "Little Women (1994) {tmdb-9587}"
devout heart
outer yacht
#

ok ill check out the builder

devout heart
#

the "builder" is something like "trakt_list" in your case.

#

If you created your own list that didn't include any of the movies you don't want, then there would be no filtering required, which will always be faster, and more precise.

#

Another option would be to give these "never-in-christmas-collections" movies a label and filter on that label. Then you can add movies to the exclusion list by adding a label.

outer yacht
#

ok i'll check that out. next question.. i have some movies that aren't in the imdb/tmdb i want to add to the list. can I just use another filter for these? i guess the builder approach would solve this too.

devout heart
#

If you want to add titles you could:

  1. create a list with just those titles, add that list to the collection
  2. use tmdb_movie or the like to add them
  3. merge all these lists plus your new titles and minus the ones above into one giant "dungeonmaster's christmas collection" list on IMDB or something and use that one list to drive the collection.

probably something else as well; there is no one true answer

outer yacht
#

ok will try it

brave sonnetBOT
#

antwanchild used !aenh

@outer yacht, anything else needed here? If not, please type /close and hit enter. Please respond within 24 hours of this message or it will be archived.

outer yacht
#

I think I got this working. However, my collection shows under collections, but I also want it to show in the Library as the first item before all of the movies on the dates specified. I don't see it there.

devout heart
#

You need to set the collection mode and sort title to put it there.

outer yacht
#

my sort titles are default sorts !000_Top250, and then I have them grouped by !001_Collection, !002_Collections, !003_Collection

devout heart
outer yacht
#

I have for my seasonal collection:

      sort_title: "!001_Seasonal"
      collection_order: title.asc
      collection_mode: show_items
#
  visible_library_top: range(11/01-01/09)
      visible_home: range(11/01-01/09)
      visible_shared: range(11/01-01/09)
devout heart
outer yacht
#
collections:
    # -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
    # Seasonal
    # Summary: Seasonal and Holiday
    # -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
    Seasonal:
      imdb_list:
        - https://www.imdb.com/list/ls040154031/
      trakt_list: 
        - https://trakt.tv/users/del74/lists/christmas-movies
        - https://trakt.tv/users/pauls67/lists/christmas-movies
        - https://trakt.tv/users/johnthebarber/lists/christmas-movies
        - https://trakt.tv/users/cinhd/lists/christmas-movies
      filters:
        title.not:            
          - "A Charlie Brown Valentine"
          - "Be My Valentine, Charlie Brown"
      plex_search:
        any:
          title:
            - "Gumby's Christmas Capers"
            - "Happy New Year, Charlie Brown"       
      sort_title: "!001_Seasonal"
      collection_order: title.asc
      collection_mode: show_items
      sync_mode: append
      summary: "Christmas and Seasonal Movies"
      schedule: range(11/01-01/09)
      visible_library_top: range(11/01-01/09)
      visible_home: range(11/01-01/09)
      visible_shared: range(11/01-01/09)
      delete_not_scheduled: true  
#

this is what I am using now..

devout heart
#

Will need to see a log of this happening.

outer yacht
#

i do see this in the log "| Collection Error: visible_library_top attribute not supported "

devout heart
outer yacht
#

I have no issues sending a log when necessary, but this was such a minor thing. I used visible_library: range(11/01-01/09) and it worked.

brave sonnetBOT
#

chazlarson used !aenh

@outer yacht, anything else needed here? If not, please type /close and hit enter. Please respond within 24 hours of this message or it will be archived.

outer yacht
#

Can a collection be deleted from the command line? I have just one I'd like to delete.

devout heart
#

What command line?

#

Collections are defined in the Plex database, so it's not clear what command line you would be using to delete one collection. It would be simplest to just click delete in the UI.

outer yacht
#

Gotcha. I had read somewhere (in a sample config i think) that deleting from the UI would retain some Kometa info and wasn't advised. Not sure.

#

--delete-collections was the cli argument i saw

#

Is there a way to show the collection in collections all the time, but only schedule visibility fro specific libraries?

devout heart
#

Those are two different things.

If you want to prevent Kometa from creating a collection, you need to remove whatever is creating that collection from the config or it will just keep coming back.

If you have done that, and want to clean up that one random collection from Plex, it's simplest to just delete it in the UI.

If you want to delete the collection to force Kometa to create it again, do it in the UI if it's a small number or use --delete-collections if you want to delete ALL the collections in each library before the run.

#

Is there a way to show the collection in collections all the time

All collections are always visible in the collections tab. They cannot be hidden from there.

outer yacht
#

Ok. I'll check that. I had a Halloween collection disappear, and I thought it might be because of the date range.

devout heart
#

It is; the default seasonal collections are all created and destroyed on a schedule. If you don't want that to happen, turn it off.

outer yacht
#

I'm not using the defaults. I have defined my own.

devout heart
#

In your collection above:

      schedule: range(11/01-01/09)
      visible_library_top: range(11/01-01/09)
      visible_home: range(11/01-01/09)
      visible_shared: range(11/01-01/09)
      delete_not_scheduled: true  

You are telling Kometa:

Process this collection only during this date range:

      schedule: range(11/01-01/09)

Make it visible in these places during these date ranges:

      visible_library: range(11/01-01/09)
      visible_home: range(11/01-01/09)
      visible_shared: range(11/01-01/09)

If we are outside the schedule: range(11/01-01/09), delete this collection:

      delete_not_scheduled: true  

So, on January 10, this "Seasonal" collection will get deleted from Plex, to reappear on November 1

I imagine your Halloween collection is similar and is doing as you have requested.

#

Without the definition or a log of it happening, that's my best guess.

devout heart
#

If a collection exists, you can schedule its visibility independently however you want, within it's parent library.

If a collection exists, it will be visible in the collection tab; you can't remove it from there or schedule it's visibility there.

If a collection does not exist, it will not be visible in the collections tab and you cannot control its visibility anywhere.

If a collection definition includes these two lines:

      schedule: SOME_SCHEDULE
      delete_not_scheduled: true  

Then Kometa will create/update it on every run during SOME_SCHEDULE and delete it [if it exists] on every run outside SOME_SCHEDULE

If you want it visible in the collections tab outside SOME_SCHEDULE, remove the second line.

If you want it to get created/updated outside SOME_SCHEDULE, remove both lines.

outer yacht
#

ok im testing..

#

got it. the schedule option was the culprit and is independent of the visibility settings.

#

the things we do for movie poster..

devout heart
#

Not sure what this has to do with posters, but it sounds like it was behaving as configured.

outer yacht
#

haha.. collections, posters, etc.. it's all just for display.. the reference being all the work we put into learning something just to show a movie poster in a specific place

#

i doubt.. but would be cool to be able to rotate the collection poster randomly between a few different ones.

devout heart
#

You could certainly set up a script to swap asset images around and Kometa would just pick them up.

outer yacht
#

of course.. but it would be easier if kometa did it.

devout heart
#

Except then the config would get more complicated while the script would be a single set-and-forget

outer yacht
#

I wouldn't call it convoluted, but it's already a bit to wrap your head around. a quick poster_random: t/f wouldn't hurt.

#

probly 1 line of code on the backend?

devout heart
#

random from where?

#

some directory? Some set of URLs? Some set of random file paths?

outer yacht
#
      file_poster: config/assets/Posters/Category/Christmas01.png
      #file_poster: config/assets/Posters/Category/Christmas01.webp
      #file_poster: config/assets/Posters/Category/Christmas01.webp
#

just pick random from the defined lines

devout heart
#

Kometa never sees those last two lines.

outer yacht
#

its an example.. lol

#
      file_poster: config/assets/Posters/Category/Christmas02.webp
      file_poster: config/assets/Posters/Category/Christmas03.webp
#

You must be the main architect of Kometa

devout heart
#

Right, and that's not valid YAML, so you need to do something like:

      file_poster: 
        - config/assets/Posters/Category/Christmas01.png
        - config/assets/Posters/Category/Christmas02.webp
        - config/assets/Posters/Category/Christmas03.webp

and there's now code to fall back to only the first in case random is turned off, and deal with what happens when the random pick doesn't work, or the URLs fail, or whatever else.

It's not a trivial add to make sure it works correctly.

devout heart
outer yacht
#

yeah it would take some work beyond a quick stab at the codebase.. but I don't see it being too complex.. maybe an hour or two. in any case.. just an idea!

devout heart
#

Store your alternates in the asset directory as:

assets:
  Whatever_Collection: 
    poster-01.png
    poster-02.webp
    poster-03.jpg
    poster-04.jpeg
    ...

Then run this script from the config directory whenever you want to randomize the posters:

import os
import random
import shutil

def set_random_poster(directory_path="config/assets"):
    TARGET_EXTENSIONS = ('.png', '.jpg', '.jpeg', '.webp')
    BASE_FILENAME = "poster" # The new base name for the random file

    for root, dirs, files in os.walk(directory_path):
        
        poster_files = []
        for f in files:
            if f.lower().startswith("poster-"):
                _, ext = os.path.splitext(f.lower())
                
                if ext in TARGET_EXTENSIONS:
                    poster_files.append(f)
        
        if poster_files:
            source_path = os.path.join(root, random.choice(poster_files))
            
            _, source_ext = os.path.splitext(source_filename)
            
            destination_path = os.path.join(root, f"{BASE_FILENAME}{source_ext}")
            
            try:
                shutil.copy2(source_path, destination_path)
                print(f"Copied **{source_filename}** to **{destination_filename}** in {root}")
            except Exception as e:
                print(f"An error occurred while copying in {root}: {e}")
                
        if root == directory_path:
            dirs[:] = [d for d in dirs]
        else:
            dirs[:] = []
            
if __name__ == "__main__":
    set_random_poster()
outer yacht
#

That looks like AI code

#

did you test it?

#
      visible_library: range(10/01-11/01)
      visible_home: range(10/01-11/01)
      visible_shared: range(10/01-11/01)

this one is still showing in the library

devout heart
# outer yacht did you test it?

Reviewed it, it looked fine, didn't go much beyond that. Offered with no warranty; it's probably worth what you're paying for it. 😉

devout heart
outer yacht
#

ill check the logs.. waiting on it to finish

#

i thought it might be a library thing'

devout heart
#

I'm able to reproduce it; apparently some logic error. Perhaps open a github issue with a log and details.

dusty viper
outer yacht
#

I do have plex pass

devout heart
#

I also have plex pass and have seen issues with changing visibility on existing collections for a long time. I don't do any of it though so haven't put a great amount of time into it.

outer yacht
#

So I'll need to delete the collection and run the collection to get it back in collections but not in library?

devout heart
#

Perhaps.

outer yacht
#

It just reappeared in both collections and the library. I commented out

      #visible_library: range(10/01-11/01)
      #visible_home: range(10/01-11/01)
      #visible_shared: range(10/01-11/01)
#

and it made no difference. still reappeared

dusty viper
#

Ok. No worries. Just checking

dusty viper
#

So would be good to open a GitHub issue

outer yacht
#

ok, let me fix that and try again.

devout heart
outer yacht
#

If I reference the same collection.yml from two different libraries, can I have specific collections show per library? Or do I need to create a custom yml for each library?

dusty viper
#

If you want different collections to behave differently per library, then setup separate collections files and call the applicable yml file for the specific library

outer yacht
#

ok will do.

#

i want the collections to be the same, just want the visibility and ordering tweaked per library

devout heart
outer yacht
#

Is there any validity to this I see in an example config?

    operations:      
      delete_collections:      ##### IF YOUR COLLECTIONS SHOW DUPLICATES OR RUN THIS ONCE AND THEN DISABLE FOR A FRESH COLLECTION START.
        configured: false      ##### DO NOT MANUALLY DELETE COLLECTIONS BECAUSE THE "TAGS" Kometa ASSIGNS WILL STILL BE ATTACHED TO SHOWS
        managed: true
devout heart
outer yacht
#

"##### DO NOT MANUALLY DELETE COLLECTIONS BECAUSE THE "TAGS" Kometa ASSIGNS WILL STILL BE ATTACHED TO SHOWS"

#

this..

devout heart
#

And I would have known you were referring to that limited portion of that text how?

Depending on the type of collection, sure, that could happen.

If you create a standard manual collection, the collection is defined by tags on items, and deleting the collection clears the tag, so in that case the claim is not true.

Some smart collections [smart label collections sepcifically] are defined by adding tags and then creating a filter that looks for those tags. In that case, deleting the collection doesn't touch the tag since they are not directly connected.

outer yacht
#

I've run into some situations where some libraries obey the settings, and some do not. At this point, I don't know if it's a bug or I'm doing something wrong.

#

Judging from the earlier discourse, and what I'm experiencing, I'm guessing there's some bugs with collection visibility in libraries.

devout heart
#

Perhaps.

dusty viper
#

I’ll throw this in, we still have not seen any log file. So theoretically this is just a guessing game

outer yacht
#

@devout heart said he reproduced the bug in a test environment. Can we see that log?

devout heart
#

The log doesn't contain anything; it just notes no metadata updates required and doesn't touch the collection.

#

I haven't run it in trace mode or anything or put a debugger on it since I have no particular personal interest in chasing it down.

#

Also, plenty of other things to occupy my time.

dusty viper
outer yacht
#

I'm as confused as you. lol.. The "some do not" comment was a direct reference to the visibility bug. I'll send a log, but which does it need to be? I've been testing with so many different approaches.. just a library update? operation update? full update? I don't even know if those produce different log output. Which command output specifically do you need to see for the log?

#

Also.. does this project have any complete example configs to reference? I've been looking at other examples out there and I think things have changed since they were created. I only recall Kometa's (excellent) documentation showing fragments of settings rather than a big picture.

#

And yes, I titled this "working with collections" because I knew I'd have a myriad of different questions. Sorry if those are getting jammed together.

devout heart
devout heart
# outer yacht I'm as confused as you. lol.. The "some do not" comment was a direct reference t...

The log is generally the same regardless of the type of run. It reports any runtime flags, contains a redacted copy of the config, and reports all actions taken by Kometa and the result as the run progresses.

Of course, if you are asking about collections, the log will need to be from a run that processed collections, etc.

We ask for a log because it contains all that information and makes troubleshooting simpler since we can review the error summary or look at individual errors in context. It allows reviewing config details in one place. When you upload a log, there are automated log analysis tools that will find common issues.

outer yacht
#

In an effort to test the "visible_library: range(10/01-11/01)" issue, I ran it with varying parameters enabled/disabled. Do you need to see each one of the logs for when they were enabled or disabled?

#

The intended function as I understand it is that the collection would be hidden from the library view outside of that date range, but that's not happening. Adding collection_mode: hide removed from both views which is not desired. I want to see it in the collections always, but only in the library if designated directly or by date range.

#

visible_library: false did not seem to affect it either

#

so that's three distinct changes in the collection parameters, each producing a different log I'd imagine.

#

im working on producing the logs for each run. for each test, i run operations with delete_collections to clear then rebuild using -co -rl 'library'

devout heart
#

I suspect the log won't contain much since in my case they're the same with or without the visibility settings.

You might try a run with --trace --log-requests to see if that produces anything more.

outer yacht
fiery narwhalBOT
#

📝 If you want to review this again, darkstarx1:
:one: Right-click (or long press with phone) on the message that contains the log
:two: Select: Copy Message Link
:three: Use the command: /logscan <message_link> or !logscan <message_link> and paste the value copied from the previous step where you see <message_link> 📝

#
**User Info**

Author of Linked Message: DungeonMaster
Person who Invoked the Command: DungeonMaster
File Name: meta.log

Table of Contents:
Page 01: User Info
Page 02: Kometa Info
Page 03: Kometa Summary Info
Page 04: Kometa Config.yml YAML Validation
Page 05: Plex Configuration - Section 1
Page 06: Rec 01 - ❌ [ERROR]
Page 07: Rec 02 - ❌⏰ KOMETA SCHEDULED TIME CONFLICT
Page 08: Rec 03 - ⚠️ [WARNING]
Page 09: Rec 04 - 💬 CONVERT WARNING

devout heart
#

Yeah, the log doesn't contain anything useful WRT this visibility thing.

It could be that --log-requests would show Kometa asking Plex to set the visibility, which may confirm or deny whether Kometa is trying to do what is requested and Plex is not doing it.

#

Even that doesn't show anything useful.

collections:
  Top Movies of The Week:
    mdblist_list: https://mdblist.com/lists/linaspurinis/top-watched-movies-of-the-week
    sort_title: "!!"
    collection_order: custom
    sync_mode: sync
    visible_library: range(10/01-11/01)
    visible_home: range(10/01-11/01)
    visible_shared: range(10/01-11/01)
|====================== Updating Metadata of Top Movies of The Week Collection ======================|
|                                                                                                    |
| http://192.168.1.11:32400 "GET /library/collections/62529 HTTP/1.1" 200 562                        |
| Collection Metadata Edits                                                                          |
| http://192.168.1.11:32400 "GET /hubs/sections/1/manage?metadataItemId=62529 HTTP/1.1" 200 90       |
| http://192.168.1.11:32400 "GET /library/collections/62529/children HTTP/1.1" 200 12365             |
#

Probably needs to be run in a debugger.

outer yacht
#

It's an annoying bug for sure.

dusty viper
outer yacht
#

thanks. i copied that from an example and never noticed

dusty viper
brave sonnetBOT
#

antwanchild used !aenh

@outer yacht, anything else needed here? If not, please type /close and hit enter. Please respond within 24 hours of this message or it will be archived.

outer yacht
dusty viper
#

Right. Just saying sometimes people see things that maybe you didn’t.
However, that would been caught by using vscode with the recommended extensions

outer yacht
#

I'll look into the vscode setup for this, but hopefully i'm out of the woods on most of these issues.

devout heart