XBMC ze współdzielona baza danych mysql

Kod bazy danych dla użytkownika xbmc na współdzielonej bazie danych

Aby dodać nowego usera zmieniamy nazwę bazy na

User2Videos78
CREATE DATABASE User1Videos78;
USE User1Videos78;

CREATE VIEW `actorlinkepisode` AS SELECT * FROM `MyVideos78`.`actorlinkepisode`;
CREATE VIEW `actorlinkmovie` AS SELECT * FROM `MyVideos78`.`actorlinkmovie`;
CREATE VIEW `actorlinktvshow` AS SELECT * FROM `MyVideos78`.`actorlinktvshow`;
CREATE VIEW `actors` AS SELECT * FROM `MyVideos78`.`actors`;
CREATE VIEW `art` AS SELECT * FROM `MyVideos78`.`art`;
CREATE VIEW `artistlinkmusicvideo` AS SELECT * FROM `MyVideos78`.`artistlinkmusicvideo`;
CREATE VIEW `country` AS SELECT * FROM `MyVideos78`.`country`;
CREATE VIEW `countrylinkmovie` AS SELECT * FROM `MyVideos78`.`countrylinkmovie`;
CREATE VIEW `directorlinkepisode` AS SELECT * FROM `MyVideos78`.`directorlinkepisode`;
CREATE VIEW `directorlinkmovie` AS SELECT * FROM `MyVideos78`.`directorlinkmovie`;
CREATE VIEW `directorlinkmusicvideo` AS SELECT * FROM `MyVideos78`.`directorlinkmusicvideo`;
CREATE VIEW `directorlinktvshow` AS SELECT * FROM `MyVideos78`.`directorlinktvshow`;
CREATE VIEW `episode` AS SELECT * FROM `MyVideos78`.`episode`;
CREATE VIEW `genre` AS SELECT * FROM `MyVideos78`.`genre`;
CREATE VIEW `genrelinkmovie` AS SELECT * FROM `MyVideos78`.`genrelinkmovie`;
CREATE VIEW `genrelinkmusicvideo` AS SELECT * FROM `MyVideos78`.`genrelinkmusicvideo`;
CREATE VIEW `genrelinktvshow` AS SELECT * FROM `MyVideos78`.`genrelinktvshow`;
CREATE VIEW `movie` AS SELECT * FROM `MyVideos78`.`movie`;
CREATE VIEW `movielinktvshow` AS SELECT * FROM `MyVideos78`.`movielinktvshow`;
CREATE VIEW `musicvideo` AS SELECT * FROM `MyVideos78`.`musicvideo`;
CREATE VIEW `path` AS SELECT * FROM `MyVideos78`.`path`;
CREATE VIEW `seasons` AS SELECT * FROM `MyVideos78`.`seasons`;
CREATE VIEW `settings` AS SELECT * FROM `MyVideos78`.`settings`;
CREATE VIEW `sets` AS SELECT * FROM `MyVideos78`.`sets`;
CREATE VIEW `stacktimes` AS SELECT * FROM `MyVideos78`.`stacktimes`;
CREATE VIEW `streamdetails` AS SELECT * FROM `MyVideos78`.`streamdetails`;
CREATE VIEW `studio` AS SELECT * FROM `MyVideos78`.`studio`;
CREATE VIEW `studiolinkmovie` AS SELECT * FROM `MyVideos78`.`studiolinkmovie`;
CREATE VIEW `studiolinkmusicvideo` AS SELECT * FROM `MyVideos78`.`studiolinkmusicvideo`;
CREATE VIEW `studiolinktvshow` AS SELECT * FROM `MyVideos78`.`studiolinktvshow`;
CREATE VIEW `tag` AS SELECT * FROM `MyVideos78`.`tag`;
CREATE VIEW `taglinks` AS SELECT * FROM `MyVideos78`.`taglinks`;
CREATE VIEW `tvshow` AS SELECT * FROM `MyVideos78`.`tvshow`;
CREATE VIEW `tvshowlinkpath` AS SELECT * FROM `MyVideos78`.`tvshowlinkpath`;
CREATE VIEW `version` AS SELECT * FROM `MyVideos78`.`version`;
CREATE VIEW `writerlinkepisode` AS SELECT * FROM `MyVideos78`.`writerlinkepisode`;
CREATE VIEW `writerlinkmovie` AS SELECT * FROM `MyVideos78`.`writerlinkmovie`;

