2017-03-23, 04:54
(2017-03-21, 15:36)nulled Wrote: So I didn't know a view runs the SQL that created it every time it's accessed (but it makes sense). What I ended up doing was modifying `global_tvshows` with another column called `viewers` that I populate with the values "UserA", "UserB" or "Both".
I dropped the `tvshows` for the particular user's database and recreated it with the SQL
PHP Code:CREATE VIEW `tvshow` AS SELECT *
FROM `a_master_107`.`global_tvshow`
WHERE `viewers` = "UserA" OR `viewers` = "Both"
User A will now only see shows where it's listed in the `global_tvshows`.`viewers` as "UserA" or "Both"
Oh yeah that would work, Two things though the "userrating" wont map in that setup unless you are not using "userrating_U01" etc and all the manual work needed to apply the "viewers" field as "tvshow" view is everything a list of all eps
if you don't mind editing the DB all the time
What about editing the "tvshow" view for said user to something like this this;
I have done very little testing
Just means you will need to store the TV Shows in sub folders, Kodi wont care about that as it will merge them all
- UserA
- Both
etc.
'^smb://192.168.0.105/TV_Shows/UserA/|^smb://192.168.0.105/TV_Shows/Both/'
^ means start of line
| mean or
should be easy to get it to work with your setup
PHP Code:
CREATE ALGORITHM=MERGE DEFINER=`KODI_17`@`%` SQL SECURITY DEFINER VIEW `Kodi_U04_Video_107`.`tvshow` AS SELECT
`Kodi_U01_Video_107`.`global_tvshow`.`idShow` AS `idShow`,
`Kodi_U01_Video_107`.`global_tvshow`.`c00` AS `c00`,
`Kodi_U01_Video_107`.`global_tvshow`.`c01` AS `c01`,
`Kodi_U01_Video_107`.`global_tvshow`.`c02` AS `c02`,
`Kodi_U01_Video_107`.`global_tvshow`.`c03` AS `c03`,
`Kodi_U01_Video_107`.`global_tvshow`.`c04` AS `c04`,
`Kodi_U01_Video_107`.`global_tvshow`.`c05` AS `c05`,
`Kodi_U01_Video_107`.`global_tvshow`.`c06` AS `c06`,
`Kodi_U01_Video_107`.`global_tvshow`.`c07` AS `c07`,
`Kodi_U01_Video_107`.`global_tvshow`.`c08` AS `c08`,
`Kodi_U01_Video_107`.`global_tvshow`.`c09` AS `c09`,
`Kodi_U01_Video_107`.`global_tvshow`.`c10` AS `c10`,
`Kodi_U01_Video_107`.`global_tvshow`.`c11` AS `c11`,
`Kodi_U01_Video_107`.`global_tvshow`.`c12` AS `c12`,
`Kodi_U01_Video_107`.`global_tvshow`.`c13` AS `c13`,
`Kodi_U01_Video_107`.`global_tvshow`.`c14` AS `c14`,
`Kodi_U01_Video_107`.`global_tvshow`.`c15` AS `c15`,
`Kodi_U01_Video_107`.`global_tvshow`.`c16` AS `c16`,
`Kodi_U01_Video_107`.`global_tvshow`.`c17` AS `c17`,
`Kodi_U01_Video_107`.`global_tvshow`.`c18` AS `c18`,
`Kodi_U01_Video_107`.`global_tvshow`.`c19` AS `c19`,
`Kodi_U01_Video_107`.`global_tvshow`.`c20` AS `c20`,
`Kodi_U01_Video_107`.`global_tvshow`.`c21` AS `c21`,
`Kodi_U01_Video_107`.`global_tvshow`.`c22` AS `c22`,
`Kodi_U01_Video_107`.`global_tvshow`.`c23` AS `c23`,
`Kodi_U01_Video_107`.`global_tvshow`.`userrating_U04` AS `userrating`,
`Kodi_U01_Video_107`.`global_tvshow`.`duration` AS `duration`
FROM `Kodi_U01_Video_107`.`global_tvshow`
JOIN `Kodi_U04_Video_107`.`tvshowlinkpath` ON `Kodi_U01_Video_107`.`global_tvshow`.`idShow` = `tvshowlinkpath`.`idShow`
JOIN `Kodi_U04_Video_107`.`path` ON `tvshowlinkpath`.`idPath` = `path`.`idPath`
WHERE `Kodi_U04_Video_107`.`path`.`strPath` REGEXP '^smb://192.168.0.105/TV_Shows/UserA/|^smb://192.168.0.105/TV_Shows/Both/';
PHP Code:
CREATE ALGORITHM=MERGE DEFINER=`KODI_17`@`%` SQL SECURITY DEFINER VIEW `Kodi_U04_Video_107`.`tvshow` AS SELECT
`Kodi_U01_Video_107`.`global_tvshow`.`idShow` AS `idShow`,
`Kodi_U01_Video_107`.`global_tvshow`.`c00` AS `c00`,
`Kodi_U01_Video_107`.`global_tvshow`.`c01` AS `c01`,
`Kodi_U01_Video_107`.`global_tvshow`.`c02` AS `c02`,
`Kodi_U01_Video_107`.`global_tvshow`.`c03` AS `c03`,
`Kodi_U01_Video_107`.`global_tvshow`.`c04` AS `c04`,
`Kodi_U01_Video_107`.`global_tvshow`.`c05` AS `c05`,
`Kodi_U01_Video_107`.`global_tvshow`.`c06` AS `c06`,
`Kodi_U01_Video_107`.`global_tvshow`.`c07` AS `c07`,
`Kodi_U01_Video_107`.`global_tvshow`.`c08` AS `c08`,
`Kodi_U01_Video_107`.`global_tvshow`.`c09` AS `c09`,
`Kodi_U01_Video_107`.`global_tvshow`.`c10` AS `c10`,
`Kodi_U01_Video_107`.`global_tvshow`.`c11` AS `c11`,
`Kodi_U01_Video_107`.`global_tvshow`.`c12` AS `c12`,
`Kodi_U01_Video_107`.`global_tvshow`.`c13` AS `c13`,
`Kodi_U01_Video_107`.`global_tvshow`.`c14` AS `c14`,
`Kodi_U01_Video_107`.`global_tvshow`.`c15` AS `c15`,
`Kodi_U01_Video_107`.`global_tvshow`.`c16` AS `c16`,
`Kodi_U01_Video_107`.`global_tvshow`.`c17` AS `c17`,
`Kodi_U01_Video_107`.`global_tvshow`.`c18` AS `c18`,
`Kodi_U01_Video_107`.`global_tvshow`.`c19` AS `c19`,
`Kodi_U01_Video_107`.`global_tvshow`.`c20` AS `c20`,
`Kodi_U01_Video_107`.`global_tvshow`.`c21` AS `c21`,
`Kodi_U01_Video_107`.`global_tvshow`.`c22` AS `c22`,
`Kodi_U01_Video_107`.`global_tvshow`.`c23` AS `c23`,
`Kodi_U01_Video_107`.`global_tvshow`.`userrating_U04` AS `userrating`,
`Kodi_U01_Video_107`.`global_tvshow`.`duration` AS `duration`
FROM `Kodi_U01_Video_107`.`global_tvshow`;