#How to limit the size of a custom collection?

1 messages · Page 1 of 1 (latest)

sterile slate
#

I've created a collection for all of my movies that are both 4k and contain Dolby Atmos + DTS audio as below:

collections:
  4K Dolby Atmos Movies:
    collection_order: release.desc
    plex_search:
      all:
        resolution: 4k
    sync_mode: sync
    filters:
      - filepath.regex: '(?i)^(?=.*\btrue[ ._-]?hd(\b|\d))(?=.*\batmos(\b|\d))'
      - filepath.regex: '(?i)^(?=.*\b(dd[p+])|(dolby digital plus)\b)(?=.*\batmos(\b|\d))'
      - filepath.regex: '(?i)\batmos(\b|\d)'
      - filepath.regex: '(?i)\bdts[ ._-]?x\b'

This create a collection of 700+ movies that takes a very long time to order by release date and locks up the plex database while it's doing so.

I'd like to limit this collection to the latest 100 movies by release date, so only the most recent 100 movies are in the collection. How can I do this?

Shown below, I've tried adding limit: 100 but that didn't produce the desired result - only 100 movies were processed, but the resulting collection did not contain the most recent 100 movies, just 100 movies overall.

collections:
  4K Dolby Atmos Movies:
    collection_order: release.desc
    plex_search:
      all:
        resolution: 4k
    sync_mode: sync
    limit: 100
    filters:
      - filepath.regex: '(?i)^(?=.*\btrue[ ._-]?hd(\b|\d))(?=.*\batmos(\b|\d))'
      - filepath.regex: '(?i)^(?=.*\b(dd[p+])|(dolby digital plus)\b)(?=.*\batmos(\b|\d))'
      - filepath.regex: '(?i)\batmos(\b|\d)'
      - filepath.regex: '(?i)\bdts[ ._-]?x\b'
feral terraceBOT
#

Welcome @sterile slate!

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.

sterile slate
feral terraceBOT
#

📝 If you want to review this again, msalad:
: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: msalad
Person who Invoked the Command: msalad
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: Plex Configuration - Section 2
Page 07: Plex Configuration - Section 3
Page 08: Rec 01 - ❌ ANIDB AUTH ERRORS
Page 09: Rec 02 - ❌🔒 BLANK API KEY ERROR
Page 10: Rec 03 - ❌ [ERROR]
Page 11: Rec 04 - ❌ MY ANIME LIST CONNECTION ERROR
Page 12: Rec 05 - ❌ TRAKT CONNECTION ERROR
Page 13: Rec 06 - ⚠️ [WARNING]

sterile slate
#

How to limit the size of a custom collection?

marble dagger
#

You'd need to set the order of the plex search such that the first 100 are the ones you want.

sterile slate
# marble dagger You'd need to set the order of the plex search such that the first 100 are the o...

Oh I see. Something like this then?

collections:
  4K Dolby Atmos Movies:
    plex_search:
      all:
        resolution: 4k
      sort_by:
        - release.desc
      limit: 100
    sync_mode: sync
    filters:
      - filepath.regex: '(?i)^(?=.*\btrue[ ._-]?hd(\b|\d))(?=.*\batmos(\b|\d))'
      - filepath.regex: '(?i)^(?=.*\b(dd[p+])|(dolby digital plus)\b)(?=.*\batmos(\b|\d))'
      - filepath.regex: '(?i)\batmos(\b|\d)'
      - filepath.regex: '(?i)\bdts[ ._-]?x\b'
#

The above code worked, but for some reason created a collection of only 70 movies

civic niche
sterile slate
#

So I can't directly limit the collection size given an arbitrary plex search size? I.e I'll have to guess/trial-and-error to choose a lmiit size in order to make a collection of exactly 100

marble dagger
#

Remove the limit on the plex search then limit the collection to 100; that will give you the best chance of getting 100 in the collection.

marble dagger
#

You can limit both the plex search and the final collection size. If you ask plex for 100 items, and then apply a filter to those 100, the only way you end up with 100 in the collection is if nothing hits any of the filters.

If you get all the plex results, then filter them, then limit the collection to 100, you end up with 100 items in the collection assuming that many make it through the filters.

sterile slate
#

Hey @marble dagger ,just seeing this now.

If you get all the plex results, then filter them, then limit the collection to 100

Yes, this is the order of operations that I want to do but I'm not sure how. Maybe this?

collections:
  4K Dolby Atmos Movies:
    plex_search:
      all:
        resolution: 4k
      sort_by:
        - release.desc
    limit: 100
    sync_mode: sync
    filters:
      - filepath.regex: '(?i)^(?=.*\btrue[ ._-]?hd(\b|\d))(?=.*\batmos(\b|\d))'
      - filepath.regex: '(?i)^(?=.*\b(dd[p+])|(dolby digital plus)\b)(?=.*\batmos(\b|\d))'
      - filepath.regex: '(?i)\batmos(\b|\d)'
      - filepath.regex: '(?i)\bdts[ ._-]?x\b'
#

The above almost worked, but now the collection is not ordered. So I need to both sort my plex search AND sort my collection order to get the outcome I want. I re-included collection_order: release.desc
The below is my final .yml and is working as desired

collections:
  4K Dolby Atmos Movies:
    collection_order: release.desc
    plex_search:
      all:
        resolution: 4k
      sort_by:
        - release.desc
    limit: 100
    sync_mode: sync
    filters:
      - filepath.regex: '(?i)^(?=.*\btrue[ ._-]?hd(\b|\d))(?=.*\batmos(\b|\d))'
      - filepath.regex: '(?i)^(?=.*\b(dd[p+])|(dolby digital plus)\b)(?=.*\batmos(\b|\d))'
      - filepath.regex: '(?i)\batmos(\b|\d)'
      - filepath.regex: '(?i)\bdts[ ._-]?x\b'

Thanks for the help!