Kodi Community Forum
New DB Structure for all libraries + DBs [update 2015 06 13 / Released SQL 1.3] - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+--- Thread: New DB Structure for all libraries + DBs [update 2015 06 13 / Released SQL 1.3] (/showthread.php?tid=200911)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20


RE: New DB Structure for all libraries + DBs [update 2014 09 07] - da-anda - 2014-09-10

who said that the API has to work with asset IDs? It could also use the unique IDs for the related file record and send info duplicated (backwards compatible), so we would be just where we are now. But let's not focus on APIs here - let's first get a clean and sensible DB layout. And such a drastic change in DB structure will in any way break backwards compatibility of APIs up to a certain degree - at least if client wants to use the new features. There could be a compat mode Kodi side though.


RE: New DB Structure for all libraries + DBs [update 2014 09 07] - Tolriq - 2014-09-10

Who said I talked only about API ? (Was only an easy sample)

I only try to remember all the usages currently and future (synchronization, profiles) so they are not forgotten during the db layout.
As I said already you can't build a layout without knowing all the targets that it must cover if you want to avoid hacks at some future steps when finally a "oups we forget this happens".

Things easy to forget when not thinking large enough, profiles and permissions. If you set permissions on asset, what about kids profiles having access to an unrated version of a movie with scene that are not suitable for them ? (And it's only a very simple thing, there's plenty to think of to achieve the correct goal)

Seeing a layout being built here with tons of different point of view, without a validated target will be source of problems. Now you can ignore my advice I will not be blessed but at least I tried Smile


RE: New DB Structure for all libraries + DBs [update 2014 09 07] - spcano01 - 2014-09-10

Gotta agree that new DB is needed, even at expense of duplicate copies/versions of same movie. Make it two movies, or two versions of same movie...don't really care. I don't want TOO much "required" that this doesn't move forward with what has been discussed already. It's already a HUGE improvement over existing, and if we can handle that - I'm sure we can add future functionality easier as well. Not to be confused with going at this half-assed...just saying that we can always find a reason NOT to do something. I would love the idea of PLEX, but really couldn't figure out how to get it up and running. Tried multiple times with homebuilt NAS and Synology one. But the XBMC DB just works, and I love the XBMC itself.

My 2 pesos...

(2014-09-10, 09:52)pecinko Wrote:
(2014-07-29, 19:09)m.savazzi Wrote: The original point was to have the possibility of using different DB servers as shared library among different XBMC.
In addition to optimize how the DB is managed (real transactions, one connection to db non thousands, etc..).

This lead to me thinking a new, simple but very flexible db structure to host all possible contents.

First of all many thanks and good luck with the project, I hope you'll manage to pull it off.

Some thoughts, in no particular order:

* It might be interesting to take a look at Plex media server (PMS) as well. HTPC client runs on XBMC fork after all and is open source. PMS is not open BUT, it uses SQLite DB and REST API is available via server_ip:32400/library. Thus, you should be to get a pretty good picture about what's going on. DB itself supports pretty much everything that is/was discussed here with exception of profiles. This is just in case you find it useful, not to say this DB is worse or better than MediaPortal/Browser's.

* Centralized server / distributed model / local content: I can see the point of local library when media is hosted on HTPC itself or attached USB disk as well as for centralized model running some kind of Kodi server.

So, how about leaving Kodi (client) local library as is with a possibility to announce it's media on LAN via UPNP or something else. In addition, for those who want it, there can be separate app, Kodi server, that could run on a separate PC or NAS. This one could offer more advanced library, manageable via web interface. For those wanting advanced library but not wanting to use server/NAS - they can install Kodi server locally, on the same HTPC.

This way we don't need to worry about library upgrade on Kodi and server app can be made and tested independently. Less savvy users can stick with what we have now if they prefer or if they find installing Kodi server app to complicated.

* Different movie versions, HD/SD etc - I would sacrifice this (and alike niche features) in a moment in order to simplify things and help library improvements get finally implemented.

Once again, thanks and good luck mate.




RE: New DB Structure for all libraries + DBs [update 2014 09 07] - phate89 - 2014-09-13

There is another wrong relationship.
A file could be more than one episode.
For example:
Lost.S01E01-02
In this case the file is both lost season 1 ep 1 and lost season 1 ep 2


RE: New DB Structure for all libraries + DBs [update 2014 09 07] - m.savazzi - 2014-09-13

(2014-09-09, 07:57)Montellese Wrote:
(2014-09-08, 20:40)phate89 Wrote: But in this way don't you have 2 times the movie in the database with all scraped info with 2 different ids?

(2014-09-08, 22:17)m.savazzi Wrote: At program level you can simply add the details to the first version and copy them to the other or even not copy just leave the second record empty

IMO if a DB design results in (obvious and predictable) duplicate information there is something wrong. In the case of multiple versions of the same movie / asset IMO it makes more sense to detect this situation during library scanning and then linking the new file to the existing movie / asset instead of always retrieving both assets (with different database IDs) and then having to match multiple versions of the same asset every time they are shown in the user interface.

Correct and this is NOT the case. Director's cut and Theatrical are TWO different movies, they have different poster, etc... They have different Runtime, different Year, etc...
The IMDB ID is different.

On the other side is true that they share a set of common information like Artists, director, etc...
What I mean to write is that the DB Structure is smart enough to handle this situation avoding duplicated info.

(2014-09-09, 07:57)Montellese Wrote: I'm actually working on this with the current DB layout and I added a table that links files to media items and during library scanning it detects "identical media items" (for movies it uses the title and year or imdbid). Then when retrieving all movies you get an item for every version of a media item (with the identical database ID and the identical metadata but with different file details like streams) which you can easily go through and put together all items with the same database ID (no additional complex logic that slows down the listing necessary) into a single item that is then presented like a movie set

Good. In the new DB we can do the same using the Version table so we avoid duplications.

Example:
Version 1 of movie Foo:
foo - part 1.mpg
foo - part 2.mpg

Version 2 of movei foo:
foo.mkv

In this way we will have
File 1: foo - part 1.mpg
File 2: foo - part 2.mpg
File 3: foo.mkv

Asset 1: foo
bound to file 1, file 2
Asset 2: foo
bound to file 3

Version table: asset 2 bound to asset 1

So we will NOT duplicate common information on 2 as we already have one. On 2 we will add the video and audio track info.


(2014-09-08, 20:40)phate89 Wrote: Also about the watched status i think should be related to the episode, movie etc etc. It's the episode/movie itself that i watched not the specific file. If i have 2 versions of the file and i watch the first the 2nd should also result watched. Also if you remove a watched episode or movie and then you add it back the asset will be deleted and created so the episode will result unwatched, however since the episode entry won't be deleted the database will already have the watched status.

(2014-09-08, 22:17)m.savazzi Wrote: At program level you can simply add the details to the first version and copy them to the other or even not copy just leave the second record empty

Watched is associated to the asset so if you watch the Director's cut but not the theatrical movie it will be recorded correctly Smile

If you watch the first the second should not be marked as watched OR if you want to have it watched the program can do it. This is a lot of freedom for Kodi Smile

IMO this is something that should be definable by the user i.e. the user should be able to choose whether watching the standard version of movie X should also mark the director's cut version of the same movie X as watched or not. Therefore it should be linked to the specific file and xbmc/kodi can implement the necessary logic to do it the way the user wants. That "freedom" is not possible if the watched status is linked to the media item / asset.
[/quote]

Not correct. As explained in the example we will have
Asset 1: foo
Asset 2: foo
Version table: asset 2 bound to asset 1

If user wants to have separate view state in the AssetViewed table you will havbe
Asset 1: viewed true
Asset 2: viewed false

If you want to have a single viewed state there are 2 options either when you update the viewed state you use the Version table to update all status at once OR you use only viewed 1 to update AND you use version table to retrieve Always asset 1 status when querying.
I like more the first as if user decides to switch from one mode (all the same) to the other (each asset it's viewe state) the user experience is better.

It's a freedom for Kodi code.

(2014-09-09, 11:08)phate89 Wrote:
(2014-09-09, 07:57)Montellese Wrote: IMO this is something that should be definable by the user i.e. the user should be able to choose whether watching the standard version of movie X should also mark the director's cut version of the same movie X as watched or not. Therefore it should be linked to the specific file and xbmc/kodi can implement the necessary logic to do it the way the user wants. That "freedom" is not possible if the watched status is linked to the media item / asset.

But what are the chances it will become an option? Usually small options like this will never go into mainline (and it's probably a good thing).
Btw i agree as i said before about the duplicate movie. Sometimes some sort of duplication is allowed to simplify the db and speed up access but in a media database movie is a major resource and it must be unique. Also it would be great if in the future kodi will not show twice the episode if we have 2 versions of it or we renamed it and not yet clean the database (it happens to me A LOT) and prompt a choice list after but that's probably part of the kodi code more than the db..

(2014-09-09, 11:27)Tolriq Wrote: Do not forget that the final plan is synchronization.

Same database ID for multiple media with different path could generate troubles for syncing watched status for the case of different watched status per media quality. (Specially with path translations or direct / indirect access ).
Not talking about remotes that will now have to deal with multiple path for a same ID, that will be complicated like hell to do offline download and sync.

But I'd also avoid the mess of Tv Shows with multiples ID per path with group by name that are well ... Wink

Not sure there's an easy an optimal way to address this without major impacts, like for remotes Player.Open movieid 1, what file start ? Ask on the client ? Need to add the path first needing to ask the user at the remote side ?

Have not yet check the db proposal, but files / path or anything should be the object linked to physical details and description ... And we could use some kinds of collations to link the movies together like sets.


This is why I wrote in post 1 that the files are identified via the CRC32! this is independent from the file name BUT is very time/disk consuming if the OS is not able to provide it on the fly. Otherwise we should rely on file name.

There could NOT be multiple database ID for the SAME file. It's a nonsense and an error at Kodi level.

If I rename a file it old File x record should be removed OR (if possible) Updated.

(2014-09-09, 11:27)Tolriq Wrote: Have not yet check the db proposal, but files / path or anything should be the object linked to physical details and description ... And we could use some kinds of collations to link the movies together like sets.

Please check the DB as this is very well addressed Smile

(2014-09-09, 14:02)jjd-uk Wrote: The support of multiple versions of one media item is certainly coming, as it's absolutely necessary for Montellese work in allowing media from multiple sources being added to the Library. For example you might have the same movie in:

1. HD version in local Library
2. SD version from UnPnP source e.g. tablet
3. Bookmarked in an addon

With Montellese's work from what I understand then all three of the above could be added to the Library.

So the question is then to what to present to the user? From what I understand concept similar to Movie Sets is seen as the best option, so you will see a single item for that movie, select it and you will then be shown the different versions. With Theatrical and Director versions I'm not sure what the plan is, I guess until there's some way for the scraper to support this then it would be similar to the moment with duplicate looking items being shown, but like now I again guess that you might be able rename how they are displayed e.g. "Film - Theatrical Cut" and "Film - Directors Cut".

Correct is the Version table that binds the three assets. At this point Kodi is free to show them as the user likes.
They can be shown as three movies, as one folder with three assets as three episodes... it's up to Kodi.

The DB will simply have all the correct info (with no, or minimal duplicated info) and very easy ways to recover them

(2014-09-09, 14:36)phate89 Wrote: Is it the best way to handle them as movie sets? In any view available you will have 3 items with same artwork, same title and only different stream details. Very confusing and not very immediate IMO..
Why not something similar to the bluray playlist selection with movie info? Kodi can compare them and simplify it in "sad version", "hd version" and "addon version".
About director's cut if the scraper supports it it's not hard to search "director's cut" or something like this in the file name but in this case we need a "version" attribute that the scraper can fill with the version name if they find it

The DB allow Kodi code and the user to decide what to do. Using version table you have a lot of freedom for example you can decide that Asset 1 will have poster, fanart and all other info and all other Assets versions will not have any info
OR
you can decide that Asset 1 are the defaults for all versions BUT a version can have a different fanart
OR
you can decide that each version will have it's own set of details.

As said the DB supports all of this in an easy way. Kodi should decide how to interact with the user.

(2014-09-09, 15:35)Fice Wrote: I think we should store additional information in the link from a file to an asset, as we have three situations where one movie might have several files.

A) If we have a 1 on 1 local copy from a UPnP source, there is no need to show two entries. And if one of them is watched, all of the copies should be marked as watched as well. (The link from file to asset should probably containt a foreign key to the original file?)

Using CRC32 there will not be 2 files/assets as they are the same
Using filename there could be 2 entries and the user or some Kodi logic should bind them together with the versions table. They can be "local" and "remote"

(2014-09-09, 15:35)Fice Wrote: B) If we have to different versions (uncut versus directors cut) then we should probably show them as a set and if one version is watched, doesn't mean we should automatically mark the other as watched as well (perhabs make it a setting). (The link from file to asset could probbly contain some metadata that is likely to differ: duration/PG rating/Year?!?)

explained before how it works. All possible scenarios fully supported.

(2014-09-09, 15:35)Fice Wrote: C) The same movie, the same version but different qualites. Is there a need for the user to select the qualities? Just play the highest quality the device can play. Would a user actually prefer SD over a HD? Not sure about 3D vs. non 3D version though. (Don't have a 3D tv)

As above, fully supported.


RE: New DB Structure for all libraries + DBs [update 2014 09 07] - phate89 - 2014-09-13

edit: still answering


RE: New DB Structure for all libraries + DBs [update 2014 09 07] - m.savazzi - 2014-09-13

(2014-09-09, 16:33)phate89 Wrote:
(2014-09-09, 15:35)Fice Wrote: C) The same movie, the same version but different qualites. Is there a need for the user to select the qualities? Just play the highest quality the device can play. Would a user actually prefer SD over a HD? Not sure about 3D vs. non 3D version though. (Don't have a 3D tv)

We need to le the user chose if mark as watched all the versions of the same movie but we won't let him play his sd file even if he wants to?
There are several reasons to have sd versions like bandwidth, different dubbing, different crop (i have some disney bd with it's dvd version because they did a poor job cropping only to have them in 16:9) and decoding limitations (even more now since hevc is rising and is only software).

Yes, fully supported as explained in previous example.

(2014-09-09, 19:36)Tolriq Wrote: Same problem for remotes Wink

Maybe different version needs to have some kind of a TAG representing the version difference, this would allow to play all with same tag, and remotes to play a movie ID with default TAG, or queue specific tag to not have to deal with path on client side to differentiate items.

Tags table is bound to Assets. If you add tags you can do filtes on that. It's another level of freedom.

(2014-09-10, 06:58)garbear Wrote:
(2014-08-30, 12:13)m.savazzi Wrote: Requests:
1) RetroPlayer being mainlined sooner or later might as well consider adding stand-alone games and game ROMs launched via emulators into the scope of the database model right away as well.
a. Added: Games are just an asset. Please let me know which properties we need specific for a game

from https://github.com/garbear/xbmc/blob/retroplayer-13.1/xbmc/games/tags/GameInfoTag.h

the fields I use in Game info tag:
  • File path
  • Title
  • Platform
  • Game Code (unique ID embedded in ROM)
  • Region
  • Publisher / Licensee
  • Format (PAL/NTSC)
  • Cartridge Type, e.g. "ROM+MBC5+RAM+BATT" or "CD"

I started with these fields because they can be populated directly from the ROM's data. you could get ideas about fields to add from thegamesdb.net (http://thegamesdb.net/game/1318/ ) like player count, release date, etc

keep in mind that another layout is needed for save states. the example save state database i created had fields for savestate path, rom path, rom CRC and gameclient used to create the savestate.

Great!
Will add them in the DB and the save state

(2014-09-10, 13:07)Tolriq Wrote: The choice about 1 ID per real media or 1 ID by meta data is a db layout issue and this choice impact all the rest.

And yes obviously anything is possible with code, but some things are efficient some are not, and efficiency should be think about during db layout definition, since usage drives the layout.

If ID does not represent unique media then synchronization becomes complicated, and tons of things too and this should not be forgotten before stopping at the basic case when press play what happens.
(Of course could also be addressed as media ID and file ID, and with files CRC, file renaming could keep the file ID and correct adjustment to API / internals could be a solution).

But please as always in this thread think more global.

Asset ID IS the unique media id.
An asset CAN be composed by different files (movie foo - part 1, movie foo - part 2)
File ID is unique per physical asset (independently is if local, remote, UPnP, web, etc)

So we have no issues there.

(2014-09-13, 01:39)phate89 Wrote: There is another wrong relationship.
A file could be more than one episode.
For example:
Lost.S01E01-02
In this case the file is both lost season 1 ep 1 and lost season 1 ep 2

The DB fully supports this

In this case the structure will be:
File 1: Lost.S01E01-02

Asset 1: Lost Series 1 Episode 1
bound to File 1

Asset 2: Lost Series 1 Episode 2
bound to File 1

Quite straight forward.


RE: New DB Structure for all libraries + DBs [update 2014 09 07] - phate89 - 2014-09-13

(2014-09-13, 11:30)m.savazzi Wrote: Correct and this is NOT the case. Director's cut and Theatrical are TWO different movies, they have different poster, etc... They have different Runtime, different Year, etc...
The IMDB ID is different.

On the other side is true that they share a set of common information like Artists, director, etc...
What I mean to write is that the DB Structure is smart enough to handle this situation avoding duplicated info.
It's not true.
First of all they have the same imdb id:
http://www.imdb.com/title/tt1411250/?ref_=nv_sr_1
as you can see same id SAME MOVIE 2 different lengths.
You can't say director's cut is a different movie. It's just wrong. It's the same movie..Often it's even in the same bluray and they share 90% of the video. It's only a different version of it. It's a big design flaw to let the same movie twice in the db...

(2014-09-13, 11:41)m.savazzi Wrote: The DB fully supports this

In this case the structure will be:
File 1: Lost.S01E01-02

Asset 1: Lost Series 1 Episode 1
bound to File 1

Asset 2: Lost Series 1 Episode 2
bound to File 1

Quite straight forward.

Not according to the graph.
You have an asset that can have more than one file. One to many. Not the opposite..


RE: New DB Structure for all libraries + DBs [update 2014 09 07] - m.savazzi - 2014-09-13

(2014-09-13, 11:40)phate89 Wrote:
(2014-09-13, 11:30)m.savazzi Wrote: Correct and this is NOT the case. Director's cut and Theatrical are TWO different movies, they have different poster, etc... They have different Runtime, different Year, etc...
The IMDB ID is different.

On the other side is true that they share a set of common information like Artists, director, etc...
What I mean to write is that the DB Structure is smart enough to handle this situation avoding duplicated info.
It's not true.
First of all they have the same imdb id:
http://www.imdb.com/title/tt1411250/?ref_=nv_sr_1
as you can see same id SAME MOVIE 2 different lengths.
You can't say director's cut is a different movie. It's just wrong. It's the same movie..Often it's even in the same bluray and they share 90% of the video. It's only a different version of it. It's a big design flaw to let the same movie twice in the db...


Can you help me on IMDB. I'm not able to find the "normal" and the "director's cut" it just shows me the "normal" version.

With regards to being 2 movies is quite easy: if original movie is 120 min and directors cut is 150 min... they are different.
Also they have different votes, rating, MPAA, etc...
They are SOLD as two different movies, they have 2 different ISRC codes... etc...

If you check what I wrote there are NO duplications (or minimal) in case you save them as two assets so there is not a design flaw Smile

(2014-09-13, 11:50)phate89 Wrote:
(2014-09-13, 11:41)m.savazzi Wrote: The DB fully supports this

In this case the structure will be:
File 1: Lost.S01E01-02

Asset 1: Lost Series 1 Episode 1
bound to File 1

Asset 2: Lost Series 1 Episode 2
bound to File 1

Quite straight forward.

Not according to the graph.
You have an asset that can have more than one file. One to many. Not the opposite..

No
is a M:N relationship.

One File can be bound to muliple Assets: case where one file is two episodes OR if you have an ISO where there are multiple movies (I have plenty)
One File can be bound to one Assets: easy case
Multiple File can be bound to One Assets: is a multipart movie/episode.


The structure MUST cover all this scenarios in the correct way.... and it does Smile


RE: New DB Structure for all libraries + DBs [update 2014 09 07] - phate89 - 2014-09-13

(2014-09-13, 11:51)m.savazzi Wrote: Can you help me on IMDB. I'm not able to find the "normal" and the "director's cut" it just shows me the "normal" version.

With regards to being 2 movies is quite easy: if original movie is 120 min and directors cut is 150 min... they are different.
Also they have different votes, rating, MPAA, etc...
They are SOLD as two different movies, they have 2 different ISRC codes... etc...

If you check what I wrote there are NO duplications (or minimal) in case you save them as two assets so there is not a design flaw Smile
It's not true.
Actually most of blurays contains both versions. It's quite easy with bluray you split the movie into segments and have 2 different playlist combining the parts in common and the different parts. It's called seamless branching. In a bright future this could be achievable even with mkv and stacked files so you will have 2 versions of the same movie (director's and theatrical) in the same mkv file with almost the same size of a single movie (actually if we want to think very wide we should also consider this possibility)
2nd thing there are no different votes, rating, mpaa. They are the same movie. I didn't pass you the theatrical cut version. I passed the only version there is of that movie. if you open that link and go to look to the movie length you get:
Technical Specs
Runtime: 119 min | 127 min (director's cut)
There is no separate version. It's always the same movie with a different length.
OF course if they are sold separately they have a different code but also dvd->bluray version have different code, remastered has a different code. I lost count of how many star wars different versions went out. 6? 7? But we still consider them the same movie in all these cases.

(2014-09-13, 11:51)m.savazzi Wrote: No
is a M:N relationship.

One File can be bound to muliple Assets: case where one file is two episodes OR if you have an ISO where there are multiple movies (I have plenty)
One File can be bound to one Assets: easy case
Multiple File can be bound to One Assets: is a multipart movie/episode.


The structure MUST cover all this scenarios in the correct way.... and it does Smile

I'm looking to your pdf and the relationship from asset to files is one to many


RE: New DB Structure for all libraries + DBs [update 2014 09 07] - m.savazzi - 2014-09-13

(2014-09-13, 11:59)phate89 Wrote:
(2014-09-13, 11:51)m.savazzi Wrote: Can you help me on IMDB. I'm not able to find the "normal" and the "director's cut" it just shows me the "normal" version.

With regards to being 2 movies is quite easy: if original movie is 120 min and directors cut is 150 min... they are different.
Also they have different votes, rating, MPAA, etc...
They are SOLD as two different movies, they have 2 different ISRC codes... etc...

If you check what I wrote there are NO duplications (or minimal) in case you save them as two assets so there is not a design flaw Smile
It's not true.
Actually most of blurays contains both versions. It's quite easy with bluray you split the movie into segments and have 2 different playlist combining the parts in common and the different parts. It's called seamless branching. In a bright future this could be achievable even with mkv and stacked files so you will have 2 versions of the same movie (director's and theatrical) in the same mkv file with almost the same size of a single movie (actually if we want to think very wide we should also consider this possibility)
2nd thing there are no different votes, rating, mpaa. They are the same movie. I didn't pass you the theatrical cut version. I passed the only version there is of that movie. if you open that link and go to look to the movie length you get:
Technical Specs
Runtime: 119 min | 127 min (director's cut)
There is no separate version. It's always the same movie with a different length.
OF course if they are sold separately they have a different code but also dvd->bluray version have different code, remastered has a different code. I lost count of how many star wars different versions went out. 6? 7? But we still consider them the same movie in all these cases.

Well for me if a movei has diferent Runtime is a different movie... but I'm ok with your view.
The DB supports it with no issue with 2 assets.

I think I have more than 15 Star wars (original) copies between VHS, SCD, DVD, Bluray, etc... Smile



(2014-09-13, 11:51)m.savazzi Wrote: No
is a M:N relationship.

One File can be bound to muliple Assets: case where one file is two episodes OR if you have an ISO where there are multiple movies (I have plenty)
One File can be bound to one Assets: easy case
Multiple File can be bound to One Assets: is a multipart movie/episode.


The structure MUST cover all this scenarios in the correct way.... and it does Smile

I'm looking to your pdf and the relationship from asset to files is one to many
[/quote]

Sorry, it's a mistake in the schema! Will update it!


New DB Structure for all libraries + DBs [update 2014 09 07] - phate89 - 2014-09-13

(2014-09-13, 13:13)m.savazzi Wrote: Well for me if a movei has diferent Runtime is a different movie... but I'm ok with your view.
The DB supports it with no issue with 2 assets.

I think I have more than 15 Star wars (original) copies between VHS, SCD, DVD, Bluray, etc... Smile
But that'S a flaw in the design that will cause inconsistency and makes harder to obtain movies only. It's not hard to split assets from movies and prevent that kind of duplication leaving the different tag (like duration) to the asset or the file. Also this kind of separation is needed for montellese's work (just like the "sources" folder that is still missing) so it needs to be in the db. In this case in montellese's work you have everytime to group to find out if a movie is already in the database and it's not efficient. Also it will create inconsistency. Same movie, different art, different plot, different rating and even different genre is possible.
Why the asset have to be the movie? They are 2 different things so they should be separate in db to bring easier access and remove inconsistencies


RE: New DB Structure for all libraries + DBs [update 2014 09 07] - m.savazzi - 2014-09-13

(2014-09-13, 13:25)phate89 Wrote:
(2014-09-13, 13:13)m.savazzi Wrote: Well for me if a movei has diferent Runtime is a different movie... but I'm ok with your view.
The DB supports it with no issue with 2 assets.

I think I have more than 15 Star wars (original) copies between VHS, SCD, DVD, Bluray, etc... Smile
But that'S a flaw in the design that will cause inconsistency and makes harder to obtain movies only. It's not hard to split assets from movies and prevent that kind of duplication leaving the different tag (like duration) to the asset or the file.

There is now flaw.
It's very simple:
Asset 1: Riddick (Title: Riddick, Duration 119)
Asset 2: Riddick (Director's Cut) (Title: Riddick Director's Cut, Duration 125)
Version will bind asset 1 and asset 2

In this way you can have (if you want) different fanart for Riddick and Director's cut.

As said this is the most flexible way.


(2014-09-13, 13:25)phate89 Wrote: Also this kind of separation is needed for montellese's work (just like the "sources" folder that is still missing) so it needs to be in the db. In this case in montellese's work you have everytime to group to find out if a movie is already in the database and it's not efficient. Also it will create inconsistency.

I already asked to provide me examples of sources and paths but have not received them. Is not clear to me.
With the info I have and understanding I have the DB is fine in all scenarios...
can you help me understand with examples?

Let's make it like:
File 1:
path:
filename:
source:
extension:
descritpion:
library:
File 2:
path:
filename:
source:
extension:
descritpion:
library:
...
File n:
path:
filename:
source:
extension:
descritpion:
library:

so you can give me all possible cases and I will see if the DB is fine or need to be changed

can you explan better this "you have everytime to group to find out if a movie is already in the database" is not clear to me. There is no "grouping" needed-

(2014-09-13, 13:25)phate89 Wrote: Same movie, different art, different plot, different rating and even different genre is possible.

No this is not possible, and also Director's cut is not the same movie of the Theatrical. I want to have a different poster, different fanart for them.
If you do not want to use that functionality you can simply use the case where Asset 1 is the default for all.

(2014-09-13, 13:25)phate89 Wrote: Why the asset have to be the movie? They are 2 different things so they should be separate in db to bring easier access and remove inconsistencies

Asset is the parent of movie. An asset can be a movie, an episode, a game, a fanart, a game, a picture... etc...

I think you made a little confusion on that.


RE: New DB Structure for all libraries + DBs [update 2014 09 07] - phate89 - 2014-09-13

Again it doesn't matter what is the path and what is the file name. Kodi needs to store somewhere if the user wants to automatically import media from a specific kodi instance or not. If you have 3 other kodi pcs in your network and you want to automatically import from "k1" only movies, from "k2" only music and import nothing from "k3" you need a table to store it where kodi will look. Something like:
Code:
id      getmovie          getmusic
-----------------------------------------------------------------
k1        true              false
k2       false              true
k3        false             false
So k1 tells my kodi that has 2 new movies and 3 new songs? Ok kodi search k1 in sources table. From k1 the user only wants movies so I import only the 2 movies in the db.
k2 tells my kodi it has 4 new movies and 1 new song? Ok i search in sources k2. IT only wants music so i only import the new song.
k3 tells my kodi it has 2 new movies and 5 new songs? Ok i search in sources k3. It wants nothing from k3 so it will not add any movie or song.
There is a new kodi pc called "k4" that has 4 movies and 10 songs? Kodi search in the sources database but there is no "k1". So kodi will ask the user what he wants to do with the new one and store it in "sources" table so the next time it will know how to behave.
You are Italian right? If you are I can explain it in Italian so maybe we understand each other better.
Btw theatrical IS the same movie of director's. You can look everywhere and it's always one movie. Maybe they split it in versions or something else but is still logically a unique thing with eventually 2 child items. It will always have same main title, same plot, same genre, same rating between all versions and you need consistency between them and make it easy to access.
Also you know it's the same thing intrinsically, you just don't realize it.You call the relationship between asset1 and asset2 Version. But they are versions of what? Versions of a movie, of an episode etc etc..
Why you need an external relationship when you can place that "version" or "asset" or something else between file and movie? A movie can have more than one version/asset (separated by a specific tag or a specific name that could be "theatrical", "directors" or even "sd", "hd"). The version can have one or more files.
So the movie will have the intrinsics that define what a movie is and are common between them to have consistency like title, imdb id, plot, rating, genres. The version/asset will have what defines a new version. Length, version name. File will contain all files specific info. Also this will allow to connect the same asset/version to both an episode and a movie (for example "serenity" is both an extra episode of "firefly" and a movie) without duplicate info and for smart playlist it will be available the same asset/version for both tv episodes and movies and not 2 different one. Same thing with mixed playlist. In your model if you do a mixed smart playlist you will have 2 times the same file because there are 2 assets. But with a single asset you will have it only once.

The grouping part is because kodi after montellese's changes will show a list of movies and not anymore the list of "assets" to tackle duplicates. With upnp sharing it will be possible to have even 3/4 versions of the same movie in case all upnp instances has that so instead to have 4 times the same movie you will have once the movie and when you play it will ask what version to play. A lot better IMO even logically.
With separate movie/episode tables is quite easy to achieve this or even if you want the old method. You only get them with a simple select. But with your method to have a list of movies without duplicates you have to group by title and imdb id everytime you load the movie list / episode list (what montellese defined as same movie and uses to search it). Also in case of director's cut -> theatrical cut you won't be able to group them because they have different title so you will have always no matter what in 2 separate items.

(2014-09-13, 14:25)m.savazzi Wrote: Asset is the parent of movie. An asset can be a movie, an episode, a game, a fanart, a game, a picture... etc...

I think you made a little confusion on that.
I understand this. But why 2 asset can't be the same movie? why 2 assets can't be the same episode? Also do not forget that an asset can be both a movie and an episode at the same time like i said before. Asset and movies should be separated to avoid inconsistencies, dupicate infos and allow to link to each other..


RE: New DB Structure for all libraries + DBs [update 2014 09 07] - pecinko - 2014-09-13

(2014-09-13, 15:26)phate89 Wrote: Again it doesn't matter what is the path and what is the file name. Kodi needs to store somewhere if the user wants to automatically import media from a specific kodi instance or not. If you have 3 other kodi pcs in your network and you want to automatically import from "k1" only movies, from "k2" only music and import nothing from "k3" you need a table to store it where kodi will look. Something like:

Btw theatrical IS the same movie of director's. You can look everywhere and it's always one movie. Maybe they split it in versions or something else but is still logically a unique thing with eventually 2 child items. It will always have same main title, same plot, same genre, same rating between all versions and you need consistency between them and make it easy to access.

Common, you are either interested in "network kodis" or not. Thus, simple "Include network instances" setting should suffice. How would settings screen look like in your example? You have 3 Kodi instances and each can have X library sections - as you can split movies/music/pictures as a separate library sections like documentaries, comedies, home, vacation, classic etc

If theatrical is the same as director's cut why would you have both of them and not just one? I can see the reasoning in having sd/hd/3d versions of the same movie but let's not put everything with a similar name into this category.