Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smart Collections #226

Closed
meisnate12 opened this issue May 2, 2021 · 10 comments · Fixed by #240
Closed

Smart Collections #226

meisnate12 opened this issue May 2, 2021 · 10 comments · Fixed by #240
Assignees
Labels
enhancement New feature or request

Comments

@meisnate12
Copy link
Member

meisnate12 commented May 2, 2021

Add smart collections functionality

(Done) Add smart_label which can be given one of the sort options below. Using the smart label will create a special smart collection where the smart collection just searches for a label which is added to all the movies the collection builders find

Sort Options
title.asc, title.desc, year.asc, year.desc, originally_available.asc, originally_available.desc, critic_rating.asc, critic_rating.desc, audience_rating.asc, audience_rating.desc, user_rating.asc, user_rating.desc, content_rating.asc, content_rating.desc, duration.asc, duration.desc, plays.asc, plays.desc, added.asc, added.desc, random

(Done) Add another option to build some smart collection similarily to how plex_search is formatted

@meisnate12 meisnate12 added the enhancement New feature or request label May 2, 2021
@meisnate12 meisnate12 self-assigned this May 2, 2021
meisnate12 added a commit that referenced this issue May 2, 2021
@danhew
Copy link

danhew commented May 3, 2021

Thanks for adding this.

Will it be able to add a label/smart collection without making a non-smart collection?

@meisnate12
Copy link
Member Author

Yes if you use either attributes above the smart collection will be created automatically and if it's already a normal collection it will be converted to a smart collection

meisnate12 added a commit that referenced this issue May 5, 2021
@meisnate12 meisnate12 mentioned this issue May 12, 2021
@miguelamaral
Copy link

Would it be possible for the script to ignore any values not found in the collection? At the moment it throws an error and skips the collection altogether, as seen here:

Baltic:
  smart_filter:
    any:
      country: Estonia, Latvia, Lithuania
    sort_by: year.asc
Scanning Baltic Collection
Smart Movie Filter
Sort By: year.asc
Plex Error: country: Latvia not found

I've also noticed the collection's thumbnail label doesn't always match the actual number of films. I figure it's probably got nothing to do with script, as it's been brought up here?

Thanks!

@meisnate12
Copy link
Member Author

yea the number of items has nothing to do with PMM.

It would be possible to have it function that way but to me, it makes more sense to have it fail if the item isn't found that way you know a mistake has been made and it emulates how the advance filter works in plex. You cant select an option that isn't already in your library. I would either remove the option that isn't found or add a movie to your library that will have that tag there

@meisnate12
Copy link
Member Author

PS nice job figuring out how to use smart_filter without me detailing it anywhere

@miguelamaral
Copy link

Yeah, I understand this would be a very specific use case. I was just hoping to transform a bunch of regular collections into smart collections, but it wouldn't work without those changes. Basically, grouping a predefined set of countries/regions would be unfeasible, as the script would likely fail unless you manually checked the Plex countries list before every run:

# Eastern Europe
country: Belarus, Bulgaria, Czech Republic, Hungary, Poland, Republic of Moldova, Romania, Russian Federation, Slovakia, Ukraine
# Latin America
country: Anguilla, Antigua and Barbuda, Argentina, Aruba, Bahamas, Barbados, Belize, Bolivarian Republic of Venezuela, "Bonaire, Sint Eustatius and Saba", Bouvet Island, Brazil, Cayman Islands, Chile, Colombia, Costa Rica, Cuba, Curaçao, Dominica, Dominican Republic, Ecuador, El Salvador, Falkland Islands (Malvinas), French Guiana, Grenada, Guadeloupe, Guatemala, Guyana, Haiti, Honduras, Jamaica, Martinique, Mexico, Montserrat, Nicaragua, Panama, Paraguay, Peru, Plurinational State of Bolivia, Puerto Rico, Saint Barthélemy, Saint Kitts and Nevis, Saint Lucia, Saint Martin (French part), Saint Vincent and the Grenadines, Sint Maarten (Dutch part), South Georgia and the South Sandwich Islands, Suriname, Trinidad and Tobago, Turks and Caicos Islands, Uruguay, Virgin Islands (British), Virgin Islands (U.S.)

I agree the default behaviour should be for it to fail, so something like a --ignore-invalid-options flag could work? Thanks again!

@miguelamaral
Copy link

Ah, lmao, it took me a while to figure out how to use the smart_filter, actually!

@meisnate12
Copy link
Member Author

i could add a flag under smart_filter which can allow it to ignore fails.

I'm working on the wiki pages for smart_filter and the other 1.9.0 changes now so hopefully ill have that done soon and people wont have to either read code or guess how to use it haha but I tried to make it as similar to how the advance search looks as much as possible

@miguelamaral
Copy link

Yeah, that'd be great! I think I actually found the smart_filter method in use afterwards in an updated config file, so that helped. Though I lack experience with python, the fact I can sort of make sense of most of the code must mean you're doing something right!

@meisnate12
Copy link
Member Author

ok add validate: false under smart_filter and it should not error out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants