Advertisement
Guest User

XBMC Frodo Multiuser single media Database

a guest
Dec 12th, 2012
813
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 12.99 KB | None | 0 0
  1. RENAME TABLE  `MyVideos75`.`files` TO  `MyVideos75`.`globalfiles` ;
  2.  
  3. ALTER TABLE  `MyVideos75`.`globalfiles` ADD  `playCount2` INT( 11 ) NULL DEFAULT NULL , ADD  `lastPlayed2` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;
  4. ALTER TABLE  `MyVideos75`.`globalfiles` CHANGE  `playCount`  `playCount1` INT( 11 ) NULL DEFAULT NULL;
  5. ALTER TABLE  `MyVideos75`.`globalfiles` CHANGE  `lastPlayed`  `lastPlayed1` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;
  6.  
  7. CREATE DATABASE  `UserVideos75` ;
  8. CREATE VIEW `MyVideos75`.`files` AS
  9. SELECT idFile, idPath, strFilename, playCount1 AS playCount, lastPlayed1 AS lastPlayed, dateAdded FROM `MyVideos75`.`globalfiles`;
  10. CREATE VIEW `UserVideos75`.`files` AS
  11. SELECT idFile, idPath, strFilename, playCount2 AS playCount, lastPlayed2 AS lastPlayed, dateAdded FROM `MyVideos75`.`globalfiles`;
  12. CREATE VIEW `UserVideos75`.`actorlinkepisode` AS
  13. SELECT * FROM `MyVideos75`.`actorlinkepisode`;
  14. CREATE VIEW `UserVideos75`.`actorlinkmovie` AS
  15. SELECT * FROM `MyVideos75`.`actorlinkmovie`;
  16. CREATE VIEW `UserVideos75`.`actorlinktvshow` AS
  17. SELECT * FROM `MyVideos75`.`actorlinktvshow`;
  18. CREATE VIEW `UserVideos75`.`actors` AS
  19. SELECT * FROM `MyVideos75`.`actors`;
  20. CREATE VIEW `UserVideos75`.`art` AS
  21. SELECT * FROM `MyVideos75`.`art`;
  22. CREATE VIEW `UserVideos75`.`artistlinkmusicvideo` AS
  23. SELECT * FROM `MyVideos75`.`artistlinkmusicvideo`;
  24. CREATE VIEW `UserVideos75`.`country` AS
  25. SELECT * FROM `MyVideos75`.`country`;
  26. CREATE VIEW `UserVideos75`.`countrylinkmovie` AS
  27. SELECT * FROM `MyVideos75`.`countrylinkmovie`;
  28. CREATE VIEW `UserVideos75`.`directorlinkepisode` AS
  29. SELECT * FROM `MyVideos75`.`directorlinkepisode`;
  30. CREATE VIEW `UserVideos75`.`directorlinkmovie` AS
  31. SELECT * FROM `MyVideos75`.`directorlinkmovie`;
  32. CREATE VIEW `UserVideos75`.`directorlinkmusicvideo` AS
  33. SELECT * FROM `MyVideos75`.`directorlinkmusicvideo`;
  34. CREATE VIEW `UserVideos75`.`directorlinktvshow` AS
  35. SELECT * FROM `MyVideos75`.`directorlinktvshow`;
  36. CREATE VIEW `UserVideos75`.`episode` AS
  37. SELECT * FROM `MyVideos75`.`episode`;
  38. CREATE VIEW `UserVideos75`.`genre` AS
  39. SELECT * FROM `MyVideos75`.`genre`;
  40. CREATE VIEW `UserVideos75`.`genrelinkmovie` AS
  41. SELECT * FROM `MyVideos75`.`genrelinkmovie`;
  42. CREATE VIEW `UserVideos75`.`genrelinkmusicvideo` AS
  43. SELECT * FROM `MyVideos75`.`genrelinkmusicvideo`;
  44. CREATE VIEW `UserVideos75`.`genrelinktvshow` AS
  45. SELECT * FROM `MyVideos75`.`genrelinktvshow`;
  46. CREATE VIEW `UserVideos75`.`movie` AS
  47. SELECT * FROM `MyVideos75`.`movie`;
  48. CREATE VIEW `UserVideos75`.`movielinktvshow` AS
  49. SELECT * FROM `MyVideos75`.`movielinktvshow`;
  50. CREATE VIEW `UserVideos75`.`musicvideo` AS
  51. SELECT * FROM `MyVideos75`.`musicvideo`;
  52. CREATE VIEW `UserVideos75`.`path` AS
  53. SELECT * FROM `MyVideos75`.`path`;
  54. CREATE VIEW `UserVideos75`.`seasons` AS
  55. SELECT * FROM `MyVideos75`.`seasons`;
  56. CREATE VIEW `UserVideos75`.`sets` AS
  57. SELECT * FROM `MyVideos75`.`sets`;
  58. CREATE VIEW `UserVideos75`.`settings` AS
  59. SELECT * FROM `MyVideos75`.`settings`;
  60. CREATE VIEW `UserVideos75`.`stacktimes` AS
  61. SELECT * FROM `MyVideos75`.`stacktimes`;
  62. CREATE VIEW `UserVideos75`.`streamdetails` AS
  63. SELECT * FROM `MyVideos75`.`streamdetails`;
  64. CREATE VIEW `UserVideos75`.`studio` AS
  65. SELECT * FROM `MyVideos75`.`studio`;
  66. CREATE VIEW `UserVideos75`.`studiolinkmovie` AS
  67. SELECT * FROM `MyVideos75`.`studiolinkmovie`;
  68. CREATE VIEW `UserVideos75`.`studiolinkmusicvideo` AS
  69. SELECT * FROM `MyVideos75`.`studiolinkmusicvideo`;
  70. CREATE VIEW `UserVideos75`.`studiolinktvshow` AS
  71. SELECT * FROM `MyVideos75`.`studiolinktvshow`;
  72. CREATE VIEW `UserVideos75`.`tag` AS
  73. SELECT * FROM `MyVideos75`.`tag`;
  74. CREATE VIEW `UserVideos75`.`taglinks` AS
  75. SELECT * FROM `MyVideos75`.`taglinks`;
  76. CREATE VIEW `UserVideos75`.`tvshow` AS
  77. SELECT * FROM `MyVideos75`.`tvshow`;
  78. CREATE VIEW `UserVideos75`.`tvshowlinkpath` AS
  79. SELECT * FROM `MyVideos75`.`tvshowlinkpath`;
  80. CREATE VIEW `UserVideos75`.`version` AS
  81. SELECT * FROM `MyVideos75`.`version`;
  82. CREATE VIEW `UserVideos75`.`writerlinkepisode` AS
  83. SELECT * FROM `MyVideos75`.`writerlinkepisode`;
  84. CREATE VIEW `UserVideos75`.`writerlinkmovie` AS
  85. SELECT * FROM `MyVideos75`.`writerlinkmovie`;
  86. /* in order to maintain unique resume times - establish new bookmark */
  87. USE UserVideos75;
  88. CREATE TABLE bookmark ( idBookmark INTEGER PRIMARY KEY AUTO_INCREMENT, idFile INTEGER, timeInSeconds DOUBLE, totalTimeInSeconds DOUBLE, thumbNailImage text, player text, playerState text, TYPE INTEGER);
  89. CREATE INDEX ix_bookmark ON bookmark (idFile, TYPE);
  90.  
  91. /* end here - start again */
  92.  
  93. CREATE VIEW `UserVideos75`.`movieview` AS SELECT
  94. `UserVideos75`.`movie`.`idMovie` AS `idMovie`,
  95. `UserVideos75`.`movie`.`idFile` AS `idFile`,
  96. `UserVideos75`.`movie`.`c00` AS `c00`,
  97. `UserVideos75`.`movie`.`c01` AS `c01`,
  98. `UserVideos75`.`movie`.`c02` AS `c02`,
  99. `UserVideos75`.`movie`.`c03` AS `c03`,
  100. `UserVideos75`.`movie`.`c04` AS `c04`,
  101. `UserVideos75`.`movie`.`c05` AS `c05`,
  102. `UserVideos75`.`movie`.`c06` AS `c06`,
  103. `UserVideos75`.`movie`.`c07` AS `c07`,
  104. `UserVideos75`.`movie`.`c08` AS `c08`,
  105. `UserVideos75`.`movie`.`c09` AS `c09`,
  106. `UserVideos75`.`movie`.`c10` AS `c10`,
  107. `UserVideos75`.`movie`.`c11` AS `c11`,
  108. `UserVideos75`.`movie`.`c12` AS `c12`,
  109. `UserVideos75`.`movie`.`c13` AS `c13`,
  110. `UserVideos75`.`movie`.`c14` AS `c14`,
  111. `UserVideos75`.`movie`.`c15` AS `c15`,
  112. `UserVideos75`.`movie`.`c16` AS `c16`,
  113. `UserVideos75`.`movie`.`c17` AS `c17`,
  114. `UserVideos75`.`movie`.`c18` AS `c18`,
  115. `UserVideos75`.`movie`.`c19` AS `c19`,
  116. `UserVideos75`.`movie`.`c20` AS `c20`,
  117. `UserVideos75`.`movie`.`c21` AS `c21`,
  118. `UserVideos75`.`movie`.`c22` AS `c22`,
  119. `UserVideos75`.`movie`.`c23` AS `c23`,
  120. `UserVideos75`.`movie`.`idSet` AS `idSet`,
  121. `UserVideos75`.`sets`.`strSet` AS `strSet`,
  122. `UserVideos75`.`files`.`strFilename` AS `strFileName`,
  123. `UserVideos75`.`path`.`strPath` AS `strPath`,
  124. `UserVideos75`.`files`.`playCount` AS `playCount`,
  125. `UserVideos75`.`files`.`lastPlayed` AS `lastPlayed`,
  126. `UserVideos75`.`files`.`dateAdded` AS `dateAdded`,
  127. `UserVideos75`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
  128. `UserVideos75`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`
  129. FROM ((`UserVideos75`.`movie` LEFT JOIN `UserVideos75`.`sets` ON((`UserVideos75`.`sets`.`idSet` = `UserVideos75`.`movie`.`idSet`)) JOIN `UserVideos75`.`files` ON((`UserVideos75`.`files`.`idFile` = `UserVideos75`.`movie`.`idFile`))) JOIN `UserVideos75`.`path` ON((`UserVideos75`.`path`.`idPath` = `UserVideos75`.`files`.`idPath`))LEFT JOIN `UserVideos75`.`bookmark` ON((`UserVideos75`.`bookmark`.`idFile` = `UserVideos75`.`movie`.`idFile` AND `UserVideos75`.`bookmark`.`type` = 1)));
  130.  
  131. CREATE VIEW `UserVideos75`.`musicvideoview` AS SELECT
  132. `UserVideos75`.`musicvideo`.`idMVideo` AS `idMVideo`,
  133. `UserVideos75`.`musicvideo`.`idFile` AS `idFile`,
  134. `UserVideos75`.`musicvideo`.`c00` AS `c00`,
  135. `UserVideos75`.`musicvideo`.`c01` AS `c01`,
  136. `UserVideos75`.`musicvideo`.`c02` AS `c02`,
  137. `UserVideos75`.`musicvideo`.`c03` AS `c03`,
  138. `UserVideos75`.`musicvideo`.`c04` AS `c04`,
  139. `UserVideos75`.`musicvideo`.`c05` AS `c05`,
  140. `UserVideos75`.`musicvideo`.`c06` AS `c06`,
  141. `UserVideos75`.`musicvideo`.`c07` AS `c07`,
  142. `UserVideos75`.`musicvideo`.`c08` AS `c08`,
  143. `UserVideos75`.`musicvideo`.`c09` AS `c09`,
  144. `UserVideos75`.`musicvideo`.`c10` AS `c10`,
  145. `UserVideos75`.`musicvideo`.`c11` AS `c11`,
  146. `UserVideos75`.`musicvideo`.`c12` AS `c12`,
  147. `UserVideos75`.`musicvideo`.`c13` AS `c13`,
  148. `UserVideos75`.`musicvideo`.`c14` AS `c14`,
  149. `UserVideos75`.`musicvideo`.`c15` AS `c15`,
  150. `UserVideos75`.`musicvideo`.`c16` AS `c16`,
  151. `UserVideos75`.`musicvideo`.`c17` AS `c17`,
  152. `UserVideos75`.`musicvideo`.`c18` AS `c18`,
  153. `UserVideos75`.`musicvideo`.`c19` AS `c19`,
  154. `UserVideos75`.`musicvideo`.`c20` AS `c20`,
  155. `UserVideos75`.`musicvideo`.`c21` AS `c21`,
  156. `UserVideos75`.`musicvideo`.`c22` AS `c22`,
  157. `UserVideos75`.`musicvideo`.`c23` AS `c23`,
  158. `UserVideos75`.`files`.`strFilename` AS `strFileName`,
  159. `UserVideos75`.`path`.`strPath` AS `strPath`,
  160. `UserVideos75`.`files`.`playCount` AS `playCount`,
  161. `UserVideos75`.`files`.`lastPlayed` AS `lastPlayed`,
  162. `UserVideos75`.`files`.`dateAdded` AS `dateAdded`,
  163. `UserVideos75`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
  164. `UserVideos75`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`
  165. FROM ((`UserVideos75`.`musicvideo` JOIN `UserVideos75`.`files` ON((`UserVideos75`.`files`.`idFile` = `UserVideos75`.`musicvideo`.`idFile`))) JOIN `UserVideos75`.`path` ON((`UserVideos75`.`path`.`idPath` = `UserVideos75`.`files`.`idPath`))LEFT JOIN `UserVideos75`.`bookmark` ON((`UserVideos75`.`bookmark`.`idFile` = `UserVideos75`.`musicvideo`.`idFile` AND `UserVideos75`.`bookmark`.`type` = 1)));
  166.  
  167. /* fine to here debug rest episodeview/tvshowview */
  168.  
  169. CREATE VIEW `UserVideos75`.`episodeview` AS SELECT
  170. `UserVideos75`.`episode`.`idEpisode` AS `idEpisode`,
  171. `UserVideos75`.`episode`.`idFile` AS `idFile`,
  172. `UserVideos75`.`episode`.`c00` AS `c00`,
  173. `UserVideos75`.`episode`.`c01` AS `c01`,
  174. `UserVideos75`.`episode`.`c02` AS `c02`,
  175. `UserVideos75`.`episode`.`c03` AS `c03`,
  176. `UserVideos75`.`episode`.`c04` AS `c04`,
  177. `UserVideos75`.`episode`.`c05` AS `c05`,
  178. `UserVideos75`.`episode`.`c06` AS `c06`,
  179. `UserVideos75`.`episode`.`c07` AS `c07`,
  180. `UserVideos75`.`episode`.`c08` AS `c08`,
  181. `UserVideos75`.`episode`.`c09` AS `c09`,
  182. `UserVideos75`.`episode`.`c10` AS `c10`,
  183. `UserVideos75`.`episode`.`c11` AS `c11`,
  184. `UserVideos75`.`episode`.`c12` AS `c12`,
  185. `UserVideos75`.`episode`.`c13` AS `c13`,
  186. `UserVideos75`.`episode`.`c14` AS `c14`,
  187. `UserVideos75`.`episode`.`c15` AS `c15`,
  188. `UserVideos75`.`episode`.`c16` AS `c16`,
  189. `UserVideos75`.`episode`.`c17` AS `c17`,
  190. `UserVideos75`.`episode`.`c18` AS `c18`,
  191. `UserVideos75`.`episode`.`c19` AS `c19`,
  192. `UserVideos75`.`episode`.`c20` AS `c20`,
  193. `UserVideos75`.`episode`.`c21` AS `c21`,
  194. `UserVideos75`.`episode`.`c22` AS `c22`,
  195. `UserVideos75`.`episode`.`c23` AS `c23`,
  196. `UserVideos75`.`episode`.`idShow` AS `idShow`,
  197. `UserVideos75`.`files`.`strFilename` AS `strFileName`,
  198. `UserVideos75`.`path`.`strPath` AS `strPath`,
  199. `UserVideos75`.`files`.`playCount` AS `playCount`,
  200. `UserVideos75`.`files`.`lastPlayed` AS `lastPlayed`,
  201. `UserVideos75`.`files`.`dateAdded` AS `dateAdded`,
  202. `UserVideos75`.`tvshow`.`c00` AS `strTitle`,
  203. `UserVideos75`.`tvshow`.`c14` AS `strStudio`,
  204. `UserVideos75`.`tvshow`.`c05` AS `premiered`,
  205. `UserVideos75`.`tvshow`.`c13` AS `mpaa`,
  206. `UserVideos75`.`tvshow`.`c16` AS `strShowPath`,
  207. `UserVideos75`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
  208. `UserVideos75`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`,
  209. `UserVideos75`.`seasons`.`idSeason` AS `idSeason`
  210.  FROM ((`UserVideos75`.`episode` JOIN `UserVideos75`.`files` ON((`UserVideos75`.`files`.`idFile` = `UserVideos75`.`episode`.`idFile`))) JOIN `UserVideos75`.`tvshow` ON((`UserVideos75`.`tvshow`.`idShow` = `UserVideos75`.`episode`.`idShow`)) LEFT JOIN `UserVideos75`.`seasons` ON((`UserVideos75`.`seasons`.`idShow` = `UserVideos75`.`episode`.`idShow` AND `UserVideos75`.`seasons`.`season` = `UserVideos75`.`episode`.`c12`)) JOIN `UserVideos75`.`path` ON((`UserVideos75`.`files`.`idPath` = `UserVideos75`.`path`.`idPath`))LEFT JOIN `UserVideos75`.`bookmark` ON((`UserVideos75`.`bookmark`.`idFile` = `UserVideos75`.`episode`.`idFile` AND `UserVideos75`.`bookmark`.`type` = 1)) );
  211.  
  212.  
  213. CREATE VIEW `UserVideos75`.`tvshowview` AS SELECT
  214. `UserVideos75`.`tvshow`.`idShow` AS `idShow`,
  215. `UserVideos75`.`tvshow`.`c00` AS `c00`,
  216. `UserVideos75`.`tvshow`.`c01` AS `c01`,
  217. `UserVideos75`.`tvshow`.`c02` AS `c02`,
  218. `UserVideos75`.`tvshow`.`c03` AS `c03`,
  219. `UserVideos75`.`tvshow`.`c04` AS `c04`,
  220. `UserVideos75`.`tvshow`.`c05` AS `c05`,
  221. `UserVideos75`.`tvshow`.`c06` AS `c06`,
  222. `UserVideos75`.`tvshow`.`c07` AS `c07`,
  223. `UserVideos75`.`tvshow`.`c08` AS `c08`,
  224. `UserVideos75`.`tvshow`.`c09` AS `c09`,
  225. `UserVideos75`.`tvshow`.`c10` AS `c10`,
  226. `UserVideos75`.`tvshow`.`c11` AS `c11`,
  227. `UserVideos75`.`tvshow`.`c12` AS `c12`,
  228. `UserVideos75`.`tvshow`.`c13` AS `c13`,
  229. `UserVideos75`.`tvshow`.`c14` AS `c14`,
  230. `UserVideos75`.`tvshow`.`c15` AS `c15`,
  231. `UserVideos75`.`tvshow`.`c16` AS `c16`,
  232. `UserVideos75`.`tvshow`.`c17` AS `c17`,
  233. `UserVideos75`.`tvshow`.`c18` AS `c18`,
  234. `UserVideos75`.`tvshow`.`c19` AS `c19`,
  235. `UserVideos75`.`tvshow`.`c20` AS `c20`,
  236. `UserVideos75`.`tvshow`.`c21` AS `c21`,
  237. `UserVideos75`.`tvshow`.`c22` AS `c22`,
  238. `UserVideos75`.`tvshow`.`c23` AS `c23`,
  239. `UserVideos75`.`path`.`strPath` AS `strPath`,
  240. `UserVideos75`.`path`.`dateAdded` AS `dateAdded`,
  241. MAX(`UserVideos75`.`files`.`lastPlayed`) AS `lastPlayed`,
  242. NULLIF(COUNT(`UserVideos75`.`episode`.`c12`),0) AS `totalCount`,
  243. COUNT(`UserVideos75`.`files`.`playCount`) AS `watchedcount`,
  244. NULLIF(COUNT(DISTINCT `UserVideos75`.`episode`.`c12`),0) AS `totalSeasons`
  245. FROM (((`UserVideos75`.`tvshow` LEFT JOIN `UserVideos75`.`tvshowlinkpath` ON((`UserVideos75`.`tvshowlinkpath`.`idShow` = `UserVideos75`.`tvshow`.`idShow`))) LEFT JOIN `UserVideos75`.`path` ON((`UserVideos75`.`path`.`idPath` = `UserVideos75`.`tvshowlinkpath`.`idPath`))) LEFT JOIN `UserVideos75`.`episode` ON((`UserVideos75`.`episode`.`idShow` = `UserVideos75`.`tvshow`.`idShow`)) LEFT JOIN `UserVideos75`.`files` ON((`UserVideos75`.`files`.`idFile` = `UserVideos75`.`episode`.`idFile`))) GROUP BY `UserVideos75`.`tvshow`.`idShow`;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement