Skip to content

Add an actor to a movie/video with role and thumb #462

Open

Description

@dom6770

So far I have created a little script to add an specific actor to a search result:

from plexapi.server import PlexServer
PLEX_URL = 'http://192.168.178.100:32400'
PLEX_TOKEN = 'token'
homeserver = PlexServer(PLEX_URL, PLEX_TOKEN)

tag = input(f"Actor: ")

for video in homeserver.library.section('test').search(None, collection=[tag]): 
	video._edit_tags(tag="actor", items=[tag])

It work's fine. An actor appears on that particular video(s) in the collection.
Now, I just don't want to add the actor, I also want to add the role and a thumb (photo URL), but so far I could not find anything in the documentation and in the source code. (might be it's quite late and I am tired), but I would be thankful if someone could help me with it or make it possible.

Activity

  1. blacktwin commented on Apr 22, 2020

    @blacktwin
    Collaborator

    You and me both. Creating an actor also creates the actor in the DB where I assume you could add the missing thumb and role but I haven't tried that yet. I'd prefer to do it all with API commands.

  2. blacktwin commented on Apr 23, 2020

    @blacktwin
    Collaborator

    @JonnyWong16 found how to add a thumb.

    edits = {
        'actor[0].tag.tag': 'Mom',
        'actor[0].locked': 1,
        'actor[0].tag.thumb': 'https://nickelodeonuniverse.com/wp-content/uploads/Spongebob.png'
    }
    movie = plex.library.section('Movies').get('Title')
    movie.edit(**edits)

    Still trying to find role.

  3. JonnyWong16 commented on Apr 23, 2020

    @JonnyWong16
    Collaborator

    Found it.

    edits = {
        'actor[0].tag.tag': 'Mom',
        'actor[0].locked': 1,
        'actor[0].tagging.text': 'Test Role',
        'actor[0].tag.thumb': 'https://nickelodeonuniverse.com/wp-content/uploads/Spongebob.png'
    }
    movie = plex.library.section('Movies').get('Title')
    movie.edit(**edits)

    image

  4. blacktwin commented on Apr 23, 2020

    @blacktwin
    Collaborator

    Need a addActor or add additional kwargs if it already exists.

  5. Hellowlol commented on Apr 23, 2020

    @Hellowlol
    Collaborator

    Imo we should support objects. So Role.create() and allow that to be passed to edit that serialize this to a url.

  6. blacktwin commented on Apr 23, 2020

    @blacktwin
    Collaborator

    Agreed.

  7. JonnyWong16 commented on Apr 23, 2020

    @JonnyWong16
    Collaborator

    While you're at it, there's a bug if you use _edit_tags(). Somewhere in the code when retrieving a movie, it only retrieves the first 3 actors. Therefore, when you use _edit_tags(), the tag_helper() inserts the new actor into position 4.

  8. Hellowlol commented on Apr 23, 2020

    @Hellowlol
    Collaborator

    It only retrieves 3 as this only what re xml includes. If we want more the user has to movie.reload() is the fourth item overwritten?

  9. JonnyWong16 commented on Apr 23, 2020

    @JonnyWong16
    Collaborator

    From my tests it looks like it's inserted and not overwritten. Needs more testing though.

  10. blacktwin commented on Jun 5, 2020

    @blacktwin
    Collaborator

    @Hellowlol I don't think we can use the Role class to create or edit a role/actor. The actor is tied to a Video object and in order to create one we need to use a Video. I'm thinking of adding the method to add or edit an actor in the Video class.

    Some findings in case they are relevant:

    Actor's thumb follows the name of the actor across libraries and videos.
    The role is attached to the video.
    Actors are not linked across libraries, at least in the WebUI but plex.search('Bob Odenkirk') works :)

  11. blacktwin commented on Jun 18, 2020

    @blacktwin
    Collaborator

    Refreshing an item removes all added actors from the item. This makes sense for known movies and shows where metadata is available as refreshing wipes the previous metadata values and updates. However, for Home Videos adding an actor named Mom would be pretty cool but if the library get refreshed all your custom actors are lost.

  12. Hellowlol commented on Jun 18, 2020

    @Hellowlol
    Collaborator

    It shouldn’t be deleted as long as the item is locked.

  13. blacktwin commented on Jun 18, 2020

    @blacktwin
    Collaborator

    Locked attribute doesn't exist for the tag/field and adding the usual locked str doesn't make a difference. I've created a Plex Feature Request. But I'm not sure that we are really supposed to be allowed to edit actors like this.

  14. blacktwin commented on Jun 19, 2020

    @blacktwin
    Collaborator

    With actor[0] and using index= for actor[index] has been very inconsistent. Typically any new actor created or any existing actor that is edited (add or change role, thumb, or just index) moves the actor to the beginning of cast list. However I've observed several times where changing the index value to -1, 1, or 2 when creating or just updating the index value for an existing actor will cause them to move forward or backward in the listings. This has been somewhat random.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions