-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Add the ability to store more than one online id #10000
Conversation
not only phil65 wanted this but whole nations if devs :) |
I was probably the one who annoyed phate long enough. :) |
@phate89 can you describe more the feature ? Imdb number is used by nearly all remotes to either link to imdb or gather additional data. Is that value still populated ? How does updating this field via json / nfo update the copy in unique ids ? And describe the JSON part that you wanted to implement ? If it's only pairs of values, then the ids should be an object with 2 values like type / value and uniqueid be uniqueids and return an array of those. cc @Montellese Edit : Nice 10000 PR number |
right now you have a "imdbnumber" field but you don't know what it contains. might be the imdb id or tvdb id or whatever the scraper set it. With this feature kodi will allow more than one uniqueid and also have a name to define it (so we now know where the id comes from). |
3b942da
to
7c0f95f
Compare
Well uniqueid that contains multiple ids is a strange name ;) But yes this covers an often asked feature :) About json you need to think also about parsing and documentation. Proposal is it's an object that's all. No real definition no way to validate or really know what it returns. Fixed defintion and arrays allow control and documentation. We can define what is the type of the keys and what is the type of the value too. Same for filtering how would you define a filter on those without a definition ? Find movie with imdb xxxx or movies with a trakt id. Anyway @Montellese call but I really do not think "object" is a correct way to describe an arrays of pairs. |
Why a complex structure is better to validate? More simple it is easier it is. There's no way to get wrong a list of pairs It's already done for every property...It's actually harder and more error prone a complex object.. More you nest the info easier is to make a mistake.. |
I don't think it makes a real difference whether it's an object or a array of string pairs in this case. The object is well defined because a property name is always a string and the API definition states that any additional property must also be of type string so you definitly know what the types will be. And looping over all properties in an object or looping over an array of pairs isn't that different either. It might have been better to call the property "uniqueids" instead of "uniqueid". But that and changing it to an array would be backwards incompatible. I'm not sure if anyone is already using this so that might not be such a big deal. |
Since already a few incompatible changes for 17 it's time to do things right :) If going the object road, then we need to go the same as art, and still create an object type and an object.set type to allow proper updating and removing of values to try to stay consistent. Or define a way to add / update & remove properties. About filtering how can it be handled ? I see a simple usage of get all movies with a trakt id to sync watched statuses. |
b65602f
to
75252ca
Compare
I still don't understand (except for filtering that I don't know) where exactly is the problem with a very simple structure like @Montellese when you have some time (no hurry since the current window is closed) can you do a review? |
@phate89 there's some misunderstanding here ;) Art and your proposal are the exact same things, art just have some default fields set up and IMO your solution should have imdb by default since we have a default field imdbnumber. (And surely all the others you handle by default in the upgrade process) Anyway arts defines "Media.Artwork" and "Media.Artwork.Set" and as you can see they have a big difference, set type allow null value for a field to delete it. Since your define says string min len 1 you can't use null to delete an entry and your code does not support it too. https://github.com/xbmc/xbmc/pull/10000/files#diff-bc14ddc0bd64f94097c9f8c3cf871345R1152 Does not provide a proper way to remove / update / add entries. Look at how art are updated. Same you take the uniqueIds passed as argument and set that as new value, dropping every other value. (including imdbnumber is the app update the 2 at the same time) Artwork works the correct way, you can pass just one artwork and this one will be added / updated without breaking all the others. Current proposal does not allow proper handling of this data as it requires any consumer to first get the previous data, play with all then send the full value, not how other things works and not error prone at all. And last thing about your upgrade process, the fact that current scraper on a folder is X does not sounds enough to be sure about the current value of a field, scraper can have been changed or user can have used nfos that will may prevail for that field. |
Excellent new feature! I'd love to see this with music database as well in the future! Having ID's for different sites would be really useful. |
Art has that unique method but all the string lists are handled in this way. They replace the entire content with what you provide. So you can delete / add / change what you want..Just like you doit for genres, directors etc etc etc.. If that's not " a proper way to remove / update / add entries" half of the fields are the same..
we had as default field imdb. After this change scraper will set as default whatever they want.
Of course users could have changed it with nfo or json but that's a very corner case. The alternative is to identify only imdb tags and everything else is "unknown". it's 99.9% accurate |
A string list is not a list of pairs. You can not compare apples and oranges. Obviously when you change the genres of something you change all the genres as genre is a single entity. Uniques Ids are exactly like art, they are a collection of different data related to different things. With the only common thing being to be unique ids. An addon that manage discart should not have to worry about another addon that deals with fanarts. It's different because it's a completely different use case. Art is not a single entity it's a collection of entities managed by different process / addons / entities / whatever. An addon / software that wants to deal with it's own pair should not have to be worried about the others. And since art usage = uniqueid usage, then they should behave the same. Handling uniqueid as a single entity is wrong considering the goal and definition of uniqueids. About default / history IMDB :
So either remove the update function, and then the get as in all case there's already a few incompatible changes. Or consider it's another argument for the problem of current implementation. About migration : EDIT : And BTW genre / directors / ... are all arrays ;) |
It's different because you decided to?
Genre is a collection of entities.. genres.. They're composed of a single property, the name but is still a list.. You can't say it's a nice api where you have all the fields in a specific function that simply put what you set in the fields except with a field that behave in a completely different way
No. It replace everything but it checks that the default one is still there. If there isn't it's added back. I'm not sure if I also have to force the old value |
Ok I give up, you have made your mind, and think different things are equals and equals things are different. If it's not different then why art was made like that ? Are uniqueids more like genre or like art ? Answer is quite easy to find. If you do not see the difference between an array of strings (array = 1 object) and an object that contains a list of unrelated objects. Or the fact that all genres are genre but that an imdbid is not a tmdbid I can't do anything about that. I'm just giving facts, genre / directors are an array of same object, art is a collection of unrelated things, a discart have nothing in common with a fanart. Same for uniqueid a tmdb have nothing in common with an anidb id. An addon could even store a full url as a value for an unique id. And as I said genre / ... are all arrays ;) So preaching for my first proposal if you say it's like genre. No arguments will change your mind I get it, personally I do not care as I will never write those fields, but at least there's a written arguments when problems will arise. And your proposal does not fit anything currently present in Kodi. It's neither an array that overwrite or an object that properly update it's part. @Montellese will have the last word let's hope he have time to read all. |
you wrote hundreds of lines and you actually never bring an actual problem. Of course if someonelse agree with you especially montellese I'll switch immediately too.. |
The problem is consistency and logic and usability. Genre is an array of string, from API point of view setting an array value set all the values. uniqueId is an object, setting a property of an object should not erase all other properties. From an SQL point of view, settings a field to X update that field and not the others. uniqueId is not a field it's a collection of fields setting one of those field should not erase the others. Current implementation will generate for sure problems where API consumer will delete other's data. It's not logical that someone that want to manage it's own data have to take care of other's data and users will not take care and delete the other's data. Art are handled this way because of that. It would be insane to have anyone deleting others random data. Implementation requires getting the values, check all pairs key update then resend the whole data. If the consumer have encoding problem then all data is corrupted. And users will never understand why an app A broke app B and will blame either Kodi or app B, not app A. When a user use a tool that update a movie genre it expect the genre to be to the new value, if he makes a mistakes he understand. A user try a trakt addon to sync it's watched status, then he loose all the other data, he will never understand the problem. |
@phate89: The way artwork works has been discussed a lot and it was the best approach that we could come up with because certain add-ons only care about certain artwork types and they don't want to look and or mess with any of the other artwork types. So the API is done in a way that such an add-on can simply provide a single type of artwork and not care about the current state of the rest of the artwork at all. IMO for uniqueids the artwork approach applies because e.g. the trakt add-on shouldn't have to care at all about any other uniqueid. It should simply be able to add and/or remove the "trakt" unique id to any video without having to know if the video also has an imdbid or a tmdbid assigned. The discussion is completely independent of whether the type in JSON is a list of strings or an object or a list of pairs of whatever. It's solely about what the type represents and about who is interested in doing what with that type. |
if (ParameterNotNull(parameterObject, "uniqueid")) | ||
{ | ||
std::map<std::string, std::string> uniqueids; | ||
for (CVariant::const_iterator_map rIt = parameterObject["uniqueid"].begin_map(); rIt != parameterObject["uniqueid"].end_map(); rIt++) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
e02ca10
to
4e0e8be
Compare
@Montellese I updated the pr with something similar to artwork.
|
Actually if I'm not wrong for rescraping/refreshing it does a new search from name.. it's used for searching art (but we can request it there). The only difference is for skinning labels /python listitem. In that cases it won't always be available (only if we request full details) |
uniqueids[idEntry->later().first()] = idEntry->later().second(); | ||
} | ||
item->GetVideoInfoTag()->SetUniqueIDs(uniqueids); | ||
} |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
{ | ||
if (type.empty()) | ||
type = m_strDefaultUniqueID; | ||
m_uniqueIDs[type] = uniqueid; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
fa9cbe0
to
6b69484
Compare
Anything left to get this in? :) |
I'm checking if I can remove uniqueid from views... @Montellese I checked and refreshing and getting art works even without uniqueid in the view..The only difference is that now you can't always get imdbnumber via GetProperty (before was in the view so it was always available).. |
Since I'm not 100% sure we can drop the uniqueid because our upnp stuff might need I'll start to go with the reviewed part.. We can do the rest later.. |
IIRC UPnP only retrieves the uniqueid to be able to pass it to the UPnP client. But this information is only interpretable by a Kodi UPnP client as it's not part of the standard. |
@Montellese but it isn't used in your work for upnp importing or to provide kodi clients a way to scrape the info? |
@phate89: Well in one of my attempts to provide handling for multiple identical items from different sources (files, upnp, ...) I'm using the IMDB number to try to match items more reliably but that is heavily outdated. I might also be using it in my UPnP import work to find and match tvshows coming from UPnP with tvshows in the local library but I'm not 100% sure. But don't let this be held up by work that isn't ready and that I didn't have time to work on for months. |
if (ParameterNotNull(parameterObject, "uniqueid")) | ||
{ | ||
CVariant uniqueids = parameterObject["uniqueid"]; | ||
for (CVariant::const_iterator_map idIt = uniqueids.begin_map(); idIt != uniqueids.end_map(); idIt++) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@Montellese I also split to get in at least the feature before the windows closes.. I can always pr after the second part.. |
jenkins build this please |
Jenkins build this please |
Right now online ids are pretty useless. There's no way to know where are they from. Since there are always more addons that needs to identify episodes, tvshows and movies with online info I thought to add a way to store those values in the db (from scrapers and addons).
I used the structure created from #1549 and I joined m_strIMDBNumber and m_strUniqueId in a map that can contain more than one online id.
At start I thought to move the id to details (to avoid yet another join in the views) since it's not a common display info but is already linked in LISTITEM_IMDBNUMBER (imdbnumber) so this will break current behavior. Is imdbnumber property really used?
When kodi upgrades the database it checks if the existing online id starts with "tt". If it does it sets the type to "imdb". It's the only type i can safely recognize from the id. If you know other types please tell me.
I'm not sure how to handle editing of online ids via json. there are 3 options (the default one is the one used from the scraper):
@phil65 is this what you wanted? ;)