CREATE TABLE `bookmark` (`idBookmark` int(11) NOT NULL auto_increment,`idFile` int(11) default NULL,`timeInSeconds` double default NULL,`totalTimeInSeconds` double default NULL,`thumbNailImage` text,`player` text,`playerState` text,`type` int(11) default NULL,PRIMARY KEY  (`idBookmark`),KEY `ix_bookmark` (`idFile`,`type`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
CREATE TABLE `watched_history` (`idFile` int(11) NOT NULL,`playCount` int(11) DEFAULT NULL,`lastPlayed` text,PRIMARY KEY (`idFile`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE VIEW`files` AS SELECT `f`.`idFile` AS `idFile`,`f`.`idPath` AS `idPath`,`f`.`strFilename` AS `strFilename`,`wh`.`playCount` AS `playCount`,`wh`.`lastPlayed` AS `lastPlayed`, `f`.`dateAdded` AS `dateAdded` FROM `MyVideos78`.`files` `f` LEFT JOIN `User1Videos78`.`watched_history` `wh` ON `f`.`idFile` = `wh`.`idFile`;

CREATE ALGORITHM=UNDEFINED DEFINER=`xbmc`@`%` SQL SECURITY DEFINER VIEW `episodeview` AS select `episode`.`idEpisode` AS `idEpisode`,`episode`.`idFile` AS `idFile`,`episode`.`c00` AS `c00`,`episode`.`c01` AS `c01`,`episode`.`c02` AS `c02`,`episode`.`c03` AS `c03`,`episode`.`c04` AS `c04`,`episode`.`c05` AS `c05`,`episode`.`c06` AS `c06`,`episode`.`c07` AS `c07`,`episode`.`c08` AS `c08`,`episode`.`c09` AS `c09`,`episode`.`c10` AS `c10`,`episode`.`c11` AS `c11`,`episode`.`c12` AS `c12`,`episode`.`c13` AS `c13`,`episode`.`c14` AS `c14`,`episode`.`c15` AS `c15`,`episode`.`c16` AS `c16`,`episode`.`c17` AS `c17`,`episode`.`c18` AS `c18`,`episode`.`c19` AS `c19`,`episode`.`c20` AS `c20`,`episode`.`c21` AS `c21`,`episode`.`c22` AS `c22`,`episode`.`c23` AS `c23`,`episode`.`idShow` AS `idShow`,`files`.`strFilename` AS `strFileName`,`path`.`strPath` AS `strPath`,`files`.`playCount` AS `playCount`,`files`.`lastPlayed` AS `lastPlayed`,`files`.`dateAdded` AS `dateAdded`,`tvshow`.`c00` AS `strTitle`,`tvshow`.`c14` AS `strStudio`,`tvshow`.`c05` AS `premiered`,`tvshow`.`c13` AS `mpaa`,`tvshow`.`c16` AS `strShowPath`,`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`,`seasons`.`idSeason` AS `idSeason` from (((((`episode` join `files` on((`files`.`idFile` = `episode`.`idFile`))) join `tvshow` on((`tvshow`.`idShow` = `episode`.`idShow`))) left join `seasons` on(((`seasons`.`idShow` = `episode`.`idShow`) and (`seasons`.`season` = `episode`.`c12`)))) join `path` on((`files`.`idPath` = `path`.`idPath`))) left join `bookmark` on(((`bookmark`.`idFile` = `episode`.`idFile`) and (`bookmark`.`type` = 1))));
CREATE ALGORITHM=UNDEFINED DEFINER=`xbmc`@`%` SQL SECURITY DEFINER VIEW `movieview` AS select `movie`.`idMovie` AS `idMovie`,`movie`.`idFile` AS `idFile`,`movie`.`c00` AS `c00`,`movie`.`c01` AS `c01`,`movie`.`c02` AS `c02`,`movie`.`c03` AS `c03`,`movie`.`c04` AS `c04`,`movie`.`c05` AS `c05`,`movie`.`c06` AS `c06`,`movie`.`c07` AS `c07`,`movie`.`c08` AS `c08`,`movie`.`c09` AS `c09`,`movie`.`c10` AS `c10`,`movie`.`c11` AS `c11`,`movie`.`c12` AS `c12`,`movie`.`c13` AS `c13`,`movie`.`c14` AS `c14`,`movie`.`c15` AS `c15`,`movie`.`c16` AS `c16`,`movie`.`c17` AS `c17`,`movie`.`c18` AS `c18`,`movie`.`c19` AS `c19`,`movie`.`c20` AS `c20`,`movie`.`c21` AS `c21`,`movie`.`c22` AS `c22`,`movie`.`c23` AS `c23`,`movie`.`idSet` AS `idSet`,`sets`.`strSet` AS `strSet`,`files`.`strFilename` AS `strFileName`,`path`.`strPath` AS `strPath`,`files`.`playCount` AS `playCount`,`files`.`lastPlayed` AS `lastPlayed`,`files`.`dateAdded` AS `dateAdded`,`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds` from ((((`movie` left join `sets` on((`sets`.`idSet` = `movie`.`idSet`))) join `files` on((`files`.`idFile` = `movie`.`idFile`))) join `path` on((`path`.`idPath` = `files`.`idPath`))) left join `bookmark` on(((`bookmark`.`idFile` = `movie`.`idFile`) and (`bookmark`.`type` = 1))));
CREATE ALGORITHM=UNDEFINED DEFINER=`xbmc`@`%` SQL SECURITY DEFINER VIEW `musicvideoview` AS select `musicvideo`.`idMVideo` AS `idMVideo`,`musicvideo`.`idFile` AS `idFile`,`musicvideo`.`c00` AS `c00`,`musicvideo`.`c01` AS `c01`,`musicvideo`.`c02` AS `c02`,`musicvideo`.`c03` AS `c03`,`musicvideo`.`c04` AS `c04`,`musicvideo`.`c05` AS `c05`,`musicvideo`.`c06` AS `c06`,`musicvideo`.`c07` AS `c07`,`musicvideo`.`c08` AS `c08`,`musicvideo`.`c09` AS `c09`,`musicvideo`.`c10` AS `c10`,`musicvideo`.`c11` AS `c11`,`musicvideo`.`c12` AS `c12`,`musicvideo`.`c13` AS `c13`,`musicvideo`.`c14` AS `c14`,`musicvideo`.`c15` AS `c15`,`musicvideo`.`c16` AS `c16`,`musicvideo`.`c17` AS `c17`,`musicvideo`.`c18` AS `c18`,`musicvideo`.`c19` AS `c19`,`musicvideo`.`c20` AS `c20`,`musicvideo`.`c21` AS `c21`,`musicvideo`.`c22` AS `c22`,`musicvideo`.`c23` AS `c23`,`files`.`strFilename` AS `strFileName`,`path`.`strPath` AS `strPath`,`files`.`playCount` AS `playCount`,`files`.`lastPlayed` AS `lastPlayed`,`files`.`dateAdded` AS `dateAdded`,`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds` from (((`musicvideo` join `files` on((`files`.`idFile` = `musicvideo`.`idFile`))) join `path` on((`path`.`idPath` = `files`.`idPath`))) left join `bookmark` on(((`bookmark`.`idFile` = `musicvideo`.`idFile`) and (`bookmark`.`type` = 1))));
CREATE ALGORITHM=UNDEFINED DEFINER=`xbmc`@`%` SQL SECURITY DEFINER VIEW `tvshowview` AS select `tvshow`.`idShow` AS `idShow`,`tvshow`.`c00` AS `c00`,`tvshow`.`c01` AS `c01`,`tvshow`.`c02` AS `c02`,`tvshow`.`c03` AS `c03`,`tvshow`.`c04` AS `c04`,`tvshow`.`c05` AS `c05`,`tvshow`.`c06` AS `c06`,`tvshow`.`c07` AS `c07`,`tvshow`.`c08` AS `c08`,`tvshow`.`c09` AS `c09`,`tvshow`.`c10` AS `c10`,`tvshow`.`c11` AS `c11`,`tvshow`.`c12` AS `c12`,`tvshow`.`c13` AS `c13`,`tvshow`.`c14` AS `c14`,`tvshow`.`c15` AS `c15`,`tvshow`.`c16` AS `c16`,`tvshow`.`c17` AS `c17`,`tvshow`.`c18` AS `c18`,`tvshow`.`c19` AS `c19`,`tvshow`.`c20` AS `c20`,`tvshow`.`c21` AS `c21`,`tvshow`.`c22` AS `c22`,`tvshow`.`c23` AS `c23`,`path`.`strPath` AS `strPath`,`path`.`dateAdded` AS `dateAdded`,max(`files`.`lastPlayed`) AS `lastPlayed`,nullif(count(`episode`.`c12`),0) AS `totalCount`,count(`files`.`playCount`) AS `watchedcount`,nullif(count(distinct `episode`.`c12`),0) AS `totalSeasons` from ((((`tvshow` left join `tvshowlinkpath` on((`tvshowlinkpath`.`idShow` = `tvshow`.`idShow`))) left join `path` on((`path`.`idPath` = `tvshowlinkpath`.`idPath`))) left join `episode` on((`episode`.`idShow` = `tvshow`.`idShow`))) left join `files` on((`files`.`idFile` = `episode`.`idFile`))) group by `tvshow`.`idShow`;

Dodaj komentarz

Twój adres email nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *