Why is cast not editable in metadata?

server-mac

#1

Just curious as to why all metadata is editable except the cast list. Media Preview mode displays the first 3 cast members, but the cast lists seem to be in random order and rarely list the stars first. So the vast majority of the time you don't end up seeing who is starring in the movie, you see 3 names you've never heard of. It kinda defeats the purpose.



You can edit directors, writers and everything else, but not the cast list. If you could, it would be a simple matter of putting the cast in an order that makes sense.



Just a thought for future Plex improvements (or maybe this more of a skin issue?).


#2

Just out of curiosity, why is this important to you? I only ask because I don't think I've ever paid attention to this particular field when I'm browsing for movies or shows to watch. I can usually get the gist from the movie poster on who the stars of the movie are.


#3

[quote name='kappaknight' timestamp='1331194731' post='244626']


Just out of curiosity, why is this important to you? I only ask because I don't think I've ever paid attention to this particular field when I'm browsing for movies or shows to watch. I can usually get the gist from the movie poster on who the stars of the movie are.

[/quote]




Just seems really odd to me that they would build a metadata editor, give you the ability to edit everything, and then leave out just one field... Cast. I wonder if it was an oversight... can't imagine why it would get left out on purpose. You're right that movie posters often give you that info, but not always, or it's too small to read.



Anyway, to answer your question, it isn't important... but obviously I wouldn't have brought it up if I didn't use that field. So it would be nice to be able to edit that field just like all the rest. They even let you edit some more obscure data like the name of the studio, the writers and the content rating... why not cast?


#4

I look at it all the time, it's nice to see who's in a film before or after watching, besides top billing. I really liked the feature that was in Plex 8. You could click on the actor's name in info screen and it would bring up all the movies in your library that that actor was in. Unfortunately that feature is gone in 9, probably because of how the server is setup. The search is now at the front, which is better overall. I'm not sure that it's not editable, more that there just isn't a field for it. If Plex server isn't using these fields for search, then it probably could be added. Maybe.


#5

Technically, "Starring Actor" is not the only metadata field like that which isn't exposed in the UI - "Country" is the same.



For that matter, there are other, more abstract, metadata fields that also aren't exposed: resolution, aspect ratio, video codec, audio codec, audio channels, etc. Though with those I'll certainly accept the argument that they're derived from inherent qualities of the actual media file in question and so it makes sense to not allow them to be modified. ...Except that just this week there was a request to be able to modify the aspect ratio info since some straight disc rips of content will include the black letterboxing bars and those bars are present when Plex's media analysis occurs, thus the aspect ratio reported can be different from what you actually see for the real video content itself. How's that for muddling the waters? heh =)



Anyway, I can certainly understand a desire to be able to edit both "Starring Actor" and "Country" info, so I'd encourage you to ensure that it's been requested in the stickied "Feature Requests" thread for the Plex Media Server.


What MP4 tags can be read into Plex with local assets agent?
#6

[quote name='Chris C' timestamp='1331231785' post='244725']


Anyway, I can certainly understand a desire to be able to edit both "Starring Actor" and "Country" info, so I'd encourage you to ensure that it's been requested in the stickied "Feature Requests" thread for the Plex Media Server.

[/quote]




Thanks for pointing that out... I've added it to the list.


#7

+1 for Cast list in the metadata... just seems like a no-brainer when you have writers, director etc etc...


#8

I love PLEX, but when it comes to editing metadata I'm missing the ability to edit actors/cast. So I decided to do some PHP scripting. Why PHP? Because my PMS runs on a Synology NAS and I've linked the database to the root of the webserver and about 10 years ago I've already done some PHP scripting. Please be kind with my script - I am not a pro! I haven't done any front-end work, there are only HTML-links and the logic ... and be very carefull, backup your database before you use the script. Improvements are welcome ... :rolleyes:



<br />
<html><br />
<head><br />
<title></title><br />
</head><br />
<body><br />
<?<br />
$sqliteDb='com.plexapp.plugins.library.db';<br />
$db = new SQLite3($sqliteDb);<br />
<br />
<br />
// adds an actor to a movie and checks if the actor is already in the database<br />
<br />
if ( ($_POST["NEW"]=="NEW") && ($_POST["ADD19"]<>"ADD19") && ($_POST["tag_new"]<>"") && ($_GET["library_section_id"]<>"") && ($_GET["metadata_items_id"]<>"") ) {<br />
<br />
    $rows_new = $db->query('SELECT COUNT(*) as count FROM tags WHERE tag="'.$_POST["tag_new"].'" AND tag_type=6');<br />
    $row_new_count = $rows_new->fetchArray();<br />
<br />
    $date_new = date('Y-m-d H:i:s');<br />
<br />
    switch ($row_new_count['count']) {<br />
        // actor is not in the database and must be created<br />
        case 0:<br />
            $results_tags_new_0 =$db->query('INSERT INTO tags (tag,tag_type,created_at,updated_at) VALUES ("'.$_POST["tag_new"].'",6,"'.$date_new.'","'.$date_new.'")');<br />
<br />
            $results_tags_new_0_select = $db->query('SELECT id FROM tags WHERE tag="'.$_POST["tag_new"].'" AND tag_type=6');<br />
<br />
            while ($row_tags_new_0_select = $results_tags_new_0_select->fetchArray()) {<br />
<br />
                $results_taggings_new_0 =$db->query('INSERT INTO taggings (metadata_item_id,tag_id,text,created_at) VALUES ('.$_GET["metadata_items_id"].','.$row_tags_new_0_select["id"].',"'.$_POST["text_new"].'","'.$date_new.'")');<br />
<br />
            }<br />
<br />
        break;<br />
        // actor is in the database and must only be added to the movie<br />
        case 1:<br />
            $results_tags_new_1_select = $db->query('SELECT id FROM tags WHERE tag="'.$_POST["tag_new"].'" AND tag_type=6');<br />
<br />
            while ($row_tags_new_1_select = $results_tags_new_1_select->fetchArray()) {<br />
<br />
                $results_taggings_new_1 =$db->query('INSERT INTO taggings (metadata_item_id,tag_id,text,created_at) VALUES ('.$_GET["metadata_items_id"].','.$row_tags_new_1_select["id"].',"'.$_POST["text_new"].'","'.$date_new.'")');<br />
<br />
            }<br />
        break;<br />
        default:<br />
            echo "ERROR";<br />
        break;<br />
    }<br />
<br />
}<br />
<br />
<br />
// deletes, updates the name and role of actor within a movie<br />
<br />
if ( (!empty($_POST)) && ($_POST["NEW"]<>"NEW") && ($_POST["ADD19"]<>"ADD19") && ($_GET["library_section_id"]<>"") && ($_GET["metadata_items_id"]<>"") ) {<br />
<br />
    $results_tags = $db->query('SELECT tags.tag,tags.tag_type,taggings.text,taggings.id,taggings.tag_id  FROM taggings JOIN tags WHERE taggings.metadata_item_id='.$_GET["metadata_items_id"].' AND taggings.tag_id=tags.id ORDER BY taggings.id');<br />
<br />
    while ($row_tags = $results_tags->fetchArray()) {<br />
<br />
        if ($row_tags['tag_type']=='6') {<br />
            switch ($_POST[$row_tags['id']]) {<br />
                case "DELETE":<br />
                    $results_taggings_delete =$db->query('DELETE FROM taggings WHERE id='.$row_tags['id'].'');<br />
                break;<br />
                case "UPDATE_Name":<br />
                    $results_taggings_update_name =$db->query('UPDATE tags SET tag="'.$_POST["tag_".$row_tags['id']].'" WHERE id='.$row_tags['tag_id'].'');<br />
                break;<br />
                case "UPDATE_Role":<br />
                    $results_taggings_update_role =$db->query('UPDATE taggings SET text="'.$_POST["text_".$row_tags['id']].'" WHERE id='.$row_tags['id'].'');<br />
                break;<br />
            }<br />
<br />
        }<br />
    <br />
    }<br />
}<br />
<br />
<br />
// is done every time the database is changed. Creates the attribute tags_star for the table metadata_itmes and the attribute user_fields by adding "lockedFields" Parameter "19" for the actors. Due to a bug in Plex/Web this is removed every time you save the metadata.<br />
<br />
if ( (!empty($_POST)) && ($_GET["library_section_id"]<>"") && ($_GET["metadata_items_id"]<>"") ) {<br />
<br />
    $results_tags_general = $db->query('SELECT tags.tag,tags.tag_type,taggings.text,taggings.id,taggings.tag_id  FROM taggings JOIN tags WHERE taggings.metadata_item_id='.$_GET["metadata_items_id"].' AND taggings.tag_id=tags.id ORDER BY taggings.id');<br />
<br />
    $tags_star ="";<br />
<br />
    while ($row_tags_general = $results_tags_general->fetchArray()) {<br />
<br />
        if ($row_tags_general['tag_type']=='6') {<br />
            $tags_star .=$row_tags_general['tag']."|";<br />
        }<br />
    <br />
    }<br />
    $tags_star=rtrim($tags_star,'|');<br />
<br />
    $results_metadata_itmes_update_tags_star =$db->query('UPDATE metadata_items SET tags_star="'.$tags_star.'" WHERE id='.$_GET["metadata_items_id"].'');<br />
<br />
    <br />
    $results_metadata_items_general = $db->query('SELECT title,id,tags_star,user_fields FROM metadata_items WHERE id='.$_GET["metadata_items_id"].' ORDER BY title_sort');<br />
<br />
    $user_fields="";<br />
    $user_fields_trim="";<br />
    $user_fields_new="lockedFields=";<br />
<br />
    while ($row_metadata_items_general = $results_metadata_items_general->fetchArray()) {<br />
        $user_fields=$row_metadata_items_general['user_fields'];<br />
    }<br />
<br />
    $user_fields_trim = trim($user_fields, "lockedFields=");<br />
    $user_fields_parts = explode("|", $user_fields_trim);<br />
<br />
    if(in_array(19,$user_fields_parts)) {<br />
<br />
    } else {<br />
        $user_fields_parts[]=19;<br />
    }<br />
<br />
    sort($user_fields_parts);<br />
<br />
    for($i=0; $i < count($user_fields_parts); $i++)<br />
    {<br />
        $user_fields_new .=$user_fields_parts[$i]."|";<br />
    }<br />
    $user_fields_new=rtrim($user_fields_new,'|');<br />
<br />
    $results_metadata_itmes_update_user_fields =$db->query('UPDATE metadata_items SET user_fields="'.$user_fields_new.'" WHERE id='.$_GET["metadata_items_id"].'');<br />
}<br />
<br />
<br />
// returns a list of the sections<br />
<br />
if (($_GET["library_section_id"]=="") && ($_GET["metadata_items_id"]=="")) {<br />
<br />
    $body="";<br />
<br />
    $results_library_sections = $db->query('SELECT id,name FROM library_sections');<br />
<br />
    while ($row_library_sections = $results_library_sections->fetchArray()) {<br />
        $body.="<a href=\"".$_SERVER['PHP_SELF']."?library_section_id=".$row_library_sections['id']."\">".htmlentities($row_library_sections['name'], ENT_QUOTES, "UTF-8")."</a>&nbsp;(ID:&nbsp;".$row_library_sections['id'].")<br>";<br />
    }<br />
<br />
    echo ($body);<br />
}<br />
<br />
<br />
// returns a list of movies within a section<br />
<br />
if (($_GET["library_section_id"]<>"") && ($_GET["metadata_items_id"]=="")) {<br />
<br />
    $body="";<br />
<br />
    $results_metadata_items = $db->query('SELECT title,id FROM metadata_items WHERE library_section_id='.$_GET["library_section_id"].' ORDER BY title_sort');<br />
<br />
    $body.="<p><a href=\"".$_SERVER['PHP_SELF']."\">back</a></p>";<br />
<br />
    while ($row_metadata_items = $results_metadata_items->fetchArray()) {<br />
        $body.="<a href=\"".$_SERVER['PHP_SELF']."?library_section_id=".$_GET["library_section_id"]."&metadata_items_id=".$row_metadata_items['id']."\">".htmlentities($row_metadata_items['title'], ENT_QUOTES, "UTF-8")."</a>&nbsp;(ID:&nbsp;".$row_metadata_items['id'].")<br>";<br />
    }<br />
<br />
    $body.="<p><a href=\"".$_SERVER['PHP_SELF']."\">back</a></p>";<br />
<br />
    echo ($body);<br />
}<br />
<br />
<br />
// returns an editable list of actors and some extra information of a movie<br />
<br />
if (($_GET["library_section_id"]<>"") && ($_GET["metadata_items_id"]<>"")) {<br />
<br />
    $body="";<br />
<br />
    $body.="<p><a href=\"".$_SERVER['PHP_SELF']."?library_section_id=".$_GET["library_section_id"]."\">back</a></p>";<br />
    $body.="<form action=\"".$_SERVER['PHP_SELF']."?metadata_items_id=".$_GET["metadata_items_id"]."&library_section_id=".$_GET["library_section_id"]."\" method=\"post\"><p>";<br />
<br />
    $results_metadata_items = $db->query('SELECT title,id,tags_star,user_fields FROM metadata_items WHERE id='.$_GET["metadata_items_id"].' ORDER BY title_sort');<br />
<br />
    while ($row_metadata_items = $results_metadata_items->fetchArray()) {<br />
        $body.="<p><u>Title:</u>&nbsp;".htmlentities($row_metadata_items['title'], ENT_QUOTES, "UTF-8")."&nbsp;(ID:&nbsp;".$row_metadata_items['id'].")</p><p><u>Tags Star:</u>&nbsp;".htmlentities($row_metadata_items['tags_star'], ENT_QUOTES, "UTF-8")."</p><p><u>User Fields:</u>&nbsp;".$row_metadata_items['user_fields']."&nbsp;<input type=\"submit\" value=\"ADD19\" name=\"ADD19\"></p>";<br />
    }<br />
<br />
    $results_tags = $db->query('SELECT tags.tag,tags.tag_type,taggings.text,taggings.id FROM taggings JOIN tags WHERE taggings.metadata_item_id='.$_GET["metadata_items_id"].' AND taggings.tag_id=tags.id ORDER BY taggings.id');<br />
<br />
    while ($row_tags = $results_tags->fetchArray()) {<br />
<br />
        if ($row_tags['tag_type']=='6') {<br />
<br />
            $body.="<u>Name:</u>&nbsp;<input name=\"tag_".$row_tags['id']."\" type=\"text\" size=\"30\" value=\"".$row_tags['tag']."\">&nbsp;(ID:&nbsp;".$row_tags['id'].")&nbsp;<u>Role:</u>&nbsp;<input name=\"text_".$row_tags['id']."\" type=\"text\" size=\"30\" value=\"".$row_tags['text']."\"><input type=\"submit\" value=\"UPDATE_Name\" name=\"".$row_tags['id']."\"><input type=\"submit\" value=\"UPDATE_Role\" name=\"".$row_tags['id']."\"><input type=\"submit\" value=\"DELETE\" name=\"".$row_tags['id']."\"><br>";<br />
<br />
        }<br />
    <br />
    }<br />
    $body.="<p><u>Name:</u>&nbsp;<input name=\"tag_new\" type=\"text\" size=\"30\" value=\"\">&nbsp;<u>Role:</u>&nbsp;<input name=\"text_new\" type=\"text\" size=\"30\" value=\"\"><input type=\"submit\" value=\"NEW\" name=\"NEW\">";<br />
    $body.="</p></form>";<br />
    $body.="<p><a href=\"".$_SERVER['PHP_SELF']."?library_section_id=".$_GET["library_section_id"]."\">back</a></p>";<br />
<br />
    echo ($body);<br />
<br />
}<br />
<br />
?><br />
</body><br />
</html><br />
<br />



#9

Hello

I'm really interested in your script.

Can you help me by telling where to put this?

Thank you!

Thomas


#10

I love PLEX, but when it comes to editing metadata I'm missing the ability to edit actors/cast. So I decided to do some PHP scripting. Why PHP? Because my PMS runs on a Synology NAS and I've linked the database to the root of the webserver and about 10 years ago I've already done some PHP scripting. Please be kind with my script - I am not a pro! I haven't done any front-end work, there are only HTML-links and the logic ... and be very carefull, backup your database before you use the script. Improvements are welcome ... :rolleyes:
 






"ADD19") && ($_POST["tag_new"]<>"") && ($_GET["library_section_id"]<>"") && ($_GET["metadata_items_id"]<>"") ) {

    $rows_new = $db->query('SELECT COUNT(*) as count FROM tags WHERE tag="'.$_POST["tag_new"].'" AND tag_type=6');
    $row_new_count = $rows_new->fetchArray();

    $date_new = date('Y-m-d H:i:s');

    switch ($row_new_count['count']) {
        // actor is not in the database and must be created
        case 0:
            $results_tags_new_0 =$db->query('INSERT INTO tags (tag,tag_type,created_at,updated_at) VALUES ("'.$_POST["tag_new"].'",6,"'.$date_new.'","'.$date_new.'")');

            $results_tags_new_0_select = $db->query('SELECT id FROM tags WHERE tag="'.$_POST["tag_new"].'" AND tag_type=6');

            while ($row_tags_new_0_select = $results_tags_new_0_select->fetchArray()) {

                $results_taggings_new_0 =$db->query('INSERT INTO taggings (metadata_item_id,tag_id,text,created_at) VALUES ('.$_GET["metadata_items_id"].','.$row_tags_new_0_select["id"].',"'.$_POST["text_new"].'","'.$date_new.'")');

            }

        break;
        // actor is in the database and must only be added to the movie
        case 1:
            $results_tags_new_1_select = $db->query('SELECT id FROM tags WHERE tag="'.$_POST["tag_new"].'" AND tag_type=6');

            while ($row_tags_new_1_select = $results_tags_new_1_select->fetchArray()) {

                $results_taggings_new_1 =$db->query('INSERT INTO taggings (metadata_item_id,tag_id,text,created_at) VALUES ('.$_GET["metadata_items_id"].','.$row_tags_new_1_select["id"].',"'.$_POST["text_new"].'","'.$date_new.'")');

            }
        break;
        default:
            echo "ERROR";
        break;
    }

}


// deletes, updates the name and role of actor within a movie

if ( (!empty($_POST)) && ($_POST["NEW"]<>"NEW") && ($_POST["ADD19"]<>"ADD19") && ($_GET["library_section_id"]<>"") && ($_GET["metadata_items_id"]<>"") ) {

    $results_tags = $db->query('SELECT tags.tag,tags.tag_type,taggings.text,taggings.id,taggings.tag_id  FROM taggings JOIN tags WHERE taggings.metadata_item_id='.$_GET["metadata_items_id"].' AND taggings.tag_id=tags.id ORDER BY taggings.id');

    while ($row_tags = $results_tags->fetchArray()) {

        if ($row_tags['tag_type']=='6') {
            switch ($_POST[$row_tags['id']]) {
                case "DELETE":
                    $results_taggings_delete =$db->query('DELETE FROM taggings WHERE id='.$row_tags['id'].'');
                break;
                case "UPDATE_Name":
                    $results_taggings_update_name =$db->query('UPDATE tags SET tag="'.$_POST["tag_".$row_tags['id']].'" WHERE id='.$row_tags['tag_id'].'');
                break;
                case "UPDATE_Role":
                    $results_taggings_update_role =$db->query('UPDATE taggings SET text="'.$_POST["text_".$row_tags['id']].'" WHERE id='.$row_tags['id'].'');
                break;
            }

        }
    
    }
}


// is done every time the database is changed. Creates the attribute tags_star for the table metadata_itmes and the attribute user_fields by adding "lockedFields" Parameter "19" for the actors. Due to a bug in Plex/Web this is removed every time you save the metadata.

if ( (!empty($_POST)) && ($_GET["library_section_id"]<>"") && ($_GET["metadata_items_id"]<>"") ) {

    $results_tags_general = $db->query('SELECT tags.tag,tags.tag_type,taggings.text,taggings.id,taggings.tag_id  FROM taggings JOIN tags WHERE taggings.metadata_item_id='.$_GET["metadata_items_id"].' AND taggings.tag_id=tags.id ORDER BY taggings.id');

    $tags_star ="";

    while ($row_tags_general = $results_tags_general->fetchArray()) {

        if ($row_tags_general['tag_type']=='6') {
            $tags_star .=$row_tags_general['tag']."|";
        }
    
    }
    $tags_star=rtrim($tags_star,'|');

    $results_metadata_itmes_update_tags_star =$db->query('UPDATE metadata_items SET tags_star="'.$tags_star.'" WHERE id='.$_GET["metadata_items_id"].'');

    
    $results_metadata_items_general = $db->query('SELECT title,id,tags_star,user_fields FROM metadata_items WHERE id='.$_GET["metadata_items_id"].' ORDER BY title_sort');

    $user_fields="";
    $user_fields_trim="";
    $user_fields_new="lockedFields=";

    while ($row_metadata_items_general = $results_metadata_items_general->fetchArray()) {
        $user_fields=$row_metadata_items_general['user_fields'];
    }

    $user_fields_trim = trim($user_fields, "lockedFields=");
    $user_fields_parts = explode("|", $user_fields_trim);

    if(in_array(19,$user_fields_parts)) {

    } else {
        $user_fields_parts[]=19;
    }

    sort($user_fields_parts);

    for($i=0; $i < count($user_fields_parts); $i++)
    {
        $user_fields_new .=$user_fields_parts[$i]."|";
    }
    $user_fields_new=rtrim($user_fields_new,'|');

    $results_metadata_itmes_update_user_fields =$db->query('UPDATE metadata_items SET user_fields="'.$user_fields_new.'" WHERE id='.$_GET["metadata_items_id"].'');
}


// returns a list of the sections

if (($_GET["library_section_id"]=="") && ($_GET["metadata_items_id"]=="")) {

    $body="";

    $results_library_sections = $db->query('SELECT id,name FROM library_sections');

    while ($row_library_sections = $results_library_sections->fetchArray()) {
        $body.="".htmlentities($row_library_sections['name'], ENT_QUOTES, "UTF-8")." (ID: ".$row_library_sections['id'].")
"; } echo ($body); } // returns a list of movies within a section if (($_GET["library_section_id"]<>"") && ($_GET["metadata_items_id"]=="")) { $body=""; $results_metadata_items = $db->query('SELECT title,id FROM metadata_items WHERE library_section_id='.$_GET["library_section_id"].' ORDER BY title_sort'); $body.="

back

"; while ($row_metadata_items = $results_metadata_items->fetchArray()) { $body.="".htmlentities($row_metadata_items['title'], ENT_QUOTES, "UTF-8")." (ID: ".$row_metadata_items['id'].")
"; } $body.="

back

"; echo ($body); } // returns an editable list of actors and some extra information of a movie if (($_GET["library_section_id"]<>"") && ($_GET["metadata_items_id"]<>"")) { $body=""; $body.="

back

"; $body.="

"; $results_metadata_items = $db->query('SELECT title,id,tags_star,user_fields FROM metadata_items WHERE id='.$_GET["metadata_items_id"].' ORDER BY title_sort'); while ($row_metadata_items = $results_metadata_items->fetchArray()) { $body.="

Title: ".htmlentities($row_metadata_items['title'], ENT_QUOTES, "UTF-8")." (ID: ".$row_metadata_items['id'].")

Tags Star: ".htmlentities($row_metadata_items['tags_star'], ENT_QUOTES, "UTF-8")."

User Fields: ".$row_metadata_items['user_fields']." 

"; } $results_tags = $db->query('SELECT tags.tag,tags.tag_type,taggings.text,taggings.id FROM taggings JOIN tags WHERE taggings.metadata_item_id='.$_GET["metadata_items_id"].' AND taggings.tag_id=tags.id ORDER BY taggings.id'); while ($row_tags = $results_tags->fetchArray()) { if ($row_tags['tag_type']=='6') { $body.="Name:  (ID: ".$row_tags['id'].") Role: 
"; } } $body.="

Name:  Role: "; $body.="

"; $body.="

back

"; echo ($body); } ?>

Excuse me for being a bit of a noob, but how do I add this to my database. Do I have to run IIS on my Windows Server in order to run this php?


#11

Just loaded Plex server on my Vortexbox (Fedora), and players on my Roku and on my Mac. I am almost delighted, at least with the handling of Movies.

But this thread raises an issue that is still a niggle, at least for me. If the contents of the "Cast" field don't include the stars of the show, then the "Search by starring actor" function is pretty much useless. The prepopulated and uneditable values in this field mean that I can't find Amadeus by searching for Tom Hulce or F Murray Abraham; I can't find De-Lovely by searching for Kevin Kline or Ashley Judd; I can't find Topsy-Turvy by searching for Jim Broadbent or Allan Cordiner; and (for heaven's sake) I can't find Ian McKellen's Richard III by searching for Ian McKellen. It's tempting to keep adding examples, but I'll stop there. 

So, yes, I add my +1 for making the Cast field editable.

However I found that the relevant Freebase entries do include at least some of the above-mentioned starring actors. So is there something screwed in the way Plex is pulling down the data? Perhaps that needs to be fixed too, so that users don't have to make the corrections themselves.


#12

Just out of curiosity, why is this important to you? I only ask because I don't think I've ever paid attention to this particular field when I'm browsing for movies or shows to watch. I can usually get the gist from the movie poster on who the stars of the movie are.

This is important because only three actors are listed and often the ones that are pulled from the sites are not the top tier actors.   This makes it difficult for me to search for a movie by actor when at my TV or on my mobile device.


#13

I justo watched Zero Dark Thirty on Plex and wondered why Idris Elba and Rooney Mara were not showing up. Turns out the source has the wrong Metadata for that movie; so +1 to it being noticeable.


#14

Just did an massive update to my skript. Just working on an import function for metadata from TheMovieDB.org and TheTVDB.com






 $value)
        { 
            $result[$key] = object_2_array($value); 
        }
        return $result;
    }
    return $data;
}

function makeSortFunction($field)
{
    $code = "return strnatcmp(\$a['$field'], \$b['$field']);"; 
    return create_function('$a,$b', $code); 
}

function saveTag($tag_new,$text_new,$metadata_items_id,$number,$tag_type)
{
    $sqliteDb='com.plexapp.plugins.library.db';
    $db = new SQLite3($sqliteDb);

    $strplace="'";
    $tag_new=str_replace('"',$strplace, $tag_new);
    $text_new=str_replace('"',$strplace, $text_new);

    $rows_new = $db->query('SELECT COUNT(*) as count FROM tags WHERE tag="'.$tag_new.'" AND tag_type='.$tag_type.'');
    $row_new_count = $rows_new->fetchArray();

    $date_new = date('Y-m-d H:i:s');

    switch ($row_new_count['count']) {
        // actor,director,writer, etc. is not in the database and must be created
        case 0:
            $results_tags_new_0 =$db->query('INSERT INTO tags (tag,tag_type,created_at,updated_at) VALUES ("'.$tag_new.'",'.$tag_type.',"'.$date_new.'","'.$date_new.'")');

            $results_tags_new_0_select = $db->query('SELECT id FROM tags WHERE tag="'.$tag_new.'" AND tag_type='.$tag_type.'');

            while ($row_tags_new_0_select = $results_tags_new_0_select->fetchArray()) {
                if ($number=="") {
                    $results_taggings_new_0 =$db->query('INSERT INTO taggings (metadata_item_id,tag_id,text,created_at) VALUES ('.$metadata_items_id.','.$row_tags_new_0_select["id"].',"'.$text_new.'","'.$date_new.'")');
                } else {
                    $results_taggings_new_0 =$db->query('INSERT INTO taggings (metadata_item_id,tag_id,text,created_at,`index`) VALUES ('.$metadata_items_id.','.$row_tags_new_0_select["id"].',"'.$text_new.'","'.$date_new.'",'.$number.')');
                }
            }

        break;
        // actor,director,writer, etc. is in the database and must only be added to the movie
        case 1:
            $results_tags_new_1_select = $db->query('SELECT id FROM tags WHERE tag="'.$tag_new.'" AND tag_type='.$tag_type.'');

            while ($row_tags_new_1_select = $results_tags_new_1_select->fetchArray()) {
                // check needed, because if the actors,directors,writers, etc. are in the database, they can already been added to the movie. for update or re-import the update- or delete-function must be used. 
                $rows_new_taggings = $db->query('SELECT COUNT(*) as count FROM taggings WHERE metadata_item_id='.$metadata_items_id.' AND tag_id='.$row_tags_new_1_select["id"].'');
                $row_new_count_taggings = $rows_new_taggings->fetchArray();
                if ($row_new_count_taggings['count']==0) {
                    if ($number=="") {
                        $results_taggings_new_1 =$db->query('INSERT INTO taggings (metadata_item_id,tag_id,text,created_at) VALUES ('.$metadata_items_id.','.$row_tags_new_1_select["id"].',"'.$text_new.'","'.$date_new.'")');
                    } else {
                        $results_taggings_new_1 =$db->query('INSERT INTO taggings (metadata_item_id,tag_id,text,created_at,`index`) VALUES ('.$metadata_items_id.','.$row_tags_new_1_select["id"].',"'.$text_new.'","'.$date_new.'",'.$number.')');
                    }                   
                }
            }
        break;
        default:
            echo "ERROR";
        break;
    }
}

function edit_user_fields($user_fields_general,$action,$metadata_items_id)
{
    $sqliteDb='com.plexapp.plugins.library.db';
    $db = new SQLite3($sqliteDb);

    $user_fields="";
    $user_fields_trim="";
    $user_fields_new="lockedFields=";

    if ($action<>"rebuild") {

        $results_metadata_items_general = $db->query('SELECT title,id,tags_star,user_fields FROM metadata_items WHERE id='.$metadata_items_id.' ORDER BY title_sort');

        while ($row_metadata_items_general = $results_metadata_items_general->fetchArray()) {
            $user_fields=$row_metadata_items_general['user_fields'];
        }

        $user_fields_trim = trim($user_fields, "lockedFields=");
        $user_fields_parts = explode("|", $user_fields_trim);

        switch ($action) {
            case "add":
                if(in_array($user_fields_general,$user_fields_parts)) {

                } else {
                    $user_fields_parts[]=$user_fields_general;
                }
            break;
            case "remove":
                $user_fields_parts=array_diff($user_fields_parts, array($user_fields_general));
            break;
        }
    } else  {
        $user_fields_parts=&$user_fields_general;
    }

    sort($user_fields_parts);


    for($i=0; $i < count($user_fields_parts); $i++)
    {
        $user_fields_new .=$user_fields_parts[$i]."|";
    }

    $user_fields_new=rtrim($user_fields_new,'|');

    $results_metadata_itmes_update_user_fields =$db->query('UPDATE metadata_items SET user_fields="'.$user_fields_new.'" WHERE id='.$metadata_items_id.'');

}

function built_html_metadata($row_metadata_items)
{
    $lockedFields=array("1" => "Title", "2" => "Title Sort", "3" => "Original Title", "4" => "Studio", "5" => "Rating", "6" => "Tagline", "7" => "Summary", "8" => "Content Rating", "9" => "User Thumb Url", "10" => "User Art Url", "11" => "User Banner Url", "12" => "User Music Url", "13" => "Original Available At", "14" => "Year", "15" => "Tags Genre", "16" => "Tags Collection", "17" => "Tags Director", "18" => "Tags Writer", "19" => "Tags Star", "24" => "Tags Country");

    $body.="

Title Sort:  

"; $body.="

Original Title:  

"; $body.="

Studio:  

"; $body.="

Rating:  

"; $body.="

Rating count:  

"; $body.="

Tagline:  

"; $body.="

Summary:

"; $body.="

Trivia:  

"; $body.="

Quotes:  

"; $body.="

Content Rating:  

"; $body.="

Content Rating Age:  

"; $body.="

Originally available at:  

"; $body.="

Year:  

"; $body.="

User Fields: ".$row_metadata_items['user_fields']." 

"; foreach ($lockedFields AS $key => $value) { $user_fields_trim = trim($row_metadata_items['user_fields'], "lockedFields="); $user_fields_parts = explode("|", $user_fields_trim); if(in_array($key,$user_fields_parts)) { $body.="(".$key.") ".$value." "; } else { $body.="(".$key.") ".$value." "; } } $body.="

"; $body.="

Tags Genre: ".htmlentities($row_metadata_items['tags_genre'], ENT_QUOTES, "UTF-8")."
"; $body.="Tags Collection: ".htmlentities($row_metadata_items['tags_collection'], ENT_QUOTES, "UTF-8")."
"; $body.="Tags Director: ".htmlentities($row_metadata_items['tags_director'], ENT_QUOTES, "UTF-8")."
"; $body.="Tags Writer: ".htmlentities($row_metadata_items['tags_writer'], ENT_QUOTES, "UTF-8")."
"; $body.="Tags Star: ".htmlentities($row_metadata_items['tags_star'], ENT_QUOTES, "UTF-8")."
"; $body.="Tags Country: ".htmlentities($row_metadata_items['tags_country'], ENT_QUOTES, "UTF-8")."

"; return $body; } $sqliteDb='com.plexapp.plugins.library.db'; $db = new SQLite3($sqliteDb); define('TMDB_API_KEY', 'TMDB_API_KEY'); define('TVDB_API_KEY', 'TVDB_API_KEY'); define('TMDB_LANGUAGE', 'en'); define('TVDB_LANGUAGE', 'de'); use TvDb\Client; if (TMDB_API_KEY<>"TMDB_API_KEY") { include("tmdb/tmdb_v3.php"); $tmdb_V3 = new TMDBv3(TMDB_API_KEY); } if (TVDB_API_KEY<>"TVDB_API_KEY") { define('TVDB_URL', 'http://thetvdb.com'); include __DIR__.'/tvdb/Client.php'; include __DIR__.'/tvdb/Serie.php'; include __DIR__.'/tvdb/Banner.php'; include __DIR__.'/tvdb/Episode.php'; include __DIR__.'/tvdb/Actor.php'; $tvdb = new Client(TVDB_URL, TVDB_API_KEY); } $tag_type_general=0; $user_fields_general=0; // adds an actor to a movie and checks if the actor is already in the database if ( ($_POST["NEW"]=="NEW") && ($_POST["IMPORT"]<>"IMPORT") && ($_POST["UPDATE_user_fields"]<>"UPDATE_user_fields") && ($_POST["tag_new"]<>"") && ($_GET["library_section_id"]<>"") && ($_GET["metadata_items_id"]<>"") ) { saveTag($_POST["tag_new"],$_POST["text_new"],$_GET["metadata_items_id"],$_POST["number_new"],$_POST["type_new"]); $tag_type_general=$_POST["type_new"]; } if ( ($_POST["IMPORT"]=="IMPORT") && ($_GET["library_section_type"]==1) && (TMDB_API_KEY<>"TMDB_API_KEY") && ($_POST["NEW"]<>"NEW") && ($_POST["UPDATE_user_fields"]<>"UPDATE_user_fields") && ($_GET["tmdb_id"]<>"") && ($_GET["library_section_id"]<>"") && ($_GET["metadata_items_id"]<>"") ) { $tmdb_result_cast = $tmdb_V3->movieCastArray($_GET["tmdb_id"]); usort($tmdb_result_cast, makeSortFunction('order')); for($j=0; $j < count($tmdb_result_cast); $j++) { saveTag($tmdb_result_cast[$j]['name'],$tmdb_result_cast[$j]['character'],$_GET["metadata_items_id"],($j+1),6); } } if ( ($_POST["IMPORT"]=="IMPORT") && ($_GET["library_section_type"]==2) && (TVDB_API_KEY<>"TVDB_API_KEY") && ($_POST["NEW"]<>"NEW") && ($_POST["UPDATE_user_fields"]<>"UPDATE_user_fields") && ($_GET["tvdb_id"]<>"") && ($_GET["library_section_id"]<>"") && ($_GET["metadata_items_id"]<>"") ) { $tvdb_result_cast_object = $tvdb->getActors($_GET["tvdb_id"]); $tvdb_result_cast_array = object_2_array($tvdb_result_cast_object); usort($tvdb_result_cast_array, makeSortFunction('sortorder')); for($j=0; $j < count($tvdb_result_cast_array); $j++) { saveTag($tvdb_result_cast_array[$j]['name'],$tvdb_result_cast_array[$j]['role'],$_GET["metadata_items_id"],($j+1),6); } if ($_GET["parent_id"]<>"") { $tvdb_result_episodes_object = $tvdb-> getSerieEpisodes($_GET["tvdb_id"],TVDB_LANGUAGE); $tvdb_result_episodes_array = object_2_array($tvdb_result_episodes_object["episodes"]); foreach ($tvdb_result_episodes_array as $tvdb_result_episode) { if ($tvdb_result_episode["season"]==$_GET["season"]) { if ($tvdb_result_episode["number"]==$_GET["episode"]) { // all metadata is available and can be saved here for tvdb foreach ($tvdb_result_episode["guestStars"] as $tvdb_result_episode_gueststar) { saveTag(trim($tvdb_result_episode_gueststar),'',$_GET["metadata_items_id"],($j+1),6); $j++; } } } } } } if ( ($_POST["UPDATE_user_fields"]=="UPDATE_user_fields") && ($_POST["NEW"]<>"NEW") && ($_POST["IMPORT"]<>"IMPORT") && ($_GET["library_section_id"]<>"") && ($_GET["metadata_items_id"]<>"") ) { edit_user_fields($_POST["lockedFields"],"rebuild",$_GET["metadata_items_id"]); } // deletes, updates the name and role of actor within a movie if ( (!empty($_POST)) && ($_POST["IMPORT"]<>"IMPORT") && ($_POST["NEW"]<>"NEW") && ($_POST["UPDATE_user_fields"]<>"UPDATE_user_fields") && ($_GET["library_section_id"]<>"") && ($_GET["metadata_items_id"]<>"") ) { if ($_POST['metadata_items_id_'.$_GET["metadata_items_id"]]<>"") { switch ($_POST['metadata_items_id_'.$_GET["metadata_items_id"]]) { case "UPDATE_title": $user_fields_general=1; break; case "UPDATE_title_sort": $user_fields_general=2; break; case "UPDATE_original_title": $user_fields_general=3; break; case "UPDATE_studio": $user_fields_general=4; break; case "UPDATE_rating": $user_fields_general=5; break; case "UPDATE_rating_count": $user_fields_general=5; break; case "UPDATE_tagline": $user_fields_general=6; break; case "UPDATE_summary": $user_fields_general=7; break; case "UPDATE_trivia": $user_fields_general=7; break; case "UPDATE_quotes": $user_fields_general=7; break; case "UPDATE_content_rating": $user_fields_general=8; break; case "UPDATE_content_rating_age": $user_fields_general=8; break; case "UPDATE_originally_available_at": $user_fields_general=13; break; case "UPDATE_year": $user_fields_general=14; break; } $metadata_item_update_variable=str_replace("UPDATE_","",$_POST['metadata_items_id_'.$_GET["metadata_items_id"]]); $results_metadata_itmes_update=$db->query('UPDATE metadata_items SET '.$metadata_item_update_variable.'="'.$_POST[$metadata_item_update_variable].'" WHERE id='.$_GET["metadata_items_id"].''); if (strlen($_POST[$metadata_item_update_variable])==0) { edit_user_fields($user_fields_general,"remove",$_GET["metadata_items_id"]); } else { edit_user_fields($user_fields_general,"add",$_GET["metadata_items_id"]); } } $results_tags = $db->query('SELECT tags.tag,taggings.text,taggings.id,taggings.tag_id FROM taggings JOIN tags WHERE taggings.metadata_item_id='.$_GET["metadata_items_id"].' AND taggings.tag_id=tags.id ORDER BY taggings.`index`'); $date_updated_at = date('Y-m-d H:i:s'); while ($row_tags = $results_tags->fetchArray()) { switch ($_POST['taggings_id_'.$row_tags['id']]) { case "DELETE_Tag": $results_taggings_delete =$db->query('DELETE FROM taggings WHERE id='.$row_tags['id'].''); $tag_type_general=$_POST["tag_type_".$row_tags['id']]; break; case "UPDATE_Tag_Name": $results_taggings_update_name =$db->query('UPDATE tags SET tag="'.$_POST["tag_".$row_tags['id']].'", updated_at="'.$date_updated_at.'" WHERE id='.$row_tags['tag_id'].''); $tag_type_general=$_POST["tag_type_".$row_tags['id']]; break; case "UPDATE_Tag_Role": if ($_POST["number_".$row_tags['id']]=="") { $results_taggings_update_role =$db->query('UPDATE taggings SET text="'.$_POST["text_".$row_tags['id']].'", created_at="'.$date_updated_at.'" WHERE id='.$row_tags['id'].''); } else { $results_taggings_update_role =$db->query('UPDATE taggings SET text="'.$_POST["text_".$row_tags['id']].'", `index`='.$_POST["number_".$row_tags['id']].', created_at="'.$date_updated_at.'" WHERE id='.$row_tags['id'].''); } $tag_type_general=$_POST["tag_type_".$row_tags['id']]; break; } } } // is done every time the database is changed. Creates the attribute tags_star for the table metadata_itmes and the attribute user_fields by adding "lockedFields" Parameter "19" for the actors. Due to a bug in Plex/Web this is removed every time you save the metadata. if ( (!empty($_POST)) && ($_GET["library_section_id"]<>"") && ($_GET["metadata_items_id"]<>"") ) { // update the tags_* in metadata_items if ($tag_type_general<>0) { $results_tags_general = $db->query('SELECT tags.tag,tags.tag_type,taggings.text,taggings.id,taggings.tag_id FROM taggings JOIN tags WHERE taggings.metadata_item_id='.$_GET["metadata_items_id"].' AND taggings.tag_id=tags.id ORDER BY taggings.`index`'); $tags_general=""; while ($row_tags_general = $results_tags_general->fetchArray()) { if ($tag_type_general==$row_tags_general['tag_type']) { $tags_general .=$row_tags_general['tag']."|"; } } $tags_general=rtrim($tags_general,'|'); switch ($tag_type_general) { case 1: $tags_general_field="tags_genre"; $user_fields_general=15; break; case 2: $tags_general_field="tags_collection"; $user_fields_general=16; break; case 4: $tags_general_field="tags_director"; $user_fields_general=17; break; case 5: $tags_general_field="tags_writer"; $user_fields_general=18; break; case 6: $tags_general_field="tags_star"; $user_fields_general=19; break; case 8: $tags_general_field="tags_country"; $user_fields_general=24; break; } $results_metadata_itmes_update_tags_star =$db->query('UPDATE metadata_items SET '.$tags_general_field.'="'.$tags_general.'" WHERE id='.$_GET["metadata_items_id"].''); // and now update lockedFields when insert, changed and deleted if (strlen($tags_general)==0) { edit_user_fields($user_fields_general,"remove",$_GET["metadata_items_id"]); } else { edit_user_fields($user_fields_general,"add",$_GET["metadata_items_id"]); } } } // returns a list of the sections if (($_GET["library_section_id"]=="") && ($_GET["metadata_items_id"]=="")) { $body=""; $results_library_sections = $db->query('SELECT id,name,section_type FROM library_sections'); while ($row_library_sections = $results_library_sections->fetchArray()) { $body.="".htmlentities($row_library_sections['name'], ENT_QUOTES, "UTF-8")." (ID: ".$row_library_sections['id'].")
"; } echo ($body); } // returns a list of movies within a section if (($_GET["library_section_id"]<>"") && ($_GET["metadata_items_id"]=="")) { $body=""; $results_metadata_items = $db->query('SELECT title,id,parent_id FROM metadata_items WHERE library_section_id='.$_GET["library_section_id"].' ORDER BY title_sort'); $body.="

back

"; while ($row_metadata_items = $results_metadata_items->fetchArray()) { switch ($_GET["library_section_type"]) { case 1: $body.="".htmlentities($row_metadata_items['title'], ENT_QUOTES, "UTF-8")." (ID: ".$row_metadata_items['id'].")
"; break; case 2: if ($row_metadata_items['parent_id']=="") { $body.="".htmlentities($row_metadata_items['title'], ENT_QUOTES, "UTF-8")." (ID: ".$row_metadata_items['id'].")
"; $results_metadata_items_seasons = $db->query('SELECT title,id,parent_id,`index` FROM metadata_items WHERE parent_id='.$row_metadata_items['id'].' ORDER BY `index`'); while ($row_metadata_items_seasons = $results_metadata_items_seasons->fetchArray()) { if ($row_metadata_items_seasons['index']==0) { $body.="
  Special (ID: ".$row_metadata_items_seasons['id'].")
"; } else { $body.="
  Season: ".$row_metadata_items_seasons['index']." (ID: ".$row_metadata_items_seasons['id'].")
"; } $results_metadata_items_episodes = $db->query('SELECT title,id,parent_id,`index` FROM metadata_items WHERE parent_id='.$row_metadata_items_seasons['id'].' ORDER BY `index`'); while ($row_metadata_items_episodes = $results_metadata_items_episodes->fetchArray()) { $body.="    Episode: ".$row_metadata_items_episodes['index']." - ".htmlentities($row_metadata_items_episodes['title'], ENT_QUOTES, "UTF-8")." (ID: ".$row_metadata_items_episodes['id'].")
"; } } $body.="
"; } break; } } $body.="

back

"; echo ($body); } // returns an editable list of actors and some extra information of a movie if (($_GET["library_section_id"]<>"") && ($_GET["metadata_items_id"]<>"") && ($_GET["library_section_type"]<>"")) { $body=""; $body.="

back

"; $body.="

"; // Information from metadata_items if ($_GET["parent_id"]=="") { $results_metadata_items = $db->query('SELECT * FROM metadata_items WHERE id='.$_GET["metadata_items_id"].' ORDER BY title_sort'); } else { $results_metadata_items = $db->query('SELECT * FROM metadata_items WHERE id='.$_GET["parent_id"].' ORDER BY title_sort'); } while ($row_metadata_items = $results_metadata_items->fetchArray()) { if ($_GET["parent_id"]=="") { $body.="

Title:  (ID: ".$row_metadata_items['id'].") 

"; $body.=built_html_metadata($row_metadata_items); } else { $results_metadata_items_parent_id = $db->query('SELECT *FROM metadata_items WHERE id='.$_GET["metadata_items_id"].' ORDER BY title_sort'); while ($row_metadata_items_parent_id = $results_metadata_items_parent_id->fetchArray()) { $body.="

Titel (Episode):  (ID: ".$row_metadata_items_parent_id['id'].") 
"; $body.="Title (TV Show): ".htmlentities($row_metadata_items['title'], ENT_QUOTES, "UTF-8")." (".$row_metadata_items['year'].") (ID: ".$row_metadata_items['id'].")

"; $body.=built_html_metadata($row_metadata_items_parent_id); } } switch ($_GET["library_section_type"]) { case 1: if (TMDB_API_KEY<>"TMDB_API_KEY") { $tmdb_result = $tmdb_V3->searchMovie($row_metadata_items['original_title'],TMDB_LANGUAGE); $tmdb_result_array = $tmdb_result['results']; $tmbd_search_original_title = $row_metadata_items['original_title']; } break; case 2: if (TVDB_API_KEY<>"TVDB_API_KEY") { $tvdb_result = $tvdb->getSeries($row_metadata_items['original_title'],TVDB_LANGUAGE); $tvbd_search_original_title = $row_metadata_items['original_title']; } break; } } // Information from taggings $results_tags = $db->query('SELECT tags.tag,tags.tag_type,taggings.text,taggings.id,taggings.`index` FROM taggings JOIN tags WHERE taggings.metadata_item_id='.$_GET["metadata_items_id"].' AND taggings.tag_id=tags.id ORDER BY tags.tag_type,taggings.`index`'); $tags_type_before=0; while ($row_tags = $results_tags->fetchArray()) { if ($tags_type_before<>$row_tags['tag_type']) { switch ($row_tags['tag_type']) { case 1: $body.="

Tag: Genre (Don't use \"#\" and \"Text\"! Maybe Plex will use one day \"#\", because it would make sense for sorting.)

"; break; case 2: $body.="

Tag: Collection (Don't use \"#\" and \"Text\"! Maybe Plex will use one day \"#\", because it would make sense for sorting.)

"; break; case 4: $body.="

Tag: Director (Don't use \"#\" and \"Text\"! Maybe Plex will use one day \"#\", because it would make sense for sorting.)

"; break; case 5: $body.="

Tag: Writer (Don't use \"#\" and \"Text\"! Maybe Plex will use one day \"#\", because it would make sense for sorting.)

"; break; case 6: $body.="

Tag: Star (Plex-Agents are using \"#\" for sorting and \"Text\" for the name of the role. So use it!)

"; break; case 8: $body.="

Tag: Country (Don't use \"#\" and \"Text\"! Maybe Plex will use one day \"#\", because it would make sense for sorting.)

"; break; } } $body.="Name:  "; $body.=" #:  Text:  (ID: ".$row_tags['id'].") "; $body.=""; $body.=""; $body.=""; $body.="
"; $tags_type_before=$row_tags['tag_type']; } $body.="

New Tag: (Only use \"#\" and \"Text\" for Star.)

"; $body.="

Name:  "; $body.=""; $tag_list = $db->query('SELECT tag FROM tags GROUP BY tag'); while ($row_tag_list = $tag_list->fetchArray()) { $body.=""; } $body.=""; $body.=" #:  Text:  "; $body.="Type:  "; $body.="

"; // Information from TMDB or TVDB for import switch ($_GET["library_section_type"]) { case 1: if (TMDB_API_KEY<>"TMDB_API_KEY") { $body.="

The Movie Database - themoviedb.org (Search Original Title: ".htmlentities($tmbd_search_original_title, ENT_QUOTES, "UTF-8").")

"; for($i=0; $i < $tmdb_result['total_results']; $i++) { if ( ($tmdb_result_array[$i]['original_title']<>"") && ($tmdb_result_array[$i]['release_date']<>"") && ($tmdb_result_array[$i]['id']<>"") ) { $body.="".htmlentities($tmdb_result_array[$i]['original_title'], ENT_QUOTES, "UTF-8")." (".$tmdb_result_array[$i]['release_date'].") (TMDB ID: ".$tmdb_result_array[$i]['id'].")
"; } if ( ($_GET["tmdb_id"]<>"") && ($_GET["tmdb_id"]==$tmdb_result_array[$i]['id']) ) { $tmdb_result_cast = $tmdb_V3->movieCastArray($_GET["tmdb_id"]); usort($tmdb_result_cast, makeSortFunction('order')); for($j=0; $j < count($tmdb_result_cast); $j++) { $body.="   Name: ".htmlentities($tmdb_result_cast[$j]['name'], ENT_QUOTES, "UTF-8")." Role: ".htmlentities($tmdb_result_cast[$j]['character'], ENT_QUOTES, "UTF-8")."
"; } $body.="   

"; } } } break; case 2: if (TVDB_API_KEY<>"TVDB_API_KEY") { $body.="

TheTVDB.com (Search Original Title: ".htmlentities($tvbd_search_original_title, ENT_QUOTES, "UTF-8").")

"; $tvdb_result_id_array = array(); for($i=0; $i < count($tvdb_result); $i++) { $tvdb_result_object = $tvdb_result[$i]; $tvdb_result_array = object_2_array($tvdb_result_object); if(in_array($tvdb_result_array['id'],$tvdb_result_id_array)) { } else { $tvdb_result_id_array[]=$tvdb_result_array['id']; $body.="".htmlentities($tvdb_result_array['name'], ENT_QUOTES, "UTF-8")." (TMDB ID: ".$tvdb_result_array['id'].")
"; if ( ($_GET["tvdb_id"]<>"") && ($_GET["tvdb_id"]==$tvdb_result_array['id']) ) { $tvdb_result_cast_object = $tvdb->getActors($_GET["tvdb_id"]); $tvdb_result_cast_array = object_2_array($tvdb_result_cast_object); usort($tvdb_result_cast_array, makeSortFunction('sortorder')); for($j=0; $j < count($tvdb_result_cast_array); $j++) { $body.="   Name: ".htmlentities($tvdb_result_cast_array[$j]['name'], ENT_QUOTES, "UTF-8")." Role: ".htmlentities($tvdb_result_cast_array[$j]['role'], ENT_QUOTES, "UTF-8")."
"; } if ($_GET["parent_id"]<>"") { $tvdb_result_episodes_object = $tvdb-> getSerieEpisodes($_GET["tvdb_id"],TVDB_LANGUAGE); $tvdb_result_episodes_array = object_2_array($tvdb_result_episodes_object["episodes"]); foreach ($tvdb_result_episodes_array as $tvdb_result_episode) { if ($tvdb_result_episode["season"]==$_GET["season"]) { if ($tvdb_result_episode["number"]==$_GET["episode"]) { foreach ($tvdb_result_episode["guestStars"] as $tvdb_result_episode_gueststar) { $body.="   Guest Name: ".htmlentities(trim($tvdb_result_episode_gueststar), ENT_QUOTES, "UTF-8")." Role: 
"; } } } } } $body.="   

"; } } } } break; } $body.="
"; $body.="

back

"; echo ($body); } ?>


 have fun ... and stay tuned for the importer ...


#15

Another +1 for editable cast, for other reasons - HOME MOVIES.  I love being able to fill out the tag lines and descriptions for the Home vids - makes it look really professional when showing to the rest of the family.  Country, Genre, Collection, Year takes care of most of the sorting, but I really need that last piece - the people in the vid.  I could use Writer or Director, but actor is the right place to sort the people in the vids.

Interesting though, I did manage to fill out an actor on one of my home movies, but I have no idea how I did it - and now I can't undo it.


#16

+1 for cast editing

thanks for the great work!

-raf


#17

have fun ... and stay tuned for the importer ...

Are you working on some sort of tool other than using PHP? I've got some experience working with Perl and Python and would be interested in something along those lines. If not, I'll use your code as a jumping off point to write something else, probably just command line to start with. Not being able to edit cast members is my one gripe with Plex at this point.


#18

I would like this as well. The other day I wanted to see which movies in my collection had Jake Gyllenhal in them and it returned 0, but I know I have like 3 or so. I would be fine if it listed the top 5 biggest names, but too often it doesn't list the big name actors. 

Instead I have a humongous list of actors and I only recognize 60% of them or so. 


#19

1 to editable cast as well

I am also not getting the cast or even correct info at all on a lot of my films, and when I correct them they seem to change back a week later...thinking xbmc again...even though I have paid for this


#20

Hi

Not long been using plex. On the whole a great experience but yes this is a glaring omission. Just added Elysium and Matt Damon isn't even show as one of the cast??

+1 here!