I’ve already tried that and for this type of object The result of log(metadata) is “object of class metadata #someID” but no clues of what methods are available.
By the sounds of it you are printing out the object itself. As Gerk mentioned, you need to access the string values contained within the object to get to the output you are looking for.
If you take a look here, you will see how in the first example:
movie = MovieObject(
title = "Movie Title",
studio = "Movie Studio"
)
movie.tagline = “Movie Tagline”
The last line should give you the hint you need. If you can set the object's attributes like movie.tagline = "Movie Tagline", you can (usually) print it the same way.
So given your metadata object is named obj...
Log(obj.title)
Log(obj.url)
Log(obj.thumb)
should give you the values of the selected object's attribute.
OK thanks for both of you trying to understand my problem. Perhaps my question is not clear enough because I already know what you have suggested.
My question is how to know the attributes names when the class is not documented ? Python documentation speak about dir(object) or object.__dir__, but it don't seems to work with metadata and media object.
That's odd. Well then your only options I think are to check the docs or look at the source file that contains the MovieObject class code.
I agree, it's definitely odd.
I ran into this issue with type first, then with help when type did not work. I have a similar need to find the type of a value stored in Data() to help solve this weird bug I'm stuck with, details are here.
I can only hope there was a good reason for them to be removed
Just of note, things were not really "removed" per se ... the channel framework is just that, it's a subset of python's stuff and only provides what it handles -- i.e. it's not full-on python with all of the built-ins intact, it's a sandboxed framework.
Just of note, things were not really "removed" per se ... the channel framework is just that, it's a subset of python's stuff and only provides what it handles -- i.e. it's not full-on python with all of the built-ins intact, it's a sandboxed framework.
Although it can make things a bit tricky when you need to detect/compare object types for troubleshooting. :( Sometimes it's not the ContainerObjects that need to be checked, it could be whether the type is str or list, or dict, etc.. Personally I'd like to see access to help() as it will give you all options and let you know what type of object you are dealing with....but that's just me. ;)
Ahh well, there's always another way to figure it out!
But documentation seems to be not complete. And we have no clue of the last update date.
For example no information about subtitles in the object description in official documentation.
Too bad we have to waste time for finding the good way to make advanced use with the API objects. Introspection functions should be restored, or main objects should have a print method to have some description in the Logs.
There's no information about subtitles because they are not supported in channels. "Printing" objects is a python limitation, not just something limited to this framework.
The documentation on the channel framework is a bit out of date, yes, but between that and the doc that we upkeep (linked up in the top area of this forum) you should have most, if not all of the information. As we run into anything different or missing from the official docs we make note of it in there.
Agent Plugins are in the doc (http://dev.plexapp.com/docs/agents/index.html) and metadata objects are described. But subs don't. It's not just a Chanel dedicated documentation for me. Ok it's out of date, I will deal with that but I didn't found in the forum the information I'm searching.
I will be very thankful if you can add in the official or missing documentation information about subtitle objects used in metadata agent.
I didn't understand your remarks "Printing objects is a python limitation, not just something limited to this framework." ?
Objects in python can implement __repr__(self) or __str__(self) methods to be able to give more information in console or in Logs. If not supporting dir() method is voluntary, the 2 previous methods could be implemented to help external developers.
I agree with what you're saying, and if I had control over it I would be interested in the same things, just trying to pass along the info of what we have to work with. In those cases the best thing is to look at the actual framework bundle for the stuff you're looking for information on. I'm also just a volunteer that happens to write channels so I don't have the power to do any of that sort of stuff.