Guest User

xbmc mysql setup

a guest
Jan 24th, 2015
503
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   RENAME TABLE `a90`.`files` to `a90`.`globalfiles`;
  2.  
  3. ALTER TABLE `a90`.`globalfiles` CHANGE playCount PlayCount1 INT;
  4. ALTER TABLE `a90`.`globalfiles` CHANGE lastPlayed lastPlayed1 TEXT;
  5. ALTER TABLE `a90`.`globalfiles` ADD playCount2 INT(11) AFTER lastPlayed1;
  6. ALTER TABLE `a90`.`globalfiles` ADD lastPlayed2 TEXT AFTER playCount2;
  7. ALTER TABLE `a90`.`globalfiles` ADD playCount3 INT(11) AFTER lastPlayed2;
  8. ALTER TABLE `a90`.`globalfiles` ADD lastPlayed3 TEXT AFTER playCount3;
  9. ALTER TABLE `a90`.`globalfiles` ADD playCount4 INT(11) AFTER lastPlayed3;
  10. ALTER TABLE `a90`.`globalfiles` ADD lastPlayed4 TEXT AFTER playCount4;
  11. ALTER TABLE `a90`.`globalfiles` ADD playCount5 INT(11) AFTER lastPlayed4;
  12. ALTER TABLE `a90`.`globalfiles` ADD lastPlayed5 TEXT AFTER playCount5;
  13.  
  14. CREATE VIEW `a90`.`files`
  15. AS SELECT
  16.    `a90`.`globalfiles`.`idFile` AS `idFile`,
  17.    `a90`.`globalfiles`.`idPath` AS `idPath`,
  18.    `a90`.`globalfiles`.`strFilename` AS `strFilename`,
  19.    `a90`.`globalfiles`.`playCount1` AS `playCount`,
  20.    `a90`.`globalfiles`.`lastPlayed1` AS `lastPlayed`,
  21.    `a90`.`globalfiles`.`dateAdded` AS `dateAdded`
  22. FROM `a90`.`globalfiles`;
  23.  
  24. CREATE DATABASE b90;
  25.  
  26. CREATE VIEW `b90`.`actorlinkepisode` AS SELECT * FROM `a90`.`actorlinkepisode`;
  27. CREATE VIEW `b90`.`actorlinkmovie` AS SELECT * FROM `a90`.`actorlinkmovie`;
  28. CREATE VIEW `b90`.`actorlinktvshow` AS SELECT * FROM `a90`.`actorlinktvshow`;
  29. CREATE VIEW `b90`.`actors` AS SELECT * FROM `a90`.`actors`;
  30. CREATE VIEW `b90`.`art` AS SELECT * FROM `a90`.`art`;
  31. CREATE VIEW `b90`.`artistlinkmusicvideo` AS SELECT * FROM `a90`.`artistlinkmusicvideo`;
  32. CREATE VIEW `b90`.`country` AS SELECT * FROM `a90`.`country`;
  33. CREATE VIEW `b90`.`countrylinkmovie` AS SELECT * FROM `a90`.`countrylinkmovie`;
  34. CREATE VIEW `b90`.`directorlinkepisode` AS SELECT * FROM `a90`.`directorlinkepisode`;
  35. CREATE VIEW `b90`.`directorlinkmovie` AS SELECT * FROM `a90`.`directorlinkmovie`;
  36. CREATE VIEW `b90`.`directorlinkmusicvideo` AS SELECT * FROM `a90`.`directorlinkmusicvideo`;
  37. CREATE VIEW `b90`.`directorlinktvshow` AS SELECT * FROM `a90`.`directorlinktvshow`;
  38. CREATE VIEW `b90`.`episode` AS SELECT * FROM `a90`.`episode`;
  39. CREATE VIEW `b90`.`genre` AS SELECT * FROM `a90`.`genre`;
  40. CREATE VIEW `b90`.`genrelinkmovie` AS SELECT * FROM `a90`.`genrelinkmovie`;
  41. CREATE VIEW `b90`.`genrelinkmusicvideo` AS SELECT * FROM `a90`.`genrelinkmusicvideo`;
  42. CREATE VIEW `b90`.`genrelinktvshow` AS SELECT * FROM `a90`.`genrelinktvshow`;
  43. CREATE VIEW `b90`.`movie` AS SELECT * FROM `a90`.`movie`;
  44. CREATE VIEW `b90`.`movielinktvshow` AS SELECT * FROM `a90`.`movielinktvshow`;
  45. CREATE VIEW `b90`.`musicvideo` AS SELECT * FROM `a90`.`musicvideo`;
  46. CREATE VIEW `b90`.`path` AS SELECT * FROM `a90`.`path`;
  47. CREATE VIEW `b90`.`seasons` AS SELECT * FROM `a90`.`seasons`;
  48. CREATE VIEW `b90`.`sets` AS SELECT * FROM `a90`.`sets`;
  49. CREATE VIEW `b90`.`settings` AS SELECT * FROM `a90`.`settings`;
  50. CREATE VIEW `b90`.`stacktimes` AS SELECT * FROM `a90`.`stacktimes`;
  51. CREATE VIEW `b90`.`streamdetails` AS SELECT * FROM `a90`.`streamdetails`;
  52. CREATE VIEW `b90`.`studio` AS SELECT * FROM `a90`.`studio`;
  53. CREATE VIEW `b90`.`studiolinkmovie` AS SELECT * FROM `a90`.`studiolinkmovie`;
  54. CREATE VIEW `b90`.`studiolinkmusicvideo` AS SELECT * FROM `a90`.`studiolinkmusicvideo`;
  55. CREATE VIEW `b90`.`studiolinktvshow` AS SELECT * FROM `a90`.`studiolinktvshow`;
  56. CREATE VIEW `b90`.`tag` AS SELECT * FROM `a90`.`tag`;
  57. CREATE VIEW `b90`.`taglinks` AS SELECT * FROM `a90`.`taglinks`;
  58. CREATE VIEW `b90`.`tvshow` AS SELECT * FROM `a90`.`tvshow`;
  59. CREATE VIEW `b90`.`tvshowlinkpath` AS SELECT * FROM `a90`.`tvshowlinkpath`;
  60. CREATE VIEW `b90`.`version` AS SELECT * FROM `a90`.`version`;
  61. CREATE VIEW `b90`.`writerlinkepisode` AS SELECT * FROM `a90`.`writerlinkepisode`;
  62. CREATE VIEW `b90`.`writerlinkmovie` AS SELECT * FROM `a90`.`writerlinkmovie`;
  63.  
  64. CREATE VIEW `b90`.`files`
  65. AS SELECT
  66.    `a90`.`globalfiles`.`idFile` AS `idFile`,
  67.    `a90`.`globalfiles`.`idPath` AS `idPath`,
  68.    `a90`.`globalfiles`.`strFilename` AS `strFilename`,
  69.    `a90`.`globalfiles`.`playCount2` AS `playCount`,
  70.    `a90`.`globalfiles`.`lastPlayed2` AS `lastPlayed`,
  71.    `a90`.`globalfiles`.`dateAdded` AS `dateAdded`
  72. FROM `a90`.`globalfiles`;
  73.  
  74. CREATE TABLE `b90`.`bookmark` (
  75.   `idBookmark` int(11) NOT NULL AUTO_INCREMENT,
  76.   `idFile` int(11) DEFAULT NULL,
  77.   `timeInSeconds` double DEFAULT NULL,
  78.   `totalTimeInSeconds` double DEFAULT NULL,
  79.   `thumbNailImage` text,
  80.   `player` text,
  81.   `playerState` text,
  82.   `type` int(11) DEFAULT NULL,
  83.   PRIMARY KEY (`idBookmark`),
  84.   KEY `ix_bookmark` (`idFile`,`type`)
  85. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  86.  
  87. CREATE VIEW `b90`.`episodeview`
  88. AS SELECT
  89.    `episode`.`idEpisode` AS `idEpisode`,
  90.    `episode`.`idFile` AS `idFile`,
  91.    `episode`.`c00` AS `c00`,
  92.    `episode`.`c01` AS `c01`,
  93.    `episode`.`c02` AS `c02`,
  94.    `episode`.`c03` AS `c03`,
  95.    `episode`.`c04` AS `c04`,
  96.    `episode`.`c05` AS `c05`,
  97.    `episode`.`c06` AS `c06`,
  98.    `episode`.`c07` AS `c07`,
  99.    `episode`.`c08` AS `c08`,
  100.    `episode`.`c09` AS `c09`,
  101.    `episode`.`c10` AS `c10`,
  102.    `episode`.`c11` AS `c11`,
  103.    `episode`.`c12` AS `c12`,
  104.    `episode`.`c13` AS `c13`,
  105.    `episode`.`c14` AS `c14`,
  106.    `episode`.`c15` AS `c15`,
  107.    `episode`.`c16` AS `c16`,
  108.    `episode`.`c17` AS `c17`,
  109.    `episode`.`c18` AS `c18`,
  110.    `episode`.`c19` AS `c19`,
  111.    `episode`.`c20` AS `c20`,
  112.    `episode`.`c21` AS `c21`,
  113.    `episode`.`c22` AS `c22`,
  114.    `episode`.`c23` AS `c23`,
  115.    `episode`.`idShow` AS `idShow`,
  116.    `files`.`strFilename` AS `strFileName`,
  117.    `path`.`strPath` AS `strPath`,
  118.    `files`.`playCount` AS `playCount`,
  119.    `files`.`lastPlayed` AS `lastPlayed`,
  120.    `files`.`dateAdded` AS `dateAdded`,
  121.    `tvshow`.`c00` AS `strTitle`,
  122.    `tvshow`.`c14` AS `strStudio`,
  123.    `tvshow`.`c05` AS `premiered`,
  124.    `tvshow`.`c13` AS `mpaa`,
  125.    `tvshow`.`c16` AS `strShowPath`,
  126.    `b90`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
  127.    `b90`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`,
  128.    `seasons`.`idSeason` AS `idSeason`
  129. FROM (((((`b90`.`episode` join `b90`.`files` on((`files`.`idFile` = `episode`.`idFile`))) join `b90`.`tvshow` on((`tvshow`.`idShow` = `episode`.`idShow`))) left join `b90`.`seasons` on(((`seasons`.`idShow` = `episode`.`idShow`) and (`seasons`.`season` = `episode`.`c12`)))) join `b90`.`path` on((`files`.`idPath` = `path`.`idPath`))) left join `b90`.`bookmark` on(((`b90`.`bookmark`.`idFile` = `episode`.`idFile`) and (`b90`.`bookmark`.`type` = 1))));
  130.  
  131. CREATE VIEW `b90`.`movieview`
  132. AS SELECT
  133.    `movie`.`idMovie` AS `idMovie`,
  134.    `movie`.`idFile` AS `idFile`,
  135.    `movie`.`c00` AS `c00`,
  136.    `movie`.`c01` AS `c01`,
  137.    `movie`.`c02` AS `c02`,
  138.    `movie`.`c03` AS `c03`,
  139.    `movie`.`c04` AS `c04`,
  140.    `movie`.`c05` AS `c05`,
  141.    `movie`.`c06` AS `c06`,
  142.    `movie`.`c07` AS `c07`,
  143.    `movie`.`c08` AS `c08`,
  144.    `movie`.`c09` AS `c09`,
  145.    `movie`.`c10` AS `c10`,
  146.    `movie`.`c11` AS `c11`,
  147.    `movie`.`c12` AS `c12`,
  148.    `movie`.`c13` AS `c13`,
  149.    `movie`.`c14` AS `c14`,
  150.    `movie`.`c15` AS `c15`,
  151.    `movie`.`c16` AS `c16`,
  152.    `movie`.`c17` AS `c17`,
  153.    `movie`.`c18` AS `c18`,
  154.    `movie`.`c19` AS `c19`,
  155.    `movie`.`c20` AS `c20`,
  156.    `movie`.`c21` AS `c21`,
  157.    `movie`.`c22` AS `c22`,
  158.    `movie`.`c23` AS `c23`,
  159.    `movie`.`idSet` AS `idSet`,
  160.    `sets`.`strSet` AS `strSet`,
  161.    `files`.`strFilename` AS `strFileName`,
  162.    `path`.`strPath` AS `strPath`,
  163.    `files`.`playCount` AS `playCount`,
  164.    `files`.`lastPlayed` AS `lastPlayed`,
  165.    `files`.`dateAdded` AS `dateAdded`,
  166.    `b90`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
  167.    `b90`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`
  168. FROM ((((`b90`.`movie` left join `b90`.`sets` on((`sets`.`idSet` = `movie`.`idSet`))) join `b90`.`files` on((`files`.`idFile` = `movie`.`idFile`))) join `b90`.`path` on((`path`.`idPath` = `files`.`idPath`))) left join `b90`.`bookmark` on(((`b90`.`bookmark`.`idFile` = `movie`.`idFile`) and (`b90`.`bookmark`.`type` = 1))));
  169.  
  170. CREATE VIEW `b90`.`musicvideoview`
  171. AS SELECT
  172.    `musicvideo`.`idMVideo` AS `idMVideo`,
  173.    `musicvideo`.`idFile` AS `idFile`,
  174.    `musicvideo`.`c00` AS `c00`,
  175.    `musicvideo`.`c01` AS `c01`,
  176.    `musicvideo`.`c02` AS `c02`,
  177.    `musicvideo`.`c03` AS `c03`,
  178.    `musicvideo`.`c04` AS `c04`,
  179.    `musicvideo`.`c05` AS `c05`,
  180.    `musicvideo`.`c06` AS `c06`,
  181.    `musicvideo`.`c07` AS `c07`,
  182.    `musicvideo`.`c08` AS `c08`,
  183.    `musicvideo`.`c09` AS `c09`,
  184.    `musicvideo`.`c10` AS `c10`,
  185.    `musicvideo`.`c11` AS `c11`,
  186.    `musicvideo`.`c12` AS `c12`,
  187.    `musicvideo`.`c13` AS `c13`,
  188.    `musicvideo`.`c14` AS `c14`,
  189.    `musicvideo`.`c15` AS `c15`,
  190.    `musicvideo`.`c16` AS `c16`,
  191.    `musicvideo`.`c17` AS `c17`,
  192.    `musicvideo`.`c18` AS `c18`,
  193.    `musicvideo`.`c19` AS `c19`,
  194.    `musicvideo`.`c20` AS `c20`,
  195.    `musicvideo`.`c21` AS `c21`,
  196.    `musicvideo`.`c22` AS `c22`,
  197.    `musicvideo`.`c23` AS `c23`,
  198.    `files`.`strFilename` AS `strFileName`,
  199.    `path`.`strPath` AS `strPath`,
  200.    `files`.`playCount` AS `playCount`,
  201.    `files`.`lastPlayed` AS `lastPlayed`,
  202.    `files`.`dateAdded` AS `dateAdded`,
  203.    `b90`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
  204.    `b90`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`
  205. FROM (((`b90`.`musicvideo` join `b90`.`files` on((`files`.`idFile` = `musicvideo`.`idFile`))) join `b90`.`path` on((`path`.`idPath` = `files`.`idPath`))) left join `b90`.`bookmark` on(((`b90`.`bookmark`.`idFile` = `musicvideo`.`idFile`) and (`b90`.`bookmark`.`type` = 1))));
  206.  
  207. CREATE VIEW `b90`.`tvshowview`
  208. AS SELECT
  209.    `tvshow`.`idShow` AS `idShow`,
  210.    `tvshow`.`c00` AS `c00`,
  211.    `tvshow`.`c01` AS `c01`,
  212.    `tvshow`.`c02` AS `c02`,
  213.    `tvshow`.`c03` AS `c03`,
  214.    `tvshow`.`c04` AS `c04`,
  215.    `tvshow`.`c05` AS `c05`,
  216.    `tvshow`.`c06` AS `c06`,
  217.    `tvshow`.`c07` AS `c07`,
  218.    `tvshow`.`c08` AS `c08`,
  219.    `tvshow`.`c09` AS `c09`,
  220.    `tvshow`.`c10` AS `c10`,
  221.    `tvshow`.`c11` AS `c11`,
  222.    `tvshow`.`c12` AS `c12`,
  223.    `tvshow`.`c13` AS `c13`,
  224.    `tvshow`.`c14` AS `c14`,
  225.    `tvshow`.`c15` AS `c15`,
  226.    `tvshow`.`c16` AS `c16`,
  227.    `tvshow`.`c17` AS `c17`,
  228.    `tvshow`.`c18` AS `c18`,
  229.    `tvshow`.`c19` AS `c19`,
  230.    `tvshow`.`c20` AS `c20`,
  231.    `tvshow`.`c21` AS `c21`,
  232.    `tvshow`.`c22` AS `c22`,
  233.    `tvshow`.`c23` AS `c23`,
  234.    `path`.`idParentPath` AS `idParentPath`,
  235.    `path`.`strPath` AS `strPath`,
  236.    `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`
  237. FROM ((((`b90`.`tvshow` left join `b90`.`tvshowlinkpath` on((`tvshowlinkpath`.`idShow` = `tvshow`.`idShow`))) left join `b90`.`path` on((`path`.`idPath` = `tvshowlinkpath`.`idPath`))) left join `b90`.`episode` on((`episode`.`idShow` = `tvshow`.`idShow`))) left join `b90`.`files` on((`files`.`idFile` = `episode`.`idFile`))) group by `tvshow`.`idShow`;
  238.  
  239. CREATE DATABASE c90;
  240.  
  241. CREATE VIEW `c90`.`actorlinkepisode` AS SELECT * FROM `a90`.`actorlinkepisode`;
  242. CREATE VIEW `c90`.`actorlinkmovie` AS SELECT * FROM `a90`.`actorlinkmovie`;
  243. CREATE VIEW `c90`.`actorlinktvshow` AS SELECT * FROM `a90`.`actorlinktvshow`;
  244. CREATE VIEW `c90`.`actors` AS SELECT * FROM `a90`.`actors`;
  245. CREATE VIEW `c90`.`art` AS SELECT * FROM `a90`.`art`;
  246. CREATE VIEW `c90`.`artistlinkmusicvideo` AS SELECT * FROM `a90`.`artistlinkmusicvideo`;
  247. CREATE VIEW `c90`.`country` AS SELECT * FROM `a90`.`country`;
  248. CREATE VIEW `c90`.`countrylinkmovie` AS SELECT * FROM `a90`.`countrylinkmovie`;
  249. CREATE VIEW `c90`.`directorlinkepisode` AS SELECT * FROM `a90`.`directorlinkepisode`;
  250. CREATE VIEW `c90`.`directorlinkmovie` AS SELECT * FROM `a90`.`directorlinkmovie`;
  251. CREATE VIEW `c90`.`directorlinkmusicvideo` AS SELECT * FROM `a90`.`directorlinkmusicvideo`;
  252. CREATE VIEW `c90`.`directorlinktvshow` AS SELECT * FROM `a90`.`directorlinktvshow`;
  253. CREATE VIEW `c90`.`episode` AS SELECT * FROM `a90`.`episode`;
  254. CREATE VIEW `c90`.`genre` AS SELECT * FROM `a90`.`genre`;
  255. CREATE VIEW `c90`.`genrelinkmovie` AS SELECT * FROM `a90`.`genrelinkmovie`;
  256. CREATE VIEW `c90`.`genrelinkmusicvideo` AS SELECT * FROM `a90`.`genrelinkmusicvideo`;
  257. CREATE VIEW `c90`.`genrelinktvshow` AS SELECT * FROM `a90`.`genrelinktvshow`;
  258. CREATE VIEW `c90`.`movie` AS SELECT * FROM `a90`.`movie`;
  259. CREATE VIEW `c90`.`movielinktvshow` AS SELECT * FROM `a90`.`movielinktvshow`;
  260. CREATE VIEW `c90`.`musicvideo` AS SELECT * FROM `a90`.`musicvideo`;
  261. CREATE VIEW `c90`.`path` AS SELECT * FROM `a90`.`path`;
  262. CREATE VIEW `c90`.`seasons` AS SELECT * FROM `a90`.`seasons`;
  263. CREATE VIEW `c90`.`sets` AS SELECT * FROM `a90`.`sets`;
  264. CREATE VIEW `c90`.`settings` AS SELECT * FROM `a90`.`settings`;
  265. CREATE VIEW `c90`.`stacktimes` AS SELECT * FROM `a90`.`stacktimes`;
  266. CREATE VIEW `c90`.`streamdetails` AS SELECT * FROM `a90`.`streamdetails`;
  267. CREATE VIEW `c90`.`studio` AS SELECT * FROM `a90`.`studio`;
  268. CREATE VIEW `c90`.`studiolinkmovie` AS SELECT * FROM `a90`.`studiolinkmovie`;
  269. CREATE VIEW `c90`.`studiolinkmusicvideo` AS SELECT * FROM `a90`.`studiolinkmusicvideo`;
  270. CREATE VIEW `c90`.`studiolinktvshow` AS SELECT * FROM `a90`.`studiolinktvshow`;
  271. CREATE VIEW `c90`.`tag` AS SELECT * FROM `a90`.`tag`;
  272. CREATE VIEW `c90`.`taglinks` AS SELECT * FROM `a90`.`taglinks`;
  273. CREATE VIEW `c90`.`tvshow` AS SELECT * FROM `a90`.`tvshow`;
  274. CREATE VIEW `c90`.`tvshowlinkpath` AS SELECT * FROM `a90`.`tvshowlinkpath`;
  275. CREATE VIEW `c90`.`version` AS SELECT * FROM `a90`.`version`;
  276. CREATE VIEW `c90`.`writerlinkepisode` AS SELECT * FROM `a90`.`writerlinkepisode`;
  277. CREATE VIEW `c90`.`writerlinkmovie` AS SELECT * FROM `a90`.`writerlinkmovie`;
  278.  
  279. CREATE VIEW `c90`.`files`
  280. AS SELECT
  281.    `a90`.`globalfiles`.`idFile` AS `idFile`,
  282.    `a90`.`globalfiles`.`idPath` AS `idPath`,
  283.    `a90`.`globalfiles`.`strFilename` AS `strFilename`,
  284.    `a90`.`globalfiles`.`playCount3` AS `playCount`,
  285.    `a90`.`globalfiles`.`lastPlayed3` AS `lastPlayed`,
  286.    `a90`.`globalfiles`.`dateAdded` AS `dateAdded`
  287. FROM `a90`.`globalfiles`;
  288.  
  289. CREATE TABLE `c90`.`bookmark` (
  290.   `idBookmark` int(11) NOT NULL AUTO_INCREMENT,
  291.   `idFile` int(11) DEFAULT NULL,
  292.   `timeInSeconds` double DEFAULT NULL,
  293.   `totalTimeInSeconds` double DEFAULT NULL,
  294.   `thumbNailImage` text,
  295.   `player` text,
  296.   `playerState` text,
  297.   `type` int(11) DEFAULT NULL,
  298.   PRIMARY KEY (`idBookmark`),
  299.   KEY `ix_bookmark` (`idFile`,`type`)
  300. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  301.  
  302. CREATE VIEW `c90`.`episodeview`
  303. AS SELECT
  304.    `episode`.`idEpisode` AS `idEpisode`,
  305.    `episode`.`idFile` AS `idFile`,
  306.    `episode`.`c00` AS `c00`,
  307.    `episode`.`c01` AS `c01`,
  308.    `episode`.`c02` AS `c02`,
  309.    `episode`.`c03` AS `c03`,
  310.    `episode`.`c04` AS `c04`,
  311.    `episode`.`c05` AS `c05`,
  312.    `episode`.`c06` AS `c06`,
  313.    `episode`.`c07` AS `c07`,
  314.    `episode`.`c08` AS `c08`,
  315.    `episode`.`c09` AS `c09`,
  316.    `episode`.`c10` AS `c10`,
  317.    `episode`.`c11` AS `c11`,
  318.    `episode`.`c12` AS `c12`,
  319.    `episode`.`c13` AS `c13`,
  320.    `episode`.`c14` AS `c14`,
  321.    `episode`.`c15` AS `c15`,
  322.    `episode`.`c16` AS `c16`,
  323.    `episode`.`c17` AS `c17`,
  324.    `episode`.`c18` AS `c18`,
  325.    `episode`.`c19` AS `c19`,
  326.    `episode`.`c20` AS `c20`,
  327.    `episode`.`c21` AS `c21`,
  328.    `episode`.`c22` AS `c22`,
  329.    `episode`.`c23` AS `c23`,
  330.    `episode`.`idShow` AS `idShow`,
  331.    `files`.`strFilename` AS `strFileName`,
  332.    `path`.`strPath` AS `strPath`,
  333.    `files`.`playCount` AS `playCount`,
  334.    `files`.`lastPlayed` AS `lastPlayed`,
  335.    `files`.`dateAdded` AS `dateAdded`,
  336.    `tvshow`.`c00` AS `strTitle`,
  337.    `tvshow`.`c14` AS `strStudio`,
  338.    `tvshow`.`c05` AS `premiered`,
  339.    `tvshow`.`c13` AS `mpaa`,
  340.    `tvshow`.`c16` AS `strShowPath`,
  341.    `c90`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
  342.    `c90`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`,
  343.    `seasons`.`idSeason` AS `idSeason`
  344. FROM (((((`c90`.`episode` join `c90`.`files` on((`files`.`idFile` = `episode`.`idFile`))) join `c90`.`tvshow` on((`tvshow`.`idShow` = `episode`.`idShow`))) left join `c90`.`seasons` on(((`seasons`.`idShow` = `episode`.`idShow`) and (`seasons`.`season` = `episode`.`c12`)))) join `c90`.`path` on((`files`.`idPath` = `path`.`idPath`))) left join `c90`.`bookmark` on(((`c90`.`bookmark`.`idFile` = `episode`.`idFile`) and (`c90`.`bookmark`.`type` = 1))));
  345.  
  346. CREATE VIEW `c90`.`movieview`
  347. AS SELECT
  348.    `movie`.`idMovie` AS `idMovie`,
  349.    `movie`.`idFile` AS `idFile`,
  350.    `movie`.`c00` AS `c00`,
  351.    `movie`.`c01` AS `c01`,
  352.    `movie`.`c02` AS `c02`,
  353.    `movie`.`c03` AS `c03`,
  354.    `movie`.`c04` AS `c04`,
  355.    `movie`.`c05` AS `c05`,
  356.    `movie`.`c06` AS `c06`,
  357.    `movie`.`c07` AS `c07`,
  358.    `movie`.`c08` AS `c08`,
  359.    `movie`.`c09` AS `c09`,
  360.    `movie`.`c10` AS `c10`,
  361.    `movie`.`c11` AS `c11`,
  362.    `movie`.`c12` AS `c12`,
  363.    `movie`.`c13` AS `c13`,
  364.    `movie`.`c14` AS `c14`,
  365.    `movie`.`c15` AS `c15`,
  366.    `movie`.`c16` AS `c16`,
  367.    `movie`.`c17` AS `c17`,
  368.    `movie`.`c18` AS `c18`,
  369.    `movie`.`c19` AS `c19`,
  370.    `movie`.`c20` AS `c20`,
  371.    `movie`.`c21` AS `c21`,
  372.    `movie`.`c22` AS `c22`,
  373.    `movie`.`c23` AS `c23`,
  374.    `movie`.`idSet` AS `idSet`,
  375.    `sets`.`strSet` AS `strSet`,
  376.    `files`.`strFilename` AS `strFileName`,
  377.    `path`.`strPath` AS `strPath`,
  378.    `files`.`playCount` AS `playCount`,
  379.    `files`.`lastPlayed` AS `lastPlayed`,
  380.    `files`.`dateAdded` AS `dateAdded`,
  381.    `c90`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
  382.    `c90`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`
  383. FROM ((((`c90`.`movie` left join `c90`.`sets` on((`sets`.`idSet` = `movie`.`idSet`))) join `c90`.`files` on((`files`.`idFile` = `movie`.`idFile`))) join `c90`.`path` on((`path`.`idPath` = `files`.`idPath`))) left join `c90`.`bookmark` on(((`c90`.`bookmark`.`idFile` = `movie`.`idFile`) and (`c90`.`bookmark`.`type` = 1))));
  384.  
  385. CREATE VIEW `c90`.`musicvideoview`
  386. AS SELECT
  387.    `musicvideo`.`idMVideo` AS `idMVideo`,
  388.    `musicvideo`.`idFile` AS `idFile`,
  389.    `musicvideo`.`c00` AS `c00`,
  390.    `musicvideo`.`c01` AS `c01`,
  391.    `musicvideo`.`c02` AS `c02`,
  392.    `musicvideo`.`c03` AS `c03`,
  393.    `musicvideo`.`c04` AS `c04`,
  394.    `musicvideo`.`c05` AS `c05`,
  395.    `musicvideo`.`c06` AS `c06`,
  396.    `musicvideo`.`c07` AS `c07`,
  397.    `musicvideo`.`c08` AS `c08`,
  398.    `musicvideo`.`c09` AS `c09`,
  399.    `musicvideo`.`c10` AS `c10`,
  400.    `musicvideo`.`c11` AS `c11`,
  401.    `musicvideo`.`c12` AS `c12`,
  402.    `musicvideo`.`c13` AS `c13`,
  403.    `musicvideo`.`c14` AS `c14`,
  404.    `musicvideo`.`c15` AS `c15`,
  405.    `musicvideo`.`c16` AS `c16`,
  406.    `musicvideo`.`c17` AS `c17`,
  407.    `musicvideo`.`c18` AS `c18`,
  408.    `musicvideo`.`c19` AS `c19`,
  409.    `musicvideo`.`c20` AS `c20`,
  410.    `musicvideo`.`c21` AS `c21`,
  411.    `musicvideo`.`c22` AS `c22`,
  412.    `musicvideo`.`c23` AS `c23`,
  413.    `files`.`strFilename` AS `strFileName`,
  414.    `path`.`strPath` AS `strPath`,
  415.    `files`.`playCount` AS `playCount`,
  416.    `files`.`lastPlayed` AS `lastPlayed`,
  417.    `files`.`dateAdded` AS `dateAdded`,
  418.    `c90`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
  419.    `c90`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`
  420. FROM (((`c90`.`musicvideo` join `c90`.`files` on((`files`.`idFile` = `musicvideo`.`idFile`))) join `c90`.`path` on((`path`.`idPath` = `files`.`idPath`))) left join `c90`.`bookmark` on(((`c90`.`bookmark`.`idFile` = `musicvideo`.`idFile`) and (`c90`.`bookmark`.`type` = 1))));
  421.  
  422. CREATE VIEW `c90`.`tvshowview`
  423. AS SELECT
  424.    `tvshow`.`idShow` AS `idShow`,
  425.    `tvshow`.`c00` AS `c00`,
  426.    `tvshow`.`c01` AS `c01`,
  427.    `tvshow`.`c02` AS `c02`,
  428.    `tvshow`.`c03` AS `c03`,
  429.    `tvshow`.`c04` AS `c04`,
  430.    `tvshow`.`c05` AS `c05`,
  431.    `tvshow`.`c06` AS `c06`,
  432.    `tvshow`.`c07` AS `c07`,
  433.    `tvshow`.`c08` AS `c08`,
  434.    `tvshow`.`c09` AS `c09`,
  435.    `tvshow`.`c10` AS `c10`,
  436.    `tvshow`.`c11` AS `c11`,
  437.    `tvshow`.`c12` AS `c12`,
  438.    `tvshow`.`c13` AS `c13`,
  439.    `tvshow`.`c14` AS `c14`,
  440.    `tvshow`.`c15` AS `c15`,
  441.    `tvshow`.`c16` AS `c16`,
  442.    `tvshow`.`c17` AS `c17`,
  443.    `tvshow`.`c18` AS `c18`,
  444.    `tvshow`.`c19` AS `c19`,
  445.    `tvshow`.`c20` AS `c20`,
  446.    `tvshow`.`c21` AS `c21`,
  447.    `tvshow`.`c22` AS `c22`,
  448.    `tvshow`.`c23` AS `c23`,
  449.    `path`.`idParentPath` AS `idParentPath`,
  450.    `path`.`strPath` AS `strPath`,
  451.    `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`
  452. FROM ((((`c90`.`tvshow` left join `c90`.`tvshowlinkpath` on((`tvshowlinkpath`.`idShow` = `tvshow`.`idShow`))) left join `c90`.`path` on((`path`.`idPath` = `tvshowlinkpath`.`idPath`))) left join `c90`.`episode` on((`episode`.`idShow` = `tvshow`.`idShow`))) left join `c90`.`files` on((`files`.`idFile` = `episode`.`idFile`))) group by `tvshow`.`idShow`;
  453.  
  454. CREATE DATABASE d90;
  455.  
  456. CREATE VIEW `d90`.`actorlinkepisode` AS SELECT * FROM `a90`.`actorlinkepisode`;
  457. CREATE VIEW `d90`.`actorlinkmovie` AS SELECT * FROM `a90`.`actorlinkmovie`;
  458. CREATE VIEW `d90`.`actorlinktvshow` AS SELECT * FROM `a90`.`actorlinktvshow`;
  459. CREATE VIEW `d90`.`actors` AS SELECT * FROM `a90`.`actors`;
  460. CREATE VIEW `d90`.`art` AS SELECT * FROM `a90`.`art`;
  461. CREATE VIEW `d90`.`artistlinkmusicvideo` AS SELECT * FROM `a90`.`artistlinkmusicvideo`;
  462. CREATE VIEW `d90`.`country` AS SELECT * FROM `a90`.`country`;
  463. CREATE VIEW `d90`.`countrylinkmovie` AS SELECT * FROM `a90`.`countrylinkmovie`;
  464. CREATE VIEW `d90`.`directorlinkepisode` AS SELECT * FROM `a90`.`directorlinkepisode`;
  465. CREATE VIEW `d90`.`directorlinkmovie` AS SELECT * FROM `a90`.`directorlinkmovie`;
  466. CREATE VIEW `d90`.`directorlinkmusicvideo` AS SELECT * FROM `a90`.`directorlinkmusicvideo`;
  467. CREATE VIEW `d90`.`directorlinktvshow` AS SELECT * FROM `a90`.`directorlinktvshow`;
  468. CREATE VIEW `d90`.`episode` AS SELECT * FROM `a90`.`episode`;
  469. CREATE VIEW `d90`.`genre` AS SELECT * FROM `a90`.`genre`;
  470. CREATE VIEW `d90`.`genrelinkmovie` AS SELECT * FROM `a90`.`genrelinkmovie`;
  471. CREATE VIEW `d90`.`genrelinkmusicvideo` AS SELECT * FROM `a90`.`genrelinkmusicvideo`;
  472. CREATE VIEW `d90`.`genrelinktvshow` AS SELECT * FROM `a90`.`genrelinktvshow`;
  473. CREATE VIEW `d90`.`movie` AS SELECT * FROM `a90`.`movie`;
  474. CREATE VIEW `d90`.`movielinktvshow` AS SELECT * FROM `a90`.`movielinktvshow`;
  475. CREATE VIEW `d90`.`musicvideo` AS SELECT * FROM `a90`.`musicvideo`;
  476. CREATE VIEW `d90`.`path` AS SELECT * FROM `a90`.`path`;
  477. CREATE VIEW `d90`.`seasons` AS SELECT * FROM `a90`.`seasons`;
  478. CREATE VIEW `d90`.`sets` AS SELECT * FROM `a90`.`sets`;
  479. CREATE VIEW `d90`.`settings` AS SELECT * FROM `a90`.`settings`;
  480. CREATE VIEW `d90`.`stacktimes` AS SELECT * FROM `a90`.`stacktimes`;
  481. CREATE VIEW `d90`.`streamdetails` AS SELECT * FROM `a90`.`streamdetails`;
  482. CREATE VIEW `d90`.`studio` AS SELECT * FROM `a90`.`studio`;
  483. CREATE VIEW `d90`.`studiolinkmovie` AS SELECT * FROM `a90`.`studiolinkmovie`;
  484. CREATE VIEW `d90`.`studiolinkmusicvideo` AS SELECT * FROM `a90`.`studiolinkmusicvideo`;
  485. CREATE VIEW `d90`.`studiolinktvshow` AS SELECT * FROM `a90`.`studiolinktvshow`;
  486. CREATE VIEW `d90`.`tag` AS SELECT * FROM `a90`.`tag`;
  487. CREATE VIEW `d90`.`taglinks` AS SELECT * FROM `a90`.`taglinks`;
  488. CREATE VIEW `d90`.`tvshow` AS SELECT * FROM `a90`.`tvshow`;
  489. CREATE VIEW `d90`.`tvshowlinkpath` AS SELECT * FROM `a90`.`tvshowlinkpath`;
  490. CREATE VIEW `d90`.`version` AS SELECT * FROM `a90`.`version`;
  491. CREATE VIEW `d90`.`writerlinkepisode` AS SELECT * FROM `a90`.`writerlinkepisode`;
  492. CREATE VIEW `d90`.`writerlinkmovie` AS SELECT * FROM `a90`.`writerlinkmovie`;
  493.  
  494. CREATE VIEW `d90`.`files`
  495. AS SELECT
  496.    `a90`.`globalfiles`.`idFile` AS `idFile`,
  497.    `a90`.`globalfiles`.`idPath` AS `idPath`,
  498.    `a90`.`globalfiles`.`strFilename` AS `strFilename`,
  499.    `a90`.`globalfiles`.`playCount4` AS `playCount`,
  500.    `a90`.`globalfiles`.`lastPlayed4` AS `lastPlayed`,
  501.    `a90`.`globalfiles`.`dateAdded` AS `dateAdded`
  502. FROM `a90`.`globalfiles`;
  503.  
  504. CREATE TABLE `d90`.`bookmark` (
  505.   `idBookmark` int(11) NOT NULL AUTO_INCREMENT,
  506.   `idFile` int(11) DEFAULT NULL,
  507.   `timeInSeconds` double DEFAULT NULL,
  508.   `totalTimeInSeconds` double DEFAULT NULL,
  509.   `thumbNailImage` text,
  510.   `player` text,
  511.   `playerState` text,
  512.   `type` int(11) DEFAULT NULL,
  513.   PRIMARY KEY (`idBookmark`),
  514.   KEY `ix_bookmark` (`idFile`,`type`)
  515. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  516.  
  517. CREATE VIEW `d90`.`episodeview`
  518. AS SELECT
  519.    `episode`.`idEpisode` AS `idEpisode`,
  520.    `episode`.`idFile` AS `idFile`,
  521.    `episode`.`c00` AS `c00`,
  522.    `episode`.`c01` AS `c01`,
  523.    `episode`.`c02` AS `c02`,
  524.    `episode`.`c03` AS `c03`,
  525.    `episode`.`c04` AS `c04`,
  526.    `episode`.`c05` AS `c05`,
  527.    `episode`.`c06` AS `c06`,
  528.    `episode`.`c07` AS `c07`,
  529.    `episode`.`c08` AS `c08`,
  530.    `episode`.`c09` AS `c09`,
  531.    `episode`.`c10` AS `c10`,
  532.    `episode`.`c11` AS `c11`,
  533.    `episode`.`c12` AS `c12`,
  534.    `episode`.`c13` AS `c13`,
  535.    `episode`.`c14` AS `c14`,
  536.    `episode`.`c15` AS `c15`,
  537.    `episode`.`c16` AS `c16`,
  538.    `episode`.`c17` AS `c17`,
  539.    `episode`.`c18` AS `c18`,
  540.    `episode`.`c19` AS `c19`,
  541.    `episode`.`c20` AS `c20`,
  542.    `episode`.`c21` AS `c21`,
  543.    `episode`.`c22` AS `c22`,
  544.    `episode`.`c23` AS `c23`,
  545.    `episode`.`idShow` AS `idShow`,
  546.    `files`.`strFilename` AS `strFileName`,
  547.    `path`.`strPath` AS `strPath`,
  548.    `files`.`playCount` AS `playCount`,
  549.    `files`.`lastPlayed` AS `lastPlayed`,
  550.    `files`.`dateAdded` AS `dateAdded`,
  551.    `tvshow`.`c00` AS `strTitle`,
  552.    `tvshow`.`c14` AS `strStudio`,
  553.    `tvshow`.`c05` AS `premiered`,
  554.    `tvshow`.`c13` AS `mpaa`,
  555.    `tvshow`.`c16` AS `strShowPath`,
  556.    `d90`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
  557.    `d90`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`,
  558.    `seasons`.`idSeason` AS `idSeason`
  559. FROM (((((`d90`.`episode` join `d90`.`files` on((`files`.`idFile` = `episode`.`idFile`))) join `d90`.`tvshow` on((`tvshow`.`idShow` = `episode`.`idShow`))) left join `d90`.`seasons` on(((`seasons`.`idShow` = `episode`.`idShow`) and (`seasons`.`season` = `episode`.`c12`)))) join `d90`.`path` on((`files`.`idPath` = `path`.`idPath`))) left join `d90`.`bookmark` on(((`d90`.`bookmark`.`idFile` = `episode`.`idFile`) and (`d90`.`bookmark`.`type` = 1))));
  560.  
  561. CREATE VIEW `d90`.`movieview`
  562. AS SELECT
  563.    `movie`.`idMovie` AS `idMovie`,
  564.    `movie`.`idFile` AS `idFile`,
  565.    `movie`.`c00` AS `c00`,
  566.    `movie`.`c01` AS `c01`,
  567.    `movie`.`c02` AS `c02`,
  568.    `movie`.`c03` AS `c03`,
  569.    `movie`.`c04` AS `c04`,
  570.    `movie`.`c05` AS `c05`,
  571.    `movie`.`c06` AS `c06`,
  572.    `movie`.`c07` AS `c07`,
  573.    `movie`.`c08` AS `c08`,
  574.    `movie`.`c09` AS `c09`,
  575.    `movie`.`c10` AS `c10`,
  576.    `movie`.`c11` AS `c11`,
  577.    `movie`.`c12` AS `c12`,
  578.    `movie`.`c13` AS `c13`,
  579.    `movie`.`c14` AS `c14`,
  580.    `movie`.`c15` AS `c15`,
  581.    `movie`.`c16` AS `c16`,
  582.    `movie`.`c17` AS `c17`,
  583.    `movie`.`c18` AS `c18`,
  584.    `movie`.`c19` AS `c19`,
  585.    `movie`.`c20` AS `c20`,
  586.    `movie`.`c21` AS `c21`,
  587.    `movie`.`c22` AS `c22`,
  588.    `movie`.`c23` AS `c23`,
  589.    `movie`.`idSet` AS `idSet`,
  590.    `sets`.`strSet` AS `strSet`,
  591.    `files`.`strFilename` AS `strFileName`,
  592.    `path`.`strPath` AS `strPath`,
  593.    `files`.`playCount` AS `playCount`,
  594.    `files`.`lastPlayed` AS `lastPlayed`,
  595.    `files`.`dateAdded` AS `dateAdded`,
  596.    `d90`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
  597.    `d90`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`
  598. FROM ((((`d90`.`movie` left join `d90`.`sets` on((`sets`.`idSet` = `movie`.`idSet`))) join `d90`.`files` on((`files`.`idFile` = `movie`.`idFile`))) join `d90`.`path` on((`path`.`idPath` = `files`.`idPath`))) left join `d90`.`bookmark` on(((`d90`.`bookmark`.`idFile` = `movie`.`idFile`) and (`d90`.`bookmark`.`type` = 1))));
  599.  
  600. CREATE VIEW `d90`.`musicvideoview`
  601. AS SELECT
  602.    `musicvideo`.`idMVideo` AS `idMVideo`,
  603.    `musicvideo`.`idFile` AS `idFile`,
  604.    `musicvideo`.`c00` AS `c00`,
  605.    `musicvideo`.`c01` AS `c01`,
  606.    `musicvideo`.`c02` AS `c02`,
  607.    `musicvideo`.`c03` AS `c03`,
  608.    `musicvideo`.`c04` AS `c04`,
  609.    `musicvideo`.`c05` AS `c05`,
  610.    `musicvideo`.`c06` AS `c06`,
  611.    `musicvideo`.`c07` AS `c07`,
  612.    `musicvideo`.`c08` AS `c08`,
  613.    `musicvideo`.`c09` AS `c09`,
  614.    `musicvideo`.`c10` AS `c10`,
  615.    `musicvideo`.`c11` AS `c11`,
  616.    `musicvideo`.`c12` AS `c12`,
  617.    `musicvideo`.`c13` AS `c13`,
  618.    `musicvideo`.`c14` AS `c14`,
  619.    `musicvideo`.`c15` AS `c15`,
  620.    `musicvideo`.`c16` AS `c16`,
  621.    `musicvideo`.`c17` AS `c17`,
  622.    `musicvideo`.`c18` AS `c18`,
  623.    `musicvideo`.`c19` AS `c19`,
  624.    `musicvideo`.`c20` AS `c20`,
  625.    `musicvideo`.`c21` AS `c21`,
  626.    `musicvideo`.`c22` AS `c22`,
  627.    `musicvideo`.`c23` AS `c23`,
  628.    `files`.`strFilename` AS `strFileName`,
  629.    `path`.`strPath` AS `strPath`,
  630.    `files`.`playCount` AS `playCount`,
  631.    `files`.`lastPlayed` AS `lastPlayed`,
  632.    `files`.`dateAdded` AS `dateAdded`,
  633.    `d90`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
  634.    `d90`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`
  635. FROM (((`d90`.`musicvideo` join `d90`.`files` on((`files`.`idFile` = `musicvideo`.`idFile`))) join `d90`.`path` on((`path`.`idPath` = `files`.`idPath`))) left join `d90`.`bookmark` on(((`d90`.`bookmark`.`idFile` = `musicvideo`.`idFile`) and (`d90`.`bookmark`.`type` = 1))));
  636.  
  637. CREATE VIEW `d90`.`tvshowview`
  638. AS SELECT
  639.    `tvshow`.`idShow` AS `idShow`,
  640.    `tvshow`.`c00` AS `c00`,
  641.    `tvshow`.`c01` AS `c01`,
  642.    `tvshow`.`c02` AS `c02`,
  643.    `tvshow`.`c03` AS `c03`,
  644.    `tvshow`.`c04` AS `c04`,
  645.    `tvshow`.`c05` AS `c05`,
  646.    `tvshow`.`c06` AS `c06`,
  647.    `tvshow`.`c07` AS `c07`,
  648.    `tvshow`.`c08` AS `c08`,
  649.    `tvshow`.`c09` AS `c09`,
  650.    `tvshow`.`c10` AS `c10`,
  651.    `tvshow`.`c11` AS `c11`,
  652.    `tvshow`.`c12` AS `c12`,
  653.    `tvshow`.`c13` AS `c13`,
  654.    `tvshow`.`c14` AS `c14`,
  655.    `tvshow`.`c15` AS `c15`,
  656.    `tvshow`.`c16` AS `c16`,
  657.    `tvshow`.`c17` AS `c17`,
  658.    `tvshow`.`c18` AS `c18`,
  659.    `tvshow`.`c19` AS `c19`,
  660.    `tvshow`.`c20` AS `c20`,
  661.    `tvshow`.`c21` AS `c21`,
  662.    `tvshow`.`c22` AS `c22`,
  663.    `tvshow`.`c23` AS `c23`,
  664.    `path`.`idParentPath` AS `idParentPath`,
  665.    `path`.`strPath` AS `strPath`,
  666.    `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`
  667. FROM ((((`d90`.`tvshow` left join `d90`.`tvshowlinkpath` on((`tvshowlinkpath`.`idShow` = `tvshow`.`idShow`))) left join `d90`.`path` on((`path`.`idPath` = `tvshowlinkpath`.`idPath`))) left join `d90`.`episode` on((`episode`.`idShow` = `tvshow`.`idShow`))) left join `d90`.`files` on((`files`.`idFile` = `episode`.`idFile`))) group by `tvshow`.`idShow`;
  668.  
  669. CREATE DATABASE e90;
  670.  
  671. CREATE VIEW `e90`.`actorlinkepisode` AS SELECT * FROM `a90`.`actorlinkepisode`;
  672. CREATE VIEW `e90`.`actorlinkmovie` AS SELECT * FROM `a90`.`actorlinkmovie`;
  673. CREATE VIEW `e90`.`actorlinktvshow` AS SELECT * FROM `a90`.`actorlinktvshow`;
  674. CREATE VIEW `e90`.`actors` AS SELECT * FROM `a90`.`actors`;
  675. CREATE VIEW `e90`.`art` AS SELECT * FROM `a90`.`art`;
  676. CREATE VIEW `e90`.`artistlinkmusicvideo` AS SELECT * FROM `a90`.`artistlinkmusicvideo`;
  677. CREATE VIEW `e90`.`country` AS SELECT * FROM `a90`.`country`;
  678. CREATE VIEW `e90`.`countrylinkmovie` AS SELECT * FROM `a90`.`countrylinkmovie`;
  679. CREATE VIEW `e90`.`directorlinkepisode` AS SELECT * FROM `a90`.`directorlinkepisode`;
  680. CREATE VIEW `e90`.`directorlinkmovie` AS SELECT * FROM `a90`.`directorlinkmovie`;
  681. CREATE VIEW `e90`.`directorlinkmusicvideo` AS SELECT * FROM `a90`.`directorlinkmusicvideo`;
  682. CREATE VIEW `e90`.`directorlinktvshow` AS SELECT * FROM `a90`.`directorlinktvshow`;
  683. CREATE VIEW `e90`.`episode` AS SELECT * FROM `a90`.`episode`;
  684. CREATE VIEW `e90`.`genre` AS SELECT * FROM `a90`.`genre`;
  685. CREATE VIEW `e90`.`genrelinkmovie` AS SELECT * FROM `a90`.`genrelinkmovie`;
  686. CREATE VIEW `e90`.`genrelinkmusicvideo` AS SELECT * FROM `a90`.`genrelinkmusicvideo`;
  687. CREATE VIEW `e90`.`genrelinktvshow` AS SELECT * FROM `a90`.`genrelinktvshow`;
  688. CREATE VIEW `e90`.`movie` AS SELECT * FROM `a90`.`movie`;
  689. CREATE VIEW `e90`.`movielinktvshow` AS SELECT * FROM `a90`.`movielinktvshow`;
  690. CREATE VIEW `e90`.`musicvideo` AS SELECT * FROM `a90`.`musicvideo`;
  691. CREATE VIEW `e90`.`path` AS SELECT * FROM `a90`.`path`;
  692. CREATE VIEW `e90`.`seasons` AS SELECT * FROM `a90`.`seasons`;
  693. CREATE VIEW `e90`.`sets` AS SELECT * FROM `a90`.`sets`;
  694. CREATE VIEW `e90`.`settings` AS SELECT * FROM `a90`.`settings`;
  695. CREATE VIEW `e90`.`stacktimes` AS SELECT * FROM `a90`.`stacktimes`;
  696. CREATE VIEW `e90`.`streamdetails` AS SELECT * FROM `a90`.`streamdetails`;
  697. CREATE VIEW `e90`.`studio` AS SELECT * FROM `a90`.`studio`;
  698. CREATE VIEW `e90`.`studiolinkmovie` AS SELECT * FROM `a90`.`studiolinkmovie`;
  699. CREATE VIEW `e90`.`studiolinkmusicvideo` AS SELECT * FROM `a90`.`studiolinkmusicvideo`;
  700. CREATE VIEW `e90`.`studiolinktvshow` AS SELECT * FROM `a90`.`studiolinktvshow`;
  701. CREATE VIEW `e90`.`tag` AS SELECT * FROM `a90`.`tag`;
  702. CREATE VIEW `e90`.`taglinks` AS SELECT * FROM `a90`.`taglinks`;
  703. CREATE VIEW `e90`.`tvshow` AS SELECT * FROM `a90`.`tvshow`;
  704. CREATE VIEW `e90`.`tvshowlinkpath` AS SELECT * FROM `a90`.`tvshowlinkpath`;
  705. CREATE VIEW `e90`.`version` AS SELECT * FROM `a90`.`version`;
  706. CREATE VIEW `e90`.`writerlinkepisode` AS SELECT * FROM `a90`.`writerlinkepisode`;
  707. CREATE VIEW `e90`.`writerlinkmovie` AS SELECT * FROM `a90`.`writerlinkmovie`;
  708.  
  709. CREATE VIEW `e90`.`files`
  710. AS SELECT
  711.    `a90`.`globalfiles`.`idFile` AS `idFile`,
  712.    `a90`.`globalfiles`.`idPath` AS `idPath`,
  713.    `a90`.`globalfiles`.`strFilename` AS `strFilename`,
  714.    `a90`.`globalfiles`.`playCount5` AS `playCount`,
  715.    `a90`.`globalfiles`.`lastPlayed5` AS `lastPlayed`,
  716.    `a90`.`globalfiles`.`dateAdded` AS `dateAdded`
  717. FROM `a90`.`globalfiles`;
  718.  
  719. CREATE TABLE `e90`.`bookmark` (
  720.   `idBookmark` int(11) NOT NULL AUTO_INCREMENT,
  721.   `idFile` int(11) DEFAULT NULL,
  722.   `timeInSeconds` double DEFAULT NULL,
  723.   `totalTimeInSeconds` double DEFAULT NULL,
  724.   `thumbNailImage` text,
  725.   `player` text,
  726.   `playerState` text,
  727.   `type` int(11) DEFAULT NULL,
  728.   PRIMARY KEY (`idBookmark`),
  729.   KEY `ix_bookmark` (`idFile`,`type`)
  730. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  731.  
  732. CREATE VIEW `e90`.`episodeview`
  733. AS SELECT
  734.    `episode`.`idEpisode` AS `idEpisode`,
  735.    `episode`.`idFile` AS `idFile`,
  736.    `episode`.`c00` AS `c00`,
  737.    `episode`.`c01` AS `c01`,
  738.    `episode`.`c02` AS `c02`,
  739.    `episode`.`c03` AS `c03`,
  740.    `episode`.`c04` AS `c04`,
  741.    `episode`.`c05` AS `c05`,
  742.    `episode`.`c06` AS `c06`,
  743.    `episode`.`c07` AS `c07`,
  744.    `episode`.`c08` AS `c08`,
  745.    `episode`.`c09` AS `c09`,
  746.    `episode`.`c10` AS `c10`,
  747.    `episode`.`c11` AS `c11`,
  748.    `episode`.`c12` AS `c12`,
  749.    `episode`.`c13` AS `c13`,
  750.    `episode`.`c14` AS `c14`,
  751.    `episode`.`c15` AS `c15`,
  752.    `episode`.`c16` AS `c16`,
  753.    `episode`.`c17` AS `c17`,
  754.    `episode`.`c18` AS `c18`,
  755.    `episode`.`c19` AS `c19`,
  756.    `episode`.`c20` AS `c20`,
  757.    `episode`.`c21` AS `c21`,
  758.    `episode`.`c22` AS `c22`,
  759.    `episode`.`c23` AS `c23`,
  760.    `episode`.`idShow` AS `idShow`,
  761.    `files`.`strFilename` AS `strFileName`,
  762.    `path`.`strPath` AS `strPath`,
  763.    `files`.`playCount` AS `playCount`,
  764.    `files`.`lastPlayed` AS `lastPlayed`,
  765.    `files`.`dateAdded` AS `dateAdded`,
  766.    `tvshow`.`c00` AS `strTitle`,
  767.    `tvshow`.`c14` AS `strStudio`,
  768.    `tvshow`.`c05` AS `premiered`,
  769.    `tvshow`.`c13` AS `mpaa`,
  770.    `tvshow`.`c16` AS `strShowPath`,
  771.    `e90`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
  772.    `e90`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`,
  773.    `seasons`.`idSeason` AS `idSeason`
  774. FROM (((((`e90`.`episode` join `e90`.`files` on((`files`.`idFile` = `episode`.`idFile`))) join `e90`.`tvshow` on((`tvshow`.`idShow` = `episode`.`idShow`))) left join `e90`.`seasons` on(((`seasons`.`idShow` = `episode`.`idShow`) and (`seasons`.`season` = `episode`.`c12`)))) join `e90`.`path` on((`files`.`idPath` = `path`.`idPath`))) left join `e90`.`bookmark` on(((`e90`.`bookmark`.`idFile` = `episode`.`idFile`) and (`e90`.`bookmark`.`type` = 1))));
  775.  
  776. CREATE VIEW `e90`.`movieview`
  777. AS SELECT
  778.    `movie`.`idMovie` AS `idMovie`,
  779.    `movie`.`idFile` AS `idFile`,
  780.    `movie`.`c00` AS `c00`,
  781.    `movie`.`c01` AS `c01`,
  782.    `movie`.`c02` AS `c02`,
  783.    `movie`.`c03` AS `c03`,
  784.    `movie`.`c04` AS `c04`,
  785.    `movie`.`c05` AS `c05`,
  786.    `movie`.`c06` AS `c06`,
  787.    `movie`.`c07` AS `c07`,
  788.    `movie`.`c08` AS `c08`,
  789.    `movie`.`c09` AS `c09`,
  790.    `movie`.`c10` AS `c10`,
  791.    `movie`.`c11` AS `c11`,
  792.    `movie`.`c12` AS `c12`,
  793.    `movie`.`c13` AS `c13`,
  794.    `movie`.`c14` AS `c14`,
  795.    `movie`.`c15` AS `c15`,
  796.    `movie`.`c16` AS `c16`,
  797.    `movie`.`c17` AS `c17`,
  798.    `movie`.`c18` AS `c18`,
  799.    `movie`.`c19` AS `c19`,
  800.    `movie`.`c20` AS `c20`,
  801.    `movie`.`c21` AS `c21`,
  802.    `movie`.`c22` AS `c22`,
  803.    `movie`.`c23` AS `c23`,
  804.    `movie`.`idSet` AS `idSet`,
  805.    `sets`.`strSet` AS `strSet`,
  806.    `files`.`strFilename` AS `strFileName`,
  807.    `path`.`strPath` AS `strPath`,
  808.    `files`.`playCount` AS `playCount`,
  809.    `files`.`lastPlayed` AS `lastPlayed`,
  810.    `files`.`dateAdded` AS `dateAdded`,
  811.    `e90`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
  812.    `e90`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`
  813. FROM ((((`e90`.`movie` left join `e90`.`sets` on((`sets`.`idSet` = `movie`.`idSet`))) join `e90`.`files` on((`files`.`idFile` = `movie`.`idFile`))) join `e90`.`path` on((`path`.`idPath` = `files`.`idPath`))) left join `e90`.`bookmark` on(((`e90`.`bookmark`.`idFile` = `movie`.`idFile`) and (`e90`.`bookmark`.`type` = 1))));
  814.  
  815. CREATE VIEW `e90`.`musicvideoview`
  816. AS SELECT
  817.    `musicvideo`.`idMVideo` AS `idMVideo`,
  818.    `musicvideo`.`idFile` AS `idFile`,
  819.    `musicvideo`.`c00` AS `c00`,
  820.    `musicvideo`.`c01` AS `c01`,
  821.    `musicvideo`.`c02` AS `c02`,
  822.    `musicvideo`.`c03` AS `c03`,
  823.    `musicvideo`.`c04` AS `c04`,
  824.    `musicvideo`.`c05` AS `c05`,
  825.    `musicvideo`.`c06` AS `c06`,
  826.    `musicvideo`.`c07` AS `c07`,
  827.    `musicvideo`.`c08` AS `c08`,
  828.    `musicvideo`.`c09` AS `c09`,
  829.    `musicvideo`.`c10` AS `c10`,
  830.    `musicvideo`.`c11` AS `c11`,
  831.    `musicvideo`.`c12` AS `c12`,
  832.    `musicvideo`.`c13` AS `c13`,
  833.    `musicvideo`.`c14` AS `c14`,
  834.    `musicvideo`.`c15` AS `c15`,
  835.    `musicvideo`.`c16` AS `c16`,
  836.    `musicvideo`.`c17` AS `c17`,
  837.    `musicvideo`.`c18` AS `c18`,
  838.    `musicvideo`.`c19` AS `c19`,
  839.    `musicvideo`.`c20` AS `c20`,
  840.    `musicvideo`.`c21` AS `c21`,
  841.    `musicvideo`.`c22` AS `c22`,
  842.    `musicvideo`.`c23` AS `c23`,
  843.    `files`.`strFilename` AS `strFileName`,
  844.    `path`.`strPath` AS `strPath`,
  845.    `files`.`playCount` AS `playCount`,
  846.    `files`.`lastPlayed` AS `lastPlayed`,
  847.    `files`.`dateAdded` AS `dateAdded`,
  848.    `e90`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
  849.    `e90`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`
  850. FROM (((`e90`.`musicvideo` join `e90`.`files` on((`files`.`idFile` = `musicvideo`.`idFile`))) join `e90`.`path` on((`path`.`idPath` = `files`.`idPath`))) left join `e90`.`bookmark` on(((`e90`.`bookmark`.`idFile` = `musicvideo`.`idFile`) and (`e90`.`bookmark`.`type` = 1))));
  851.  
  852. CREATE VIEW `e90`.`tvshowview`
  853. AS SELECT
  854.    `tvshow`.`idShow` AS `idShow`,
  855.    `tvshow`.`c00` AS `c00`,
  856.    `tvshow`.`c01` AS `c01`,
  857.    `tvshow`.`c02` AS `c02`,
  858.    `tvshow`.`c03` AS `c03`,
  859.    `tvshow`.`c04` AS `c04`,
  860.    `tvshow`.`c05` AS `c05`,
  861.    `tvshow`.`c06` AS `c06`,
  862.    `tvshow`.`c07` AS `c07`,
  863.    `tvshow`.`c08` AS `c08`,
  864.    `tvshow`.`c09` AS `c09`,
  865.    `tvshow`.`c10` AS `c10`,
  866.    `tvshow`.`c11` AS `c11`,
  867.    `tvshow`.`c12` AS `c12`,
  868.    `tvshow`.`c13` AS `c13`,
  869.    `tvshow`.`c14` AS `c14`,
  870.    `tvshow`.`c15` AS `c15`,
  871.    `tvshow`.`c16` AS `c16`,
  872.    `tvshow`.`c17` AS `c17`,
  873.    `tvshow`.`c18` AS `c18`,
  874.    `tvshow`.`c19` AS `c19`,
  875.    `tvshow`.`c20` AS `c20`,
  876.    `tvshow`.`c21` AS `c21`,
  877.    `tvshow`.`c22` AS `c22`,
  878.    `tvshow`.`c23` AS `c23`,
  879.    `path`.`idParentPath` AS `idParentPath`,
  880.    `path`.`strPath` AS `strPath`,
  881.    `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`
  882. FROM ((((`e90`.`tvshow` left join `e90`.`tvshowlinkpath` on((`tvshowlinkpath`.`idShow` = `tvshow`.`idShow`))) left join `e90`.`path` on((`path`.`idPath` = `tvshowlinkpath`.`idPath`))) left join `e90`.`episode` on((`episode`.`idShow` = `tvshow`.`idShow`))) left join `e90`.`files` on((`files`.`idFile` = `episode`.`idFile`))) group by `tvshow`.`idShow`;
  883.  
  884.  
  885.  
  886.  
  887.  
  888. RENAME TABLE `a48`.`song` to `a48`.`globalsong`;
  889.  
  890. ALTER TABLE `a48`.`globalsong` CHANGE iTimesPlayed iTimesPlayed1 INT;
  891. ALTER TABLE `a48`.`globalsong` ADD iTimesPlayed2 INT(11) AFTER iTimesPlayed1;
  892. ALTER TABLE `a48`.`globalsong` ADD iTimesPlayed3 INT(11) AFTER iTimesPlayed2;
  893. ALTER TABLE `a48`.`globalsong` ADD iTimesPlayed4 INT(11) AFTER iTimesPlayed3;
  894. ALTER TABLE `a48`.`globalsong` ADD iTimesPlayed5 INT(11) AFTER iTimesPlayed4;
  895. ALTER TABLE `a48`.`globalsong` CHANGE lastPlayed lastPlayed1 VARCHAR(20);
  896. ALTER TABLE `a48`.`globalsong` ADD lastPlayed2 VARCHAR(20) AFTER lastPlayed1;
  897. ALTER TABLE `a48`.`globalsong` ADD lastPlayed3 VARCHAR(20) AFTER lastPlayed2;
  898. ALTER TABLE `a48`.`globalsong` ADD lastPlayed4 VARCHAR(20) AFTER lastPlayed3;
  899. ALTER TABLE `a48`.`globalsong` ADD lastPlayed5 VARCHAR(20) AFTER lastPlayed4;
  900.  
  901. CREATE VIEW `a48`.`song`
  902. AS SELECT
  903.    `a48`.`globalsong`.`idSong` AS `idSong`,
  904.    `a48`.`globalsong`.`idAlbum` AS `idAlbum`,
  905.    `a48`.`globalsong`.`idPath` AS `idPath`,
  906.    `a48`.`globalsong`.`strArtists` AS `strArtists`,
  907.    `a48`.`globalsong`.`strGenres` AS `strGenres`,
  908.    `a48`.`globalsong`.`strTitle` AS `strTitle`,
  909.    `a48`.`globalsong`.`iTrack` AS `iTrack`,
  910.    `a48`.`globalsong`.`iDuration` AS `iDuration`,
  911.    `a48`.`globalsong`.`iYear` AS `iYear`,
  912.    `a48`.`globalsong`.`dwFileNameCRC` AS `dwFileNameCRC`,
  913.    `a48`.`globalsong`.`strFileName` AS `strFileName`,
  914.    `a48`.`globalsong`.`strMusicBrainzTrackID` AS `strMusicBrainzTrackID`,
  915.    `a48`.`globalsong`.`iTimesPlayed1` AS `iTimesPlayed`,
  916.    `a48`.`globalsong`.`iStartOffset` AS `iStartOffset`,
  917.    `a48`.`globalsong`.`iEndOffset` AS `iEndOffset`,
  918.    `a48`.`globalsong`.`idThumb` AS `idThumb`,
  919.    `a48`.`globalsong`.`lastplayed1` AS `lastplayed`,
  920.    `a48`.`globalsong`.`comment` AS `comment`,
  921.    `a48`.`globalsong`.`rating` AS `rating`
  922. FROM `a48`.`globalsong`;
  923.  
  924. CREATE DATABASE b48;
  925. CREATE VIEW `b48`.`album` AS SELECT * FROM `a48`.`album`;
  926. CREATE VIEW `b48`.`album_artist` AS SELECT * FROM `a48`.`album_artist`;
  927. CREATE VIEW `b48`.`album_genre` AS SELECT * FROM `a48`.`album_genre`;
  928. CREATE VIEW `b48`.`albuminfosong` AS SELECT * FROM `a48`.`albuminfosong`;
  929. CREATE VIEW `b48`.`art` AS SELECT * FROM `a48`.`art`;
  930. CREATE VIEW `b48`.`artist` AS SELECT * FROM `a48`.`artist`;
  931. CREATE VIEW `b48`.`content` AS SELECT * FROM `a48`.`content`;
  932. CREATE VIEW `b48`.`discography` AS SELECT * FROM `a48`.`discography`;
  933. CREATE VIEW `b48`.`genre` AS SELECT * FROM `a48`.`genre`;
  934. CREATE VIEW `b48`.`karaokedata` AS SELECT * FROM `a48`.`karaokedata`;
  935. CREATE VIEW `b48`.`path` AS SELECT * FROM `a48`.`path`;
  936. CREATE VIEW `b48`.`song_artist` AS SELECT * FROM `a48`.`song_artist`;
  937. CREATE VIEW `b48`.`song_genre` AS SELECT * FROM `a48`.`song_genre`;
  938. CREATE VIEW `b48`.`version` AS SELECT * FROM `a48`.`version`;
  939.  
  940. CREATE VIEW `b48`.`song`
  941. AS SELECT
  942.    `a48`.`globalsong`.`idSong` AS `idSong`,
  943.    `a48`.`globalsong`.`idAlbum` AS `idAlbum`,
  944.    `a48`.`globalsong`.`idPath` AS `idPath`,
  945.    `a48`.`globalsong`.`strArtists` AS `strArtists`,
  946.    `a48`.`globalsong`.`strGenres` AS `strGenres`,
  947.    `a48`.`globalsong`.`strTitle` AS `strTitle`,
  948.    `a48`.`globalsong`.`iTrack` AS `iTrack`,
  949.    `a48`.`globalsong`.`iDuration` AS `iDuration`,
  950.    `a48`.`globalsong`.`iYear` AS `iYear`,
  951.    `a48`.`globalsong`.`dwFileNameCRC` AS `dwFileNameCRC`,
  952.    `a48`.`globalsong`.`strFileName` AS `strFileName`,
  953.    `a48`.`globalsong`.`strMusicBrainzTrackID` AS `strMusicBrainzTrackID`,
  954.    `a48`.`globalsong`.`iTimesPlayed2` AS `iTimesPlayed`,
  955.    `a48`.`globalsong`.`iStartOffset` AS `iStartOffset`,
  956.    `a48`.`globalsong`.`iEndOffset` AS `iEndOffset`,
  957.    `a48`.`globalsong`.`idThumb` AS `idThumb`,
  958.    `a48`.`globalsong`.`lastplayed2` AS `lastplayed`,
  959.    `a48`.`globalsong`.`comment` AS `comment`,
  960.    `a48`.`globalsong`.`rating` AS `rating`
  961. FROM `a48`.`globalsong`;
  962.  
  963. CREATE VIEW `b48`.`albumartistview`
  964. AS SELECT
  965.    `album_artist`.`idAlbum` AS `idAlbum`,
  966.    `album_artist`.`idArtist` AS `idArtist`,
  967.    `artist`.`strArtist` AS `strArtist`,
  968.    `artist`.`strMusicBrainzArtistID` AS `strMusicBrainzArtistID`,
  969.    `album_artist`.`boolFeatured` AS `boolFeatured`,
  970.    `album_artist`.`strJoinPhrase` AS `strJoinPhrase`,
  971.    `album_artist`.`iOrder` AS `iOrder`
  972. FROM (`b48`.`album_artist` join `b48`.`artist` on((`album_artist`.`idArtist` = `artist`.`idArtist`)));
  973.  
  974. CREATE VIEW `b48`.`albumview`
  975. AS SELECT
  976.    `album`.`idAlbum` AS `idAlbum`,
  977.    `album`.`strAlbum` AS `strAlbum`,
  978.    `album`.`strMusicBrainzAlbumID` AS `strMusicBrainzAlbumID`,
  979.    `album`.`strArtists` AS `strArtists`,
  980.    `album`.`strGenres` AS `strGenres`,
  981.    `album`.`iYear` AS `iYear`,
  982.    `album`.`strMoods` AS `strMoods`,
  983.    `album`.`strStyles` AS `strStyles`,
  984.    `album`.`strThemes` AS `strThemes`,
  985.    `album`.`strReview` AS `strReview`,
  986.    `album`.`strLabel` AS `strLabel`,
  987.    `album`.`strType` AS `strType`,
  988.    `album`.`strImage` AS `strImage`,
  989.    `album`.`iRating` AS `iRating`,
  990.    `album`.`bCompilation` AS `bCompilation`,min(`song`.`iTimesPlayed`) AS `iTimesPlayed`
  991. FROM (`b48`.`album` left join `b48`.`song` on((`album`.`idAlbum` = `song`.`idAlbum`))) group by `album`.`idAlbum`;
  992.  
  993. CREATE VIEW `b48`.`artistview`
  994. AS SELECT
  995.    `artist`.`idArtist` AS `idArtist`,
  996.    `artist`.`strArtist` AS `strArtist`,
  997.    `artist`.`strMusicBrainzArtistID` AS `strMusicBrainzArtistID`,
  998.    `artist`.`strBorn` AS `strBorn`,
  999.    `artist`.`strFormed` AS `strFormed`,
  1000.    `artist`.`strGenres` AS `strGenres`,
  1001.    `artist`.`strMoods` AS `strMoods`,
  1002.    `artist`.`strStyles` AS `strStyles`,
  1003.    `artist`.`strInstruments` AS `strInstruments`,
  1004.    `artist`.`strBiography` AS `strBiography`,
  1005.    `artist`.`strDied` AS `strDied`,
  1006.    `artist`.`strDisbanded` AS `strDisbanded`,
  1007.    `artist`.`strYearsActive` AS `strYearsActive`,
  1008.    `artist`.`strImage` AS `strImage`,
  1009.    `artist`.`strFanart` AS `strFanart`
  1010. FROM `b48`.`artist`;
  1011.  
  1012. CREATE VIEW `b48`.`songartistview`
  1013. AS SELECT
  1014.    `song_artist`.`idSong` AS `idSong`,
  1015.    `song_artist`.`idArtist` AS `idArtist`,
  1016.    `artist`.`strArtist` AS `strArtist`,
  1017.    `artist`.`strMusicBrainzArtistID` AS `strMusicBrainzArtistID`,
  1018.    `song_artist`.`boolFeatured` AS `boolFeatured`,
  1019.    `song_artist`.`strJoinPhrase` AS `strJoinPhrase`,
  1020.    `song_artist`.`iOrder` AS `iOrder`
  1021. FROM (`b48`.`song_artist` join `b48`.`artist` on((`song_artist`.`idArtist` = `artist`.`idArtist`)));
  1022.  
  1023. CREATE VIEW `b48`.`songview`
  1024. AS SELECT
  1025.    `song`.`idSong` AS `idSong`,
  1026.    `song`.`strArtists` AS `strArtists`,
  1027.    `song`.`strGenres` AS `strGenres`,
  1028.    `song`.`strTitle` AS `strTitle`,
  1029.    `song`.`iTrack` AS `iTrack`,
  1030.    `song`.`iDuration` AS `iDuration`,
  1031.    `song`.`iYear` AS `iYear`,
  1032.    `song`.`dwFileNameCRC` AS `dwFileNameCRC`,
  1033.    `song`.`strFileName` AS `strFileName`,
  1034.    `song`.`strMusicBrainzTrackID` AS `strMusicBrainzTrackID`,
  1035.    `song`.`iTimesPlayed` AS `iTimesPlayed`,
  1036.    `song`.`iStartOffset` AS `iStartOffset`,
  1037.    `song`.`iEndOffset` AS `iEndOffset`,
  1038.    `song`.`lastplayed` AS `lastplayed`,
  1039.    `song`.`rating` AS `rating`,
  1040.    `song`.`comment` AS `comment`,
  1041.    `song`.`idAlbum` AS `idAlbum`,
  1042.    `album`.`strAlbum` AS `strAlbum`,
  1043.    `path`.`strPath` AS `strPath`,
  1044.    `karaokedata`.`iKaraNumber` AS `iKaraNumber`,
  1045.    `karaokedata`.`iKaraDelay` AS `iKaraDelay`,
  1046.    `karaokedata`.`strKaraEncoding` AS `strKaraEncoding`,
  1047.    `album`.`bCompilation` AS `bCompilation`,
  1048.    `album`.`strArtists` AS `strAlbumArtists`
  1049. FROM (((`b48`.`song` join `b48`.`album` on((`song`.`idAlbum` = `album`.`idAlbum`))) join `b48`.`path` on((`song`.`idPath` = `path`.`idPath`))) left join `b48`.`karaokedata` on((`song`.`idSong` = `karaokedata`.`idSong`)));
  1050.  
  1051. CREATE DATABASE c48;
  1052. CREATE VIEW `c48`.`album` AS SELECT * FROM `a48`.`album`;
  1053. CREATE VIEW `c48`.`album_artist` AS SELECT * FROM `a48`.`album_artist`;
  1054. CREATE VIEW `c48`.`album_genre` AS SELECT * FROM `a48`.`album_genre`;
  1055. CREATE VIEW `c48`.`albuminfosong` AS SELECT * FROM `a48`.`albuminfosong`;
  1056. CREATE VIEW `c48`.`art` AS SELECT * FROM `a48`.`art`;
  1057. CREATE VIEW `c48`.`artist` AS SELECT * FROM `a48`.`artist`;
  1058. CREATE VIEW `c48`.`content` AS SELECT * FROM `a48`.`content`;
  1059. CREATE VIEW `c48`.`discography` AS SELECT * FROM `a48`.`discography`;
  1060. CREATE VIEW `c48`.`genre` AS SELECT * FROM `a48`.`genre`;
  1061. CREATE VIEW `c48`.`karaokedata` AS SELECT * FROM `a48`.`karaokedata`;
  1062. CREATE VIEW `c48`.`path` AS SELECT * FROM `a48`.`path`;
  1063. CREATE VIEW `c48`.`song_artist` AS SELECT * FROM `a48`.`song_artist`;
  1064. CREATE VIEW `c48`.`song_genre` AS SELECT * FROM `a48`.`song_genre`;
  1065. CREATE VIEW `c48`.`version` AS SELECT * FROM `a48`.`version`;
  1066.  
  1067. CREATE VIEW `c48`.`song`
  1068. AS SELECT
  1069.    `a48`.`globalsong`.`idSong` AS `idSong`,
  1070.    `a48`.`globalsong`.`idAlbum` AS `idAlbum`,
  1071.    `a48`.`globalsong`.`idPath` AS `idPath`,
  1072.    `a48`.`globalsong`.`strArtists` AS `strArtists`,
  1073.    `a48`.`globalsong`.`strGenres` AS `strGenres`,
  1074.    `a48`.`globalsong`.`strTitle` AS `strTitle`,
  1075.    `a48`.`globalsong`.`iTrack` AS `iTrack`,
  1076.    `a48`.`globalsong`.`iDuration` AS `iDuration`,
  1077.    `a48`.`globalsong`.`iYear` AS `iYear`,
  1078.    `a48`.`globalsong`.`dwFileNameCRC` AS `dwFileNameCRC`,
  1079.    `a48`.`globalsong`.`strFileName` AS `strFileName`,
  1080.    `a48`.`globalsong`.`strMusicBrainzTrackID` AS `strMusicBrainzTrackID`,
  1081.    `a48`.`globalsong`.`iTimesPlayed3` AS `iTimesPlayed`,
  1082.    `a48`.`globalsong`.`iStartOffset` AS `iStartOffset`,
  1083.    `a48`.`globalsong`.`iEndOffset` AS `iEndOffset`,
  1084.    `a48`.`globalsong`.`idThumb` AS `idThumb`,
  1085.    `a48`.`globalsong`.`lastplayed3` AS `lastplayed`,
  1086.    `a48`.`globalsong`.`comment` AS `comment`,
  1087.    `a48`.`globalsong`.`rating` AS `rating`
  1088. FROM `a48`.`globalsong`;
  1089.  
  1090. CREATE VIEW `c48`.`albumartistview`
  1091. AS SELECT
  1092.    `album_artist`.`idAlbum` AS `idAlbum`,
  1093.    `album_artist`.`idArtist` AS `idArtist`,
  1094.    `artist`.`strArtist` AS `strArtist`,
  1095.    `artist`.`strMusicBrainzArtistID` AS `strMusicBrainzArtistID`,
  1096.    `album_artist`.`boolFeatured` AS `boolFeatured`,
  1097.    `album_artist`.`strJoinPhrase` AS `strJoinPhrase`,
  1098.    `album_artist`.`iOrder` AS `iOrder`
  1099. FROM (`c48`.`album_artist` join `c48`.`artist` on((`album_artist`.`idArtist` = `artist`.`idArtist`)));
  1100.  
  1101. CREATE VIEW `c48`.`albumview`
  1102. AS SELECT
  1103.    `album`.`idAlbum` AS `idAlbum`,
  1104.    `album`.`strAlbum` AS `strAlbum`,
  1105.    `album`.`strMusicBrainzAlbumID` AS `strMusicBrainzAlbumID`,
  1106.    `album`.`strArtists` AS `strArtists`,
  1107.    `album`.`strGenres` AS `strGenres`,
  1108.    `album`.`iYear` AS `iYear`,
  1109.    `album`.`strMoods` AS `strMoods`,
  1110.    `album`.`strStyles` AS `strStyles`,
  1111.    `album`.`strThemes` AS `strThemes`,
  1112.    `album`.`strReview` AS `strReview`,
  1113.    `album`.`strLabel` AS `strLabel`,
  1114.    `album`.`strType` AS `strType`,
  1115.    `album`.`strImage` AS `strImage`,
  1116.    `album`.`iRating` AS `iRating`,
  1117.    `album`.`bCompilation` AS `bCompilation`,min(`song`.`iTimesPlayed`) AS `iTimesPlayed`
  1118. FROM (`c48`.`album` left join `c48`.`song` on((`album`.`idAlbum` = `song`.`idAlbum`))) group by `album`.`idAlbum`;
  1119.  
  1120. CREATE VIEW `c48`.`artistview`
  1121. AS SELECT
  1122.    `artist`.`idArtist` AS `idArtist`,
  1123.    `artist`.`strArtist` AS `strArtist`,
  1124.    `artist`.`strMusicBrainzArtistID` AS `strMusicBrainzArtistID`,
  1125.    `artist`.`strBorn` AS `strBorn`,
  1126.    `artist`.`strFormed` AS `strFormed`,
  1127.    `artist`.`strGenres` AS `strGenres`,
  1128.    `artist`.`strMoods` AS `strMoods`,
  1129.    `artist`.`strStyles` AS `strStyles`,
  1130.    `artist`.`strInstruments` AS `strInstruments`,
  1131.    `artist`.`strBiography` AS `strBiography`,
  1132.    `artist`.`strDied` AS `strDied`,
  1133.    `artist`.`strDisbanded` AS `strDisbanded`,
  1134.    `artist`.`strYearsActive` AS `strYearsActive`,
  1135.    `artist`.`strImage` AS `strImage`,
  1136.    `artist`.`strFanart` AS `strFanart`
  1137. FROM `c48`.`artist`;
  1138.  
  1139. CREATE VIEW `c48`.`songartistview`
  1140. AS SELECT
  1141.    `song_artist`.`idSong` AS `idSong`,
  1142.    `song_artist`.`idArtist` AS `idArtist`,
  1143.    `artist`.`strArtist` AS `strArtist`,
  1144.    `artist`.`strMusicBrainzArtistID` AS `strMusicBrainzArtistID`,
  1145.    `song_artist`.`boolFeatured` AS `boolFeatured`,
  1146.    `song_artist`.`strJoinPhrase` AS `strJoinPhrase`,
  1147.    `song_artist`.`iOrder` AS `iOrder`
  1148. FROM (`c48`.`song_artist` join `c48`.`artist` on((`song_artist`.`idArtist` = `artist`.`idArtist`)));
  1149.  
  1150. CREATE VIEW `c48`.`songview`
  1151. AS SELECT
  1152.    `song`.`idSong` AS `idSong`,
  1153.    `song`.`strArtists` AS `strArtists`,
  1154.    `song`.`strGenres` AS `strGenres`,
  1155.    `song`.`strTitle` AS `strTitle`,
  1156.    `song`.`iTrack` AS `iTrack`,
  1157.    `song`.`iDuration` AS `iDuration`,
  1158.    `song`.`iYear` AS `iYear`,
  1159.    `song`.`dwFileNameCRC` AS `dwFileNameCRC`,
  1160.    `song`.`strFileName` AS `strFileName`,
  1161.    `song`.`strMusicBrainzTrackID` AS `strMusicBrainzTrackID`,
  1162.    `song`.`iTimesPlayed` AS `iTimesPlayed`,
  1163.    `song`.`iStartOffset` AS `iStartOffset`,
  1164.    `song`.`iEndOffset` AS `iEndOffset`,
  1165.    `song`.`lastplayed` AS `lastplayed`,
  1166.    `song`.`rating` AS `rating`,
  1167.    `song`.`comment` AS `comment`,
  1168.    `song`.`idAlbum` AS `idAlbum`,
  1169.    `album`.`strAlbum` AS `strAlbum`,
  1170.    `path`.`strPath` AS `strPath`,
  1171.    `karaokedata`.`iKaraNumber` AS `iKaraNumber`,
  1172.    `karaokedata`.`iKaraDelay` AS `iKaraDelay`,
  1173.    `karaokedata`.`strKaraEncoding` AS `strKaraEncoding`,
  1174.    `album`.`bCompilation` AS `bCompilation`,
  1175.    `album`.`strArtists` AS `strAlbumArtists`
  1176. FROM (((`c48`.`song` join `c48`.`album` on((`song`.`idAlbum` = `album`.`idAlbum`))) join `c48`.`path` on((`song`.`idPath` = `path`.`idPath`))) left join `c48`.`karaokedata` on((`song`.`idSong` = `karaokedata`.`idSong`)));
  1177.  
  1178. CREATE DATABASE d48;
  1179. CREATE VIEW `d48`.`album` AS SELECT * FROM `a48`.`album`;
  1180. CREATE VIEW `d48`.`album_artist` AS SELECT * FROM `a48`.`album_artist`;
  1181. CREATE VIEW `d48`.`album_genre` AS SELECT * FROM `a48`.`album_genre`;
  1182. CREATE VIEW `d48`.`albuminfosong` AS SELECT * FROM `a48`.`albuminfosong`;
  1183. CREATE VIEW `d48`.`art` AS SELECT * FROM `a48`.`art`;
  1184. CREATE VIEW `d48`.`artist` AS SELECT * FROM `a48`.`artist`;
  1185. CREATE VIEW `d48`.`content` AS SELECT * FROM `a48`.`content`;
  1186. CREATE VIEW `d48`.`discography` AS SELECT * FROM `a48`.`discography`;
  1187. CREATE VIEW `d48`.`genre` AS SELECT * FROM `a48`.`genre`;
  1188. CREATE VIEW `d48`.`karaokedata` AS SELECT * FROM `a48`.`karaokedata`;
  1189. CREATE VIEW `d48`.`path` AS SELECT * FROM `a48`.`path`;
  1190. CREATE VIEW `d48`.`song_artist` AS SELECT * FROM `a48`.`song_artist`;
  1191. CREATE VIEW `d48`.`song_genre` AS SELECT * FROM `a48`.`song_genre`;
  1192. CREATE VIEW `d48`.`version` AS SELECT * FROM `a48`.`version`;
  1193.  
  1194. CREATE VIEW `d48`.`song`
  1195. AS SELECT
  1196.    `a48`.`globalsong`.`idSong` AS `idSong`,
  1197.    `a48`.`globalsong`.`idAlbum` AS `idAlbum`,
  1198.    `a48`.`globalsong`.`idPath` AS `idPath`,
  1199.    `a48`.`globalsong`.`strArtists` AS `strArtists`,
  1200.    `a48`.`globalsong`.`strGenres` AS `strGenres`,
  1201.    `a48`.`globalsong`.`strTitle` AS `strTitle`,
  1202.    `a48`.`globalsong`.`iTrack` AS `iTrack`,
  1203.    `a48`.`globalsong`.`iDuration` AS `iDuration`,
  1204.    `a48`.`globalsong`.`iYear` AS `iYear`,
  1205.    `a48`.`globalsong`.`dwFileNameCRC` AS `dwFileNameCRC`,
  1206.    `a48`.`globalsong`.`strFileName` AS `strFileName`,
  1207.    `a48`.`globalsong`.`strMusicBrainzTrackID` AS `strMusicBrainzTrackID`,
  1208.    `a48`.`globalsong`.`iTimesPlayed4` AS `iTimesPlayed`,
  1209.    `a48`.`globalsong`.`iStartOffset` AS `iStartOffset`,
  1210.    `a48`.`globalsong`.`iEndOffset` AS `iEndOffset`,
  1211.    `a48`.`globalsong`.`idThumb` AS `idThumb`,
  1212.    `a48`.`globalsong`.`lastplayed4` AS `lastplayed`,
  1213.    `a48`.`globalsong`.`comment` AS `comment`,
  1214.    `a48`.`globalsong`.`rating` AS `rating`
  1215. FROM `a48`.`globalsong`;
  1216.  
  1217. CREATE VIEW `d48`.`albumartistview`
  1218. AS SELECT
  1219.    `album_artist`.`idAlbum` AS `idAlbum`,
  1220.    `album_artist`.`idArtist` AS `idArtist`,
  1221.    `artist`.`strArtist` AS `strArtist`,
  1222.    `artist`.`strMusicBrainzArtistID` AS `strMusicBrainzArtistID`,
  1223.    `album_artist`.`boolFeatured` AS `boolFeatured`,
  1224.    `album_artist`.`strJoinPhrase` AS `strJoinPhrase`,
  1225.    `album_artist`.`iOrder` AS `iOrder`
  1226. FROM (`d48`.`album_artist` join `d48`.`artist` on((`album_artist`.`idArtist` = `artist`.`idArtist`)));
  1227.  
  1228. CREATE VIEW `d48`.`albumview`
  1229. AS SELECT
  1230.    `album`.`idAlbum` AS `idAlbum`,
  1231.    `album`.`strAlbum` AS `strAlbum`,
  1232.    `album`.`strMusicBrainzAlbumID` AS `strMusicBrainzAlbumID`,
  1233.    `album`.`strArtists` AS `strArtists`,
  1234.    `album`.`strGenres` AS `strGenres`,
  1235.    `album`.`iYear` AS `iYear`,
  1236.    `album`.`strMoods` AS `strMoods`,
  1237.    `album`.`strStyles` AS `strStyles`,
  1238.    `album`.`strThemes` AS `strThemes`,
  1239.    `album`.`strReview` AS `strReview`,
  1240.    `album`.`strLabel` AS `strLabel`,
  1241.    `album`.`strType` AS `strType`,
  1242.    `album`.`strImage` AS `strImage`,
  1243.    `album`.`iRating` AS `iRating`,
  1244.    `album`.`bCompilation` AS `bCompilation`,min(`song`.`iTimesPlayed`) AS `iTimesPlayed`
  1245. FROM (`d48`.`album` left join `d48`.`song` on((`album`.`idAlbum` = `song`.`idAlbum`))) group by `album`.`idAlbum`;
  1246.  
  1247. CREATE VIEW `d48`.`artistview`
  1248. AS SELECT
  1249.    `artist`.`idArtist` AS `idArtist`,
  1250.    `artist`.`strArtist` AS `strArtist`,
  1251.    `artist`.`strMusicBrainzArtistID` AS `strMusicBrainzArtistID`,
  1252.    `artist`.`strBorn` AS `strBorn`,
  1253.    `artist`.`strFormed` AS `strFormed`,
  1254.    `artist`.`strGenres` AS `strGenres`,
  1255.    `artist`.`strMoods` AS `strMoods`,
  1256.    `artist`.`strStyles` AS `strStyles`,
  1257.    `artist`.`strInstruments` AS `strInstruments`,
  1258.    `artist`.`strBiography` AS `strBiography`,
  1259.    `artist`.`strDied` AS `strDied`,
  1260.    `artist`.`strDisbanded` AS `strDisbanded`,
  1261.    `artist`.`strYearsActive` AS `strYearsActive`,
  1262.    `artist`.`strImage` AS `strImage`,
  1263.    `artist`.`strFanart` AS `strFanart`
  1264. FROM `d48`.`artist`;
  1265.  
  1266. CREATE VIEW `d48`.`songartistview`
  1267. AS SELECT
  1268.    `song_artist`.`idSong` AS `idSong`,
  1269.    `song_artist`.`idArtist` AS `idArtist`,
  1270.    `artist`.`strArtist` AS `strArtist`,
  1271.    `artist`.`strMusicBrainzArtistID` AS `strMusicBrainzArtistID`,
  1272.    `song_artist`.`boolFeatured` AS `boolFeatured`,
  1273.    `song_artist`.`strJoinPhrase` AS `strJoinPhrase`,
  1274.    `song_artist`.`iOrder` AS `iOrder`
  1275. FROM (`d48`.`song_artist` join `d48`.`artist` on((`song_artist`.`idArtist` = `artist`.`idArtist`)));
  1276.  
  1277. CREATE VIEW `d48`.`songview`
  1278. AS SELECT
  1279.    `song`.`idSong` AS `idSong`,
  1280.    `song`.`strArtists` AS `strArtists`,
  1281.    `song`.`strGenres` AS `strGenres`,
  1282.    `song`.`strTitle` AS `strTitle`,
  1283.    `song`.`iTrack` AS `iTrack`,
  1284.    `song`.`iDuration` AS `iDuration`,
  1285.    `song`.`iYear` AS `iYear`,
  1286.    `song`.`dwFileNameCRC` AS `dwFileNameCRC`,
  1287.    `song`.`strFileName` AS `strFileName`,
  1288.    `song`.`strMusicBrainzTrackID` AS `strMusicBrainzTrackID`,
  1289.    `song`.`iTimesPlayed` AS `iTimesPlayed`,
  1290.    `song`.`iStartOffset` AS `iStartOffset`,
  1291.    `song`.`iEndOffset` AS `iEndOffset`,
  1292.    `song`.`lastplayed` AS `lastplayed`,
  1293.    `song`.`rating` AS `rating`,
  1294.    `song`.`comment` AS `comment`,
  1295.    `song`.`idAlbum` AS `idAlbum`,
  1296.    `album`.`strAlbum` AS `strAlbum`,
  1297.    `path`.`strPath` AS `strPath`,
  1298.    `karaokedata`.`iKaraNumber` AS `iKaraNumber`,
  1299.    `karaokedata`.`iKaraDelay` AS `iKaraDelay`,
  1300.    `karaokedata`.`strKaraEncoding` AS `strKaraEncoding`,
  1301.    `album`.`bCompilation` AS `bCompilation`,
  1302.    `album`.`strArtists` AS `strAlbumArtists`
  1303. FROM (((`d48`.`song` join `d48`.`album` on((`song`.`idAlbum` = `album`.`idAlbum`))) join `d48`.`path` on((`song`.`idPath` = `path`.`idPath`))) left join `d48`.`karaokedata` on((`song`.`idSong` = `karaokedata`.`idSong`)));
  1304.  
  1305. CREATE DATABASE e48;
  1306. CREATE VIEW `e48`.`album` AS SELECT * FROM `a48`.`album`;
  1307. CREATE VIEW `e48`.`album_artist` AS SELECT * FROM `a48`.`album_artist`;
  1308. CREATE VIEW `e48`.`album_genre` AS SELECT * FROM `a48`.`album_genre`;
  1309. CREATE VIEW `e48`.`albuminfosong` AS SELECT * FROM `a48`.`albuminfosong`;
  1310. CREATE VIEW `e48`.`art` AS SELECT * FROM `a48`.`art`;
  1311. CREATE VIEW `e48`.`artist` AS SELECT * FROM `a48`.`artist`;
  1312. CREATE VIEW `e48`.`content` AS SELECT * FROM `a48`.`content`;
  1313. CREATE VIEW `e48`.`discography` AS SELECT * FROM `a48`.`discography`;
  1314. CREATE VIEW `e48`.`genre` AS SELECT * FROM `a48`.`genre`;
  1315. CREATE VIEW `e48`.`karaokedata` AS SELECT * FROM `a48`.`karaokedata`;
  1316. CREATE VIEW `e48`.`path` AS SELECT * FROM `a48`.`path`;
  1317. CREATE VIEW `e48`.`song_artist` AS SELECT * FROM `a48`.`song_artist`;
  1318. CREATE VIEW `e48`.`song_genre` AS SELECT * FROM `a48`.`song_genre`;
  1319. CREATE VIEW `e48`.`version` AS SELECT * FROM `a48`.`version`;
  1320.  
  1321. CREATE VIEW `e48`.`song`
  1322. AS SELECT
  1323.    `a48`.`globalsong`.`idSong` AS `idSong`,
  1324.    `a48`.`globalsong`.`idAlbum` AS `idAlbum`,
  1325.    `a48`.`globalsong`.`idPath` AS `idPath`,
  1326.    `a48`.`globalsong`.`strArtists` AS `strArtists`,
  1327.    `a48`.`globalsong`.`strGenres` AS `strGenres`,
  1328.    `a48`.`globalsong`.`strTitle` AS `strTitle`,
  1329.    `a48`.`globalsong`.`iTrack` AS `iTrack`,
  1330.    `a48`.`globalsong`.`iDuration` AS `iDuration`,
  1331.    `a48`.`globalsong`.`iYear` AS `iYear`,
  1332.    `a48`.`globalsong`.`dwFileNameCRC` AS `dwFileNameCRC`,
  1333.    `a48`.`globalsong`.`strFileName` AS `strFileName`,
  1334.    `a48`.`globalsong`.`strMusicBrainzTrackID` AS `strMusicBrainzTrackID`,
  1335.    `a48`.`globalsong`.`iTimesPlayed5` AS `iTimesPlayed`,
  1336.    `a48`.`globalsong`.`iStartOffset` AS `iStartOffset`,
  1337.    `a48`.`globalsong`.`iEndOffset` AS `iEndOffset`,
  1338.    `a48`.`globalsong`.`idThumb` AS `idThumb`,
  1339.    `a48`.`globalsong`.`lastplayed5` AS `lastplayed`,
  1340.    `a48`.`globalsong`.`comment` AS `comment`,
  1341.    `a48`.`globalsong`.`rating` AS `rating`
  1342. FROM `a48`.`globalsong`;
  1343.  
  1344. CREATE VIEW `e48`.`albumartistview`
  1345. AS SELECT
  1346.    `album_artist`.`idAlbum` AS `idAlbum`,
  1347.    `album_artist`.`idArtist` AS `idArtist`,
  1348.    `artist`.`strArtist` AS `strArtist`,
  1349.    `artist`.`strMusicBrainzArtistID` AS `strMusicBrainzArtistID`,
  1350.    `album_artist`.`boolFeatured` AS `boolFeatured`,
  1351.    `album_artist`.`strJoinPhrase` AS `strJoinPhrase`,
  1352.    `album_artist`.`iOrder` AS `iOrder`
  1353. FROM (`e48`.`album_artist` join `e48`.`artist` on((`album_artist`.`idArtist` = `artist`.`idArtist`)));
  1354.  
  1355. CREATE VIEW `e48`.`albumview`
  1356. AS SELECT
  1357.    `album`.`idAlbum` AS `idAlbum`,
  1358.    `album`.`strAlbum` AS `strAlbum`,
  1359.    `album`.`strMusicBrainzAlbumID` AS `strMusicBrainzAlbumID`,
  1360.    `album`.`strArtists` AS `strArtists`,
  1361.    `album`.`strGenres` AS `strGenres`,
  1362.    `album`.`iYear` AS `iYear`,
  1363.    `album`.`strMoods` AS `strMoods`,
  1364.    `album`.`strStyles` AS `strStyles`,
  1365.    `album`.`strThemes` AS `strThemes`,
  1366.    `album`.`strReview` AS `strReview`,
  1367.    `album`.`strLabel` AS `strLabel`,
  1368.    `album`.`strType` AS `strType`,
  1369.    `album`.`strImage` AS `strImage`,
  1370.    `album`.`iRating` AS `iRating`,
  1371.    `album`.`bCompilation` AS `bCompilation`,min(`song`.`iTimesPlayed`) AS `iTimesPlayed`
  1372. FROM (`e48`.`album` left join `e48`.`song` on((`album`.`idAlbum` = `song`.`idAlbum`))) group by `album`.`idAlbum`;
  1373.  
  1374. CREATE VIEW `e48`.`artistview`
  1375. AS SELECT
  1376.    `artist`.`idArtist` AS `idArtist`,
  1377.    `artist`.`strArtist` AS `strArtist`,
  1378.    `artist`.`strMusicBrainzArtistID` AS `strMusicBrainzArtistID`,
  1379.    `artist`.`strBorn` AS `strBorn`,
  1380.    `artist`.`strFormed` AS `strFormed`,
  1381.    `artist`.`strGenres` AS `strGenres`,
  1382.    `artist`.`strMoods` AS `strMoods`,
  1383.    `artist`.`strStyles` AS `strStyles`,
  1384.    `artist`.`strInstruments` AS `strInstruments`,
  1385.    `artist`.`strBiography` AS `strBiography`,
  1386.    `artist`.`strDied` AS `strDied`,
  1387.    `artist`.`strDisbanded` AS `strDisbanded`,
  1388.    `artist`.`strYearsActive` AS `strYearsActive`,
  1389.    `artist`.`strImage` AS `strImage`,
  1390.    `artist`.`strFanart` AS `strFanart`
  1391. FROM `e48`.`artist`;
  1392.  
  1393. CREATE VIEW `e48`.`songartistview`
  1394. AS SELECT
  1395.    `song_artist`.`idSong` AS `idSong`,
  1396.    `song_artist`.`idArtist` AS `idArtist`,
  1397.    `artist`.`strArtist` AS `strArtist`,
  1398.    `artist`.`strMusicBrainzArtistID` AS `strMusicBrainzArtistID`,
  1399.    `song_artist`.`boolFeatured` AS `boolFeatured`,
  1400.    `song_artist`.`strJoinPhrase` AS `strJoinPhrase`,
  1401.    `song_artist`.`iOrder` AS `iOrder`
  1402. FROM (`e48`.`song_artist` join `e48`.`artist` on((`song_artist`.`idArtist` = `artist`.`idArtist`)));
  1403.  
  1404. CREATE VIEW `e48`.`songview`
  1405. AS SELECT
  1406.    `song`.`idSong` AS `idSong`,
  1407.    `song`.`strArtists` AS `strArtists`,
  1408.    `song`.`strGenres` AS `strGenres`,
  1409.    `song`.`strTitle` AS `strTitle`,
  1410.    `song`.`iTrack` AS `iTrack`,
  1411.    `song`.`iDuration` AS `iDuration`,
  1412.    `song`.`iYear` AS `iYear`,
  1413.    `song`.`dwFileNameCRC` AS `dwFileNameCRC`,
  1414.    `song`.`strFileName` AS `strFileName`,
  1415.    `song`.`strMusicBrainzTrackID` AS `strMusicBrainzTrackID`,
  1416.    `song`.`iTimesPlayed` AS `iTimesPlayed`,
  1417.    `song`.`iStartOffset` AS `iStartOffset`,
  1418.    `song`.`iEndOffset` AS `iEndOffset`,
  1419.    `song`.`lastplayed` AS `lastplayed`,
  1420.    `song`.`rating` AS `rating`,
  1421.    `song`.`comment` AS `comment`,
  1422.    `song`.`idAlbum` AS `idAlbum`,
  1423.    `album`.`strAlbum` AS `strAlbum`,
  1424.    `path`.`strPath` AS `strPath`,
  1425.    `karaokedata`.`iKaraNumber` AS `iKaraNumber`,
  1426.    `karaokedata`.`iKaraDelay` AS `iKaraDelay`,
  1427.    `karaokedata`.`strKaraEncoding` AS `strKaraEncoding`,
  1428.    `album`.`bCompilation` AS `bCompilation`,
  1429.    `album`.`strArtists` AS `strAlbumArtists`
  1430. FROM (((`e48`.`song` join `e48`.`album` on((`song`.`idAlbum` = `album`.`idAlbum`))) join `e48`.`path` on((`song`.`idPath` = `path`.`idPath`))) left join `e48`.`karaokedata` on((`song`.`idSong` = `karaokedata`.`idSong`)));
RAW Paste Data