Advertisement
mcfang

kodi mysql videos93

Aug 24th, 2015
594
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 12.82 KB | None | 0 0
  1. /* rename master files table and add fields to track watchlist of slave user */
  2. RENAME TABLE  `MyVideos93`.`files` TO  `MyVideos93`.`globalfiles` ;
  3. ALTER TABLE  `MyVideos93`.`globalfiles` ADD  `playCount1` INT( 11 ) NULL DEFAULT NULL , ADD  `lastPlayed1` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;
  4. ALTER TABLE  `MyVideos93`.`globalfiles` CHANGE  `playCount`  `playCount0` INT( 11 ) NULL DEFAULT NULL;
  5. ALTER TABLE  `MyVideos93`.`globalfiles` CHANGE  `lastPlayed`  `lastPlayed0` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;
  6.  
  7. /* create slave database and the only slave table required */
  8. CREATE DATABASE  `User1Videos93`;
  9. USE User1Videos93;
  10. CREATE TABLE bookmark ( idBookmark integer primary key AUTO_INCREMENT, idFile integer, timeInSeconds double, totalTimeInSeconds double, thumbNailImage text, player text, playerState text, type integer);
  11. CREATE INDEX ix_bookmark ON bookmark (idFile, type);
  12.  
  13. /* create files view in master database */
  14. CREATE VIEW `MyVideos93`.`files` AS
  15. SELECT idFile, idPath, strFilename, playCount0 AS playCount, lastPlayed0 AS lastPlayed, dateAdded FROM `MyVideos93`.`globalfiles`;
  16.  
  17. /* from here to the end of the paste is creating views in slave database */
  18. CREATE VIEW `User1Videos93`.`files` AS
  19. SELECT idFile, idPath, strFilename, playCount1 AS playCount, lastPlayed1 AS lastPlayed, dateAdded FROM `MyVideos93`.`globalfiles`;
  20. CREATE VIEW `User1Videos93`.`actor_link` AS
  21. SELECT * FROM `MyVideos93`.`actor_link`;
  22. CREATE VIEW `User1Videos93`.`actor` AS
  23. SELECT * FROM `MyVideos93`.`actor`;
  24. CREATE VIEW `User1Videos93`.`art` AS
  25. SELECT * FROM `MyVideos93`.`art`;
  26. CREATE VIEW `User1Videos93`.`country` AS
  27. SELECT * FROM `MyVideos93`.`country`;
  28. CREATE VIEW `User1Videos93`.`country_link` AS
  29. SELECT * FROM `MyVideos93`.`country_link`;
  30. CREATE VIEW `User1Videos93`.`director_link` AS
  31. SELECT * FROM `MyVideos93`.`director_link`;
  32. CREATE VIEW `User1Videos93`.`episode` AS
  33. SELECT * FROM `MyVideos93`.`episode`;
  34. CREATE VIEW `User1Videos93`.`genre` AS
  35. SELECT * FROM `MyVideos93`.`genre`;
  36. CREATE VIEW `User1Videos93`.`genre_link` AS
  37. SELECT * FROM `MyVideos93`.`genre_link`;
  38. CREATE VIEW `User1Videos93`.`movie` AS
  39. SELECT * FROM `MyVideos93`.`movie`;
  40. CREATE VIEW `User1Videos93`.`movielinktvshow` AS
  41. SELECT * FROM `MyVideos93`.`movielinktvshow`;
  42. CREATE VIEW `User1Videos93`.`musicvideo` AS
  43. SELECT * FROM `MyVideos93`.`musicvideo`;
  44. CREATE VIEW `User1Videos93`.`path` AS
  45. SELECT * FROM `MyVideos93`.`path`;
  46. CREATE VIEW `User1Videos93`.`seasons` AS
  47. SELECT * FROM `MyVideos93`.`seasons`;
  48. CREATE VIEW `User1Videos93`.`sets` AS
  49. SELECT * FROM `MyVideos93`.`sets`;
  50. CREATE VIEW `User1Videos93`.`settings` AS
  51. SELECT * FROM `MyVideos93`.`settings`;
  52. CREATE VIEW `User1Videos93`.`stacktimes` AS
  53. SELECT * FROM `MyVideos93`.`stacktimes`;
  54. CREATE VIEW `User1Videos93`.`streamdetails` AS
  55. SELECT * FROM `MyVideos93`.`streamdetails`;
  56. CREATE VIEW `User1Videos93`.`studio` AS
  57. SELECT * FROM `MyVideos93`.`studio`;
  58. CREATE VIEW `User1Videos93`.`studio_link` AS
  59. SELECT * FROM `MyVideos93`.`studio_link`;
  60. CREATE VIEW `User1Videos93`.`tag` AS
  61. SELECT * FROM `MyVideos93`.`tag`;
  62. CREATE VIEW `User1Videos93`.`tag_link` AS
  63. SELECT * FROM `MyVideos93`.`tag_link`;
  64. CREATE VIEW `User1Videos93`.`tvshow` AS
  65. SELECT * FROM `MyVideos93`.`tvshow`;
  66. CREATE VIEW `User1Videos93`.`tvshowlinkpath` AS
  67. SELECT * FROM `MyVideos93`.`tvshowlinkpath`;
  68. CREATE VIEW `User1Videos93`.`version` AS
  69. SELECT * FROM `MyVideos93`.`version`;
  70. CREATE VIEW `User1Videos93`.`writer_link` AS
  71. SELECT * FROM `MyVideos93`.`writer_link`;
  72.  
  73. CREATE VIEW `User1Videos93`.`movie_view` AS select
  74. `User1Videos93`.`movie`.`idMovie` AS `idMovie`,
  75. `User1Videos93`.`movie`.`idFile` AS `idFile`,
  76. `User1Videos93`.`movie`.`c00` AS `c00`,
  77. `User1Videos93`.`movie`.`c01` AS `c01`,
  78. `User1Videos93`.`movie`.`c02` AS `c02`,
  79. `User1Videos93`.`movie`.`c03` AS `c03`,
  80. `User1Videos93`.`movie`.`c04` AS `c04`,
  81. `User1Videos93`.`movie`.`c05` AS `c05`,
  82. `User1Videos93`.`movie`.`c06` AS `c06`,
  83. `User1Videos93`.`movie`.`c07` AS `c07`,
  84. `User1Videos93`.`movie`.`c08` AS `c08`,
  85. `User1Videos93`.`movie`.`c09` AS `c09`,
  86. `User1Videos93`.`movie`.`c10` AS `c10`,
  87. `User1Videos93`.`movie`.`c11` AS `c11`,
  88. `User1Videos93`.`movie`.`c12` AS `c12`,
  89. `User1Videos93`.`movie`.`c13` AS `c13`,
  90. `User1Videos93`.`movie`.`c14` AS `c14`,
  91. `User1Videos93`.`movie`.`c15` AS `c15`,
  92. `User1Videos93`.`movie`.`c16` AS `c16`,
  93. `User1Videos93`.`movie`.`c17` AS `c17`,
  94. `User1Videos93`.`movie`.`c18` AS `c18`,
  95. `User1Videos93`.`movie`.`c19` AS `c19`,
  96. `User1Videos93`.`movie`.`c20` AS `c20`,
  97. `User1Videos93`.`movie`.`c21` AS `c21`,
  98. `User1Videos93`.`movie`.`c22` AS `c22`,
  99. `User1Videos93`.`movie`.`c23` AS `c23`,
  100. `User1Videos93`.`movie`.`idSet` AS `idSet`,
  101. `User1Videos93`.`sets`.`strSet` AS `strSet`,
  102. `User1Videos93`.`files`.`strFilename` AS `strFileName`,
  103. `User1Videos93`.`path`.`strPath` AS `strPath`,
  104. `User1Videos93`.`files`.`playCount` AS `playCount`,
  105. `User1Videos93`.`files`.`lastPlayed` AS `lastPlayed`,
  106. `User1Videos93`.`files`.`dateAdded` AS `dateAdded`,
  107. `User1Videos93`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
  108. `User1Videos93`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`
  109. from ((`User1Videos93`.`movie` left join `User1Videos93`.`sets` on((`User1Videos93`.`sets`.`idSet` = `User1Videos93`.`movie`.`idSet`)) join `User1Videos93`.`files` on((`User1Videos93`.`files`.`idFile` = `User1Videos93`.`movie`.`idFile`))) join `User1Videos93`.`path` on((`User1Videos93`.`path`.`idPath` = `User1Videos93`.`files`.`idPath`))left join `User1Videos93`.`bookmark` on((`User1Videos93`.`bookmark`.`idFile` = `User1Videos93`.`movie`.`idFile` AND `User1Videos93`.`bookmark`.`type` = 1)));
  110.  
  111. CREATE VIEW `User1Videos93`.`musicvideo_view` AS select
  112. `User1Videos93`.`musicvideo`.`idMVideo` AS `idMVideo`,
  113. `User1Videos93`.`musicvideo`.`idFile` AS `idFile`,
  114. `User1Videos93`.`musicvideo`.`c00` AS `c00`,
  115. `User1Videos93`.`musicvideo`.`c01` AS `c01`,
  116. `User1Videos93`.`musicvideo`.`c02` AS `c02`,
  117. `User1Videos93`.`musicvideo`.`c03` AS `c03`,
  118. `User1Videos93`.`musicvideo`.`c04` AS `c04`,
  119. `User1Videos93`.`musicvideo`.`c05` AS `c05`,
  120. `User1Videos93`.`musicvideo`.`c06` AS `c06`,
  121. `User1Videos93`.`musicvideo`.`c07` AS `c07`,
  122. `User1Videos93`.`musicvideo`.`c08` AS `c08`,
  123. `User1Videos93`.`musicvideo`.`c09` AS `c09`,
  124. `User1Videos93`.`musicvideo`.`c10` AS `c10`,
  125. `User1Videos93`.`musicvideo`.`c11` AS `c11`,
  126. `User1Videos93`.`musicvideo`.`c12` AS `c12`,
  127. `User1Videos93`.`musicvideo`.`c13` AS `c13`,
  128. `User1Videos93`.`musicvideo`.`c14` AS `c14`,
  129. `User1Videos93`.`musicvideo`.`c15` AS `c15`,
  130. `User1Videos93`.`musicvideo`.`c16` AS `c16`,
  131. `User1Videos93`.`musicvideo`.`c17` AS `c17`,
  132. `User1Videos93`.`musicvideo`.`c18` AS `c18`,
  133. `User1Videos93`.`musicvideo`.`c19` AS `c19`,
  134. `User1Videos93`.`musicvideo`.`c20` AS `c20`,
  135. `User1Videos93`.`musicvideo`.`c21` AS `c21`,
  136. `User1Videos93`.`musicvideo`.`c22` AS `c22`,
  137. `User1Videos93`.`musicvideo`.`c23` AS `c23`,
  138. `User1Videos93`.`files`.`strFilename` AS `strFileName`,
  139. `User1Videos93`.`path`.`strPath` AS `strPath`,
  140. `User1Videos93`.`files`.`playCount` AS `playCount`,
  141. `User1Videos93`.`files`.`lastPlayed` AS `lastPlayed`,
  142. `User1Videos93`.`files`.`dateAdded` AS `dateAdded`,
  143. `User1Videos93`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
  144. `User1Videos93`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`
  145. from ((`User1Videos93`.`musicvideo` join `User1Videos93`.`files` on((`User1Videos93`.`files`.`idFile` = `User1Videos93`.`musicvideo`.`idFile`))) join `User1Videos93`.`path` on((`User1Videos93`.`path`.`idPath` = `User1Videos93`.`files`.`idPath`))left join `User1Videos93`.`bookmark` on((`User1Videos93`.`bookmark`.`idFile` = `User1Videos93`.`musicvideo`.`idFile` AND `User1Videos93`.`bookmark`.`type` = 1)));
  146.  
  147. CREATE VIEW `User1Videos93`.`episode_view` AS select
  148. `User1Videos93`.`episode`.`idEpisode` AS `idEpisode`,
  149. `User1Videos93`.`episode`.`idFile` AS `idFile`,
  150. `User1Videos93`.`episode`.`c00` AS `c00`,
  151. `User1Videos93`.`episode`.`c01` AS `c01`,
  152. `User1Videos93`.`episode`.`c02` AS `c02`,
  153. `User1Videos93`.`episode`.`c03` AS `c03`,
  154. `User1Videos93`.`episode`.`c04` AS `c04`,
  155. `User1Videos93`.`episode`.`c05` AS `c05`,
  156. `User1Videos93`.`episode`.`c06` AS `c06`,
  157. `User1Videos93`.`episode`.`c07` AS `c07`,
  158. `User1Videos93`.`episode`.`c08` AS `c08`,
  159. `User1Videos93`.`episode`.`c09` AS `c09`,
  160. `User1Videos93`.`episode`.`c10` AS `c10`,
  161. `User1Videos93`.`episode`.`c11` AS `c11`,
  162. `User1Videos93`.`episode`.`c12` AS `c12`,
  163. `User1Videos93`.`episode`.`c13` AS `c13`,
  164. `User1Videos93`.`episode`.`c14` AS `c14`,
  165. `User1Videos93`.`episode`.`c15` AS `c15`,
  166. `User1Videos93`.`episode`.`c16` AS `c16`,
  167. `User1Videos93`.`episode`.`c17` AS `c17`,
  168. `User1Videos93`.`episode`.`c18` AS `c18`,
  169. `User1Videos93`.`episode`.`c19` AS `c19`,
  170. `User1Videos93`.`episode`.`c20` AS `c20`,
  171. `User1Videos93`.`episode`.`c21` AS `c21`,
  172. `User1Videos93`.`episode`.`c22` AS `c22`,
  173. `User1Videos93`.`episode`.`c23` AS `c23`,
  174. `User1Videos93`.`episode`.`idShow` AS `idShow`,
  175. `User1Videos93`.`files`.`strFilename` AS `strFileName`,
  176. `User1Videos93`.`path`.`strPath` AS `strPath`,
  177. `User1Videos93`.`files`.`playCount` AS `playCount`,
  178. `User1Videos93`.`files`.`lastPlayed` AS `lastPlayed`,
  179. `User1Videos93`.`files`.`dateAdded` AS `dateAdded`,
  180. `User1Videos93`.`tvshow`.`c00` AS `strTitle`,
  181. `User1Videos93`.`tvshow`.`c14` AS `strStudio`,
  182. `User1Videos93`.`tvshow`.`c05` AS `premiered`,
  183. `User1Videos93`.`tvshow`.`c13` AS `mpaa`,
  184. `User1Videos93`.`tvshow`.`c16` AS `strShowPath`,
  185. `User1Videos93`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
  186. `User1Videos93`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`,
  187. `User1Videos93`.`seasons`.`idSeason` AS `idSeason`
  188.  from ((`User1Videos93`.`episode` join `User1Videos93`.`files` on((`User1Videos93`.`files`.`idFile` = `User1Videos93`.`episode`.`idFile`))) join `User1Videos93`.`tvshow` on((`User1Videos93`.`tvshow`.`idShow` = `User1Videos93`.`episode`.`idShow`)) left join `User1Videos93`.`seasons` on((`User1Videos93`.`seasons`.`idShow` = `User1Videos93`.`episode`.`idShow` AND `User1Videos93`.`seasons`.`season` = `User1Videos93`.`episode`.`c12`)) join `User1Videos93`.`path` on((`User1Videos93`.`files`.`idPath` = `User1Videos93`.`path`.`idPath`))left join `User1Videos93`.`bookmark` on((`User1Videos93`.`bookmark`.`idFile` = `User1Videos93`.`episode`.`idFile` AND `User1Videos93`.`bookmark`.`type` = 1)) );
  189.  
  190. CREATE VIEW `User1Videos93`.`tvshowcounts` AS select `tvshow`.`idShow` AS `idShow`,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`,max(`files`.`dateAdded`) AS `dateAdded` from ((`User1Videos93`.`tvshow` left join `User1Videos93`.`episode` on((`episode`.`idShow` = `tvshow`.`idShow`))) left join `User1Videos93`.`files` on((`files`.`idFile` = `episode`.`idFile`))) group by `tvshow`.`idShow`;
  191.  
  192. CREATE VIEW `User1Videos93`.`tvshow_view` 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`.`idParentPath` AS `idParentPath`,`path`.`strPath` AS `strPath`,`tvshowcounts`.`dateAdded` AS `dateAdded`,`tvshowcounts`.`lastPlayed` AS `lastPlayed`,`tvshowcounts`.`totalCount` AS `totalCount`,`tvshowcounts`.`watchedcount` AS `watchedcount`,`tvshowcounts`.`totalSeasons` AS `totalSeasons` from (((`User1Videos93`.`tvshow` left join `User1Videos93`.`tvshowlinkpath` on((`tvshowlinkpath`.`idShow` = `tvshow`.`idShow`))) left join `User1Videos93`.`path` on((`path`.`idPath` = `tvshowlinkpath`.`idPath`))) join `User1Videos93`.`tvshowcounts` on((`tvshow`.`idShow` = `tvshowcounts`.`idShow`))) group by `tvshow`.`idShow`;
  193.  
  194. CREATE VIEW `User1Videos93`.`season_view` AS select `seasons`.`idSeason` AS `idSeason`,`seasons`.`idShow` AS `idShow`,`seasons`.`season` AS `season`,`tvshow_view`.`strPath` AS `strPath`,`tvshow_view`.`c00` AS `showTitle`,`tvshow_view`.`c01` AS `plot`,`tvshow_view`.`c05` AS `premiered`,`tvshow_view`.`c08` AS `genre`,`tvshow_view`.`c14` AS `strStudio`,`tvshow_view`.`c13` AS `mpaa`,count(distinct `episode_view`.`idEpisode`) AS `episodes`,count(`files`.`playCount`) AS `playCount` from (((`User1Videos93`.`seasons` join `User1Videos93`.`tvshow_view` on((`tvshow_view`.`idShow` = `seasons`.`idShow`))) join `User1Videos93`.`episode_view` on(((`episode_view`.`idShow` = `seasons`.`idShow`) and (`episode_view`.`c12` = `seasons`.`season`)))) join `User1Videos93`.`files` on((`files`.`idFile` = `episode_view`.`idFile`))) group by `seasons`.`idSeason`;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement