Code:
RENAME TABLE `a78`.`files` to `a78`.`globalfiles`;
ALTER TABLE `a78`.`globalfiles` CHANGE playCount PlayCount1 INT;
ALTER TABLE `a78`.`globalfiles` CHANGE lastPlayed lastPlayed1 TEXT;
ALTER TABLE `a78`.`globalfiles` ADD playCount2 INT(11) AFTER lastPlayed1;
ALTER TABLE `a78`.`globalfiles` ADD lastPlayed2 TEXT AFTER playCount2;
ALTER TABLE `a78`.`globalfiles` ADD playCount3 INT(11) AFTER lastPlayed2;
ALTER TABLE `a78`.`globalfiles` ADD lastPlayed3 TEXT AFTER playCount3;
ALTER TABLE `a78`.`globalfiles` ADD playCount4 INT(11) AFTER lastPlayed3;
ALTER TABLE `a78`.`globalfiles` ADD lastPlayed4 TEXT AFTER playCount4;
ALTER TABLE `a78`.`globalfiles` ADD playCount5 INT(11) AFTER lastPlayed4;
ALTER TABLE `a78`.`globalfiles` ADD lastPlayed5 TEXT AFTER playCount5;
CREATE VIEW `a78`.`files`
AS SELECT
`a78`.`globalfiles`.`idFile` AS `idFile`,
`a78`.`globalfiles`.`idPath` AS `idPath`,
`a78`.`globalfiles`.`strFilename` AS `strFilename`,
`a78`.`globalfiles`.`playCount1` AS `playCount`,
`a78`.`globalfiles`.`lastPlayed1` AS `lastPlayed`,
`a78`.`globalfiles`.`dateAdded` AS `dateAdded`
FROM `a78`.`globalfiles`;
CREATE DATABASE b78;
CREATE VIEW `b78`.`actorlinkepisode` AS SELECT * FROM `a78`.`actorlinkepisode`;
CREATE VIEW `b78`.`actorlinkmovie` AS SELECT * FROM `a78`.`actorlinkmovie`;
CREATE VIEW `b78`.`actorlinktvshow` AS SELECT * FROM `a78`.`actorlinktvshow`;
CREATE VIEW `b78`.`actors` AS SELECT * FROM `a78`.`actors`;
CREATE VIEW `b78`.`art` AS SELECT * FROM `a78`.`art`;
CREATE VIEW `b78`.`artistlinkmusicvideo` AS SELECT * FROM `a78`.`artistlinkmusicvideo`;
CREATE VIEW `b78`.`country` AS SELECT * FROM `a78`.`country`;
CREATE VIEW `b78`.`countrylinkmovie` AS SELECT * FROM `a78`.`countrylinkmovie`;
CREATE VIEW `b78`.`directorlinkepisode` AS SELECT * FROM `a78`.`directorlinkepisode`;
CREATE VIEW `b78`.`directorlinkmovie` AS SELECT * FROM `a78`.`directorlinkmovie`;
CREATE VIEW `b78`.`directorlinkmusicvideo` AS SELECT * FROM `a78`.`directorlinkmusicvideo`;
CREATE VIEW `b78`.`directorlinktvshow` AS SELECT * FROM `a78`.`directorlinktvshow`;
CREATE VIEW `b78`.`episode` AS SELECT * FROM `a78`.`episode`;
CREATE VIEW `b78`.`genre` AS SELECT * FROM `a78`.`genre`;
CREATE VIEW `b78`.`genrelinkmovie` AS SELECT * FROM `a78`.`genrelinkmovie`;
CREATE VIEW `b78`.`genrelinkmusicvideo` AS SELECT * FROM `a78`.`genrelinkmusicvideo`;
CREATE VIEW `b78`.`genrelinktvshow` AS SELECT * FROM `a78`.`genrelinktvshow`;
CREATE VIEW `b78`.`movie` AS SELECT * FROM `a78`.`movie`;
CREATE VIEW `b78`.`movielinktvshow` AS SELECT * FROM `a78`.`movielinktvshow`;
CREATE VIEW `b78`.`musicvideo` AS SELECT * FROM `a78`.`musicvideo`;
CREATE VIEW `b78`.`path` AS SELECT * FROM `a78`.`path`;
CREATE VIEW `b78`.`seasons` AS SELECT * FROM `a78`.`seasons`;
CREATE VIEW `b78`.`sets` AS SELECT * FROM `a78`.`sets`;
CREATE VIEW `b78`.`settings` AS SELECT * FROM `a78`.`settings`;
CREATE VIEW `b78`.`stacktimes` AS SELECT * FROM `a78`.`stacktimes`;
CREATE VIEW `b78`.`streamdetails` AS SELECT * FROM `a78`.`streamdetails`;
CREATE VIEW `b78`.`studio` AS SELECT * FROM `a78`.`studio`;
CREATE VIEW `b78`.`studiolinkmovie` AS SELECT * FROM `a78`.`studiolinkmovie`;
CREATE VIEW `b78`.`studiolinkmusicvideo` AS SELECT * FROM `a78`.`studiolinkmusicvideo`;
CREATE VIEW `b78`.`studiolinktvshow` AS SELECT * FROM `a78`.`studiolinktvshow`;
CREATE VIEW `b78`.`tag` AS SELECT * FROM `a78`.`tag`;
CREATE VIEW `b78`.`taglinks` AS SELECT * FROM `a78`.`taglinks`;
CREATE VIEW `b78`.`tvshow` AS SELECT * FROM `a78`.`tvshow`;
CREATE VIEW `b78`.`tvshowlinkpath` AS SELECT * FROM `a78`.`tvshowlinkpath`;
CREATE VIEW `b78`.`version` AS SELECT * FROM `a78`.`version`;
CREATE VIEW `b78`.`writerlinkepisode` AS SELECT * FROM `a78`.`writerlinkepisode`;
CREATE VIEW `b78`.`writerlinkmovie` AS SELECT * FROM `a78`.`writerlinkmovie`;
CREATE VIEW `b78`.`files`
AS SELECT
`a78`.`globalfiles`.`idFile` AS `idFile`,
`a78`.`globalfiles`.`idPath` AS `idPath`,
`a78`.`globalfiles`.`strFilename` AS `strFilename`,
`a78`.`globalfiles`.`playCount2` AS `playCount`,
`a78`.`globalfiles`.`lastPlayed2` AS `lastPlayed`,
`a78`.`globalfiles`.`dateAdded` AS `dateAdded`
FROM `a78`.`globalfiles`;
CREATE TABLE `b78`.`bookmark` (
`idBookmark` int(11) NOT NULL AUTO_INCREMENT,
`idFile` int(11) DEFAULT NULL,
`timeInSeconds` double DEFAULT NULL,
`totalTimeInSeconds` double DEFAULT NULL,
`thumbNailImage` text,
`player` text,
`playerState` text,
`type` int(11) DEFAULT NULL,
PRIMARY KEY (`idBookmark`),
KEY `ix_bookmark` (`idFile`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE VIEW `b78`.`episodeview`
AS SELECT
`episode`.`idEpisode` AS `idEpisode`,
`episode`.`idFile` AS `idFile`,
`episode`.`c00` AS `c00`,
`episode`.`c01` AS `c01`,
`episode`.`c02` AS `c02`,
`episode`.`c03` AS `c03`,
`episode`.`c04` AS `c04`,
`episode`.`c05` AS `c05`,
`episode`.`c06` AS `c06`,
`episode`.`c07` AS `c07`,
`episode`.`c08` AS `c08`,
`episode`.`c09` AS `c09`,
`episode`.`c10` AS `c10`,
`episode`.`c11` AS `c11`,
`episode`.`c12` AS `c12`,
`episode`.`c13` AS `c13`,
`episode`.`c14` AS `c14`,
`episode`.`c15` AS `c15`,
`episode`.`c16` AS `c16`,
`episode`.`c17` AS `c17`,
`episode`.`c18` AS `c18`,
`episode`.`c19` AS `c19`,
`episode`.`c20` AS `c20`,
`episode`.`c21` AS `c21`,
`episode`.`c22` AS `c22`,
`episode`.`c23` AS `c23`,
`episode`.`idShow` AS `idShow`,
`files`.`strFilename` AS `strFileName`,
`path`.`strPath` AS `strPath`,
`files`.`playCount` AS `playCount`,
`files`.`lastPlayed` AS `lastPlayed`,
`files`.`dateAdded` AS `dateAdded`,
`tvshow`.`c00` AS `strTitle`,
`tvshow`.`c14` AS `strStudio`,
`tvshow`.`c05` AS `premiered`,
`tvshow`.`c13` AS `mpaa`,
`tvshow`.`c16` AS `strShowPath`,
`b78`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
`b78`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`,
`seasons`.`idSeason` AS `idSeason`
FROM (((((`b78`.`episode` join `b78`.`files` on((`files`.`idFile` = `episode`.`idFile`))) join `b78`.`tvshow` on((`tvshow`.`idShow` = `episode`.`idShow`))) left join `b78`.`seasons` on(((`seasons`.`idShow` = `episode`.`idShow`) and (`seasons`.`season` = `episode`.`c12`)))) join `b78`.`path` on((`files`.`idPath` = `path`.`idPath`))) left join `b78`.`bookmark` on(((`b78`.`bookmark`.`idFile` = `episode`.`idFile`) and (`b78`.`bookmark`.`type` = 1))));
CREATE VIEW `b78`.`movieview`
AS SELECT
`movie`.`idMovie` AS `idMovie`,
`movie`.`idFile` AS `idFile`,
`movie`.`c00` AS `c00`,
`movie`.`c01` AS `c01`,
`movie`.`c02` AS `c02`,
`movie`.`c03` AS `c03`,
`movie`.`c04` AS `c04`,
`movie`.`c05` AS `c05`,
`movie`.`c06` AS `c06`,
`movie`.`c07` AS `c07`,
`movie`.`c08` AS `c08`,
`movie`.`c09` AS `c09`,
`movie`.`c10` AS `c10`,
`movie`.`c11` AS `c11`,
`movie`.`c12` AS `c12`,
`movie`.`c13` AS `c13`,
`movie`.`c14` AS `c14`,
`movie`.`c15` AS `c15`,
`movie`.`c16` AS `c16`,
`movie`.`c17` AS `c17`,
`movie`.`c18` AS `c18`,
`movie`.`c19` AS `c19`,
`movie`.`c20` AS `c20`,
`movie`.`c21` AS `c21`,
`movie`.`c22` AS `c22`,
`movie`.`c23` AS `c23`,
`movie`.`idSet` AS `idSet`,
`sets`.`strSet` AS `strSet`,
`files`.`strFilename` AS `strFileName`,
`path`.`strPath` AS `strPath`,
`files`.`playCount` AS `playCount`,
`files`.`lastPlayed` AS `lastPlayed`,
`files`.`dateAdded` AS `dateAdded`,
`b78`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
`b78`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`
FROM ((((`b78`.`movie` left join `b78`.`sets` on((`sets`.`idSet` = `movie`.`idSet`))) join `b78`.`files` on((`files`.`idFile` = `movie`.`idFile`))) join `b78`.`path` on((`path`.`idPath` = `files`.`idPath`))) left join `b78`.`bookmark` on(((`b78`.`bookmark`.`idFile` = `movie`.`idFile`) and (`b78`.`bookmark`.`type` = 1))));
CREATE VIEW `b78`.`musicvideoview`
AS SELECT
`musicvideo`.`idMVideo` AS `idMVideo`,
`musicvideo`.`idFile` AS `idFile`,
`musicvideo`.`c00` AS `c00`,
`musicvideo`.`c01` AS `c01`,
`musicvideo`.`c02` AS `c02`,
`musicvideo`.`c03` AS `c03`,
`musicvideo`.`c04` AS `c04`,
`musicvideo`.`c05` AS `c05`,
`musicvideo`.`c06` AS `c06`,
`musicvideo`.`c07` AS `c07`,
`musicvideo`.`c08` AS `c08`,
`musicvideo`.`c09` AS `c09`,
`musicvideo`.`c10` AS `c10`,
`musicvideo`.`c11` AS `c11`,
`musicvideo`.`c12` AS `c12`,
`musicvideo`.`c13` AS `c13`,
`musicvideo`.`c14` AS `c14`,
`musicvideo`.`c15` AS `c15`,
`musicvideo`.`c16` AS `c16`,
`musicvideo`.`c17` AS `c17`,
`musicvideo`.`c18` AS `c18`,
`musicvideo`.`c19` AS `c19`,
`musicvideo`.`c20` AS `c20`,
`musicvideo`.`c21` AS `c21`,
`musicvideo`.`c22` AS `c22`,
`musicvideo`.`c23` AS `c23`,
`files`.`strFilename` AS `strFileName`,
`path`.`strPath` AS `strPath`,
`files`.`playCount` AS `playCount`,
`files`.`lastPlayed` AS `lastPlayed`,
`files`.`dateAdded` AS `dateAdded`,
`b78`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
`b78`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`
FROM (((`b78`.`musicvideo` join `b78`.`files` on((`files`.`idFile` = `musicvideo`.`idFile`))) join `b78`.`path` on((`path`.`idPath` = `files`.`idPath`))) left join `b78`.`bookmark` on(((`b78`.`bookmark`.`idFile` = `musicvideo`.`idFile`) and (`b78`.`bookmark`.`type` = 1))));
CREATE VIEW `b78`.`tvshowview`
AS SELECT
`tvshow`.`idShow` AS `idShow`,
`tvshow`.`c00` AS `c00`,
`tvshow`.`c01` AS `c01`,
`tvshow`.`c02` AS `c02`,
`tvshow`.`c03` AS `c03`,
`tvshow`.`c04` AS `c04`,
`tvshow`.`c05` AS `c05`,
`tvshow`.`c06` AS `c06`,
`tvshow`.`c07` AS `c07`,
`tvshow`.`c08` AS `c08`,
`tvshow`.`c09` AS `c09`,
`tvshow`.`c10` AS `c10`,
`tvshow`.`c11` AS `c11`,
`tvshow`.`c12` AS `c12`,
`tvshow`.`c13` AS `c13`,
`tvshow`.`c14` AS `c14`,
`tvshow`.`c15` AS `c15`,
`tvshow`.`c16` AS `c16`,
`tvshow`.`c17` AS `c17`,
`tvshow`.`c18` AS `c18`,
`tvshow`.`c19` AS `c19`,
`tvshow`.`c20` AS `c20`,
`tvshow`.`c21` AS `c21`,
`tvshow`.`c22` AS `c22`,
`tvshow`.`c23` AS `c23`,
`path`.`strPath` AS `strPath`,
`path`.`dateAdded` AS `dateAdded`,max(`files`.`lastPlayed`) AS `lastPlayed`,nullif(count(`episode`.`c12`),0) AS `totalCount`,count(`files`.`playCount`) AS `watchedcount`,nullif(count(distinct `episode`.`c12`),0) AS `totalSeasons`
FROM ((((`b78`.`tvshow` left join `b78`.`tvshowlinkpath` on((`tvshowlinkpath`.`idShow` = `tvshow`.`idShow`))) left join `b78`.`path` on((`path`.`idPath` = `tvshowlinkpath`.`idPath`))) left join `b78`.`episode` on((`episode`.`idShow` = `tvshow`.`idShow`))) left join `b78`.`files` on((`files`.`idFile` = `episode`.`idFile`))) group by `tvshow`.`idShow`;
CREATE DATABASE c78;
CREATE VIEW `c78`.`actorlinkepisode` AS SELECT * FROM `a78`.`actorlinkepisode`;
CREATE VIEW `c78`.`actorlinkmovie` AS SELECT * FROM `a78`.`actorlinkmovie`;
CREATE VIEW `c78`.`actorlinktvshow` AS SELECT * FROM `a78`.`actorlinktvshow`;
CREATE VIEW `c78`.`actors` AS SELECT * FROM `a78`.`actors`;
CREATE VIEW `c78`.`art` AS SELECT * FROM `a78`.`art`;
CREATE VIEW `c78`.`artistlinkmusicvideo` AS SELECT * FROM `a78`.`artistlinkmusicvideo`;
CREATE VIEW `c78`.`country` AS SELECT * FROM `a78`.`country`;
CREATE VIEW `c78`.`countrylinkmovie` AS SELECT * FROM `a78`.`countrylinkmovie`;
CREATE VIEW `c78`.`directorlinkepisode` AS SELECT * FROM `a78`.`directorlinkepisode`;
CREATE VIEW `c78`.`directorlinkmovie` AS SELECT * FROM `a78`.`directorlinkmovie`;
CREATE VIEW `c78`.`directorlinkmusicvideo` AS SELECT * FROM `a78`.`directorlinkmusicvideo`;
CREATE VIEW `c78`.`directorlinktvshow` AS SELECT * FROM `a78`.`directorlinktvshow`;
CREATE VIEW `c78`.`episode` AS SELECT * FROM `a78`.`episode`;
CREATE VIEW `c78`.`genre` AS SELECT * FROM `a78`.`genre`;
CREATE VIEW `c78`.`genrelinkmovie` AS SELECT * FROM `a78`.`genrelinkmovie`;
CREATE VIEW `c78`.`genrelinkmusicvideo` AS SELECT * FROM `a78`.`genrelinkmusicvideo`;
CREATE VIEW `c78`.`genrelinktvshow` AS SELECT * FROM `a78`.`genrelinktvshow`;
CREATE VIEW `c78`.`movie` AS SELECT * FROM `a78`.`movie`;
CREATE VIEW `c78`.`movielinktvshow` AS SELECT * FROM `a78`.`movielinktvshow`;
CREATE VIEW `c78`.`musicvideo` AS SELECT * FROM `a78`.`musicvideo`;
CREATE VIEW `c78`.`path` AS SELECT * FROM `a78`.`path`;
CREATE VIEW `c78`.`seasons` AS SELECT * FROM `a78`.`seasons`;
CREATE VIEW `c78`.`sets` AS SELECT * FROM `a78`.`sets`;
CREATE VIEW `c78`.`settings` AS SELECT * FROM `a78`.`settings`;
CREATE VIEW `c78`.`stacktimes` AS SELECT * FROM `a78`.`stacktimes`;
CREATE VIEW `c78`.`streamdetails` AS SELECT * FROM `a78`.`streamdetails`;
CREATE VIEW `c78`.`studio` AS SELECT * FROM `a78`.`studio`;
CREATE VIEW `c78`.`studiolinkmovie` AS SELECT * FROM `a78`.`studiolinkmovie`;
CREATE VIEW `c78`.`studiolinkmusicvideo` AS SELECT * FROM `a78`.`studiolinkmusicvideo`;
CREATE VIEW `c78`.`studiolinktvshow` AS SELECT * FROM `a78`.`studiolinktvshow`;
CREATE VIEW `c78`.`tag` AS SELECT * FROM `a78`.`tag`;
CREATE VIEW `c78`.`taglinks` AS SELECT * FROM `a78`.`taglinks`;
CREATE VIEW `c78`.`tvshow` AS SELECT * FROM `a78`.`tvshow`;
CREATE VIEW `c78`.`tvshowlinkpath` AS SELECT * FROM `a78`.`tvshowlinkpath`;
CREATE VIEW `c78`.`version` AS SELECT * FROM `a78`.`version`;
CREATE VIEW `c78`.`writerlinkepisode` AS SELECT * FROM `a78`.`writerlinkepisode`;
CREATE VIEW `c78`.`writerlinkmovie` AS SELECT * FROM `a78`.`writerlinkmovie`;
CREATE VIEW `c78`.`files`
AS SELECT
`a78`.`globalfiles`.`idFile` AS `idFile`,
`a78`.`globalfiles`.`idPath` AS `idPath`,
`a78`.`globalfiles`.`strFilename` AS `strFilename`,
`a78`.`globalfiles`.`playCount3` AS `playCount`,
`a78`.`globalfiles`.`lastPlayed3` AS `lastPlayed`,
`a78`.`globalfiles`.`dateAdded` AS `dateAdded`
FROM `a78`.`globalfiles`;
CREATE TABLE `c78`.`bookmark` (
`idBookmark` int(11) NOT NULL AUTO_INCREMENT,
`idFile` int(11) DEFAULT NULL,
`timeInSeconds` double DEFAULT NULL,
`totalTimeInSeconds` double DEFAULT NULL,
`thumbNailImage` text,
`player` text,
`playerState` text,
`type` int(11) DEFAULT NULL,
PRIMARY KEY (`idBookmark`),
KEY `ix_bookmark` (`idFile`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE VIEW `c78`.`episodeview`
AS SELECT
`episode`.`idEpisode` AS `idEpisode`,
`episode`.`idFile` AS `idFile`,
`episode`.`c00` AS `c00`,
`episode`.`c01` AS `c01`,
`episode`.`c02` AS `c02`,
`episode`.`c03` AS `c03`,
`episode`.`c04` AS `c04`,
`episode`.`c05` AS `c05`,
`episode`.`c06` AS `c06`,
`episode`.`c07` AS `c07`,
`episode`.`c08` AS `c08`,
`episode`.`c09` AS `c09`,
`episode`.`c10` AS `c10`,
`episode`.`c11` AS `c11`,
`episode`.`c12` AS `c12`,
`episode`.`c13` AS `c13`,
`episode`.`c14` AS `c14`,
`episode`.`c15` AS `c15`,
`episode`.`c16` AS `c16`,
`episode`.`c17` AS `c17`,
`episode`.`c18` AS `c18`,
`episode`.`c19` AS `c19`,
`episode`.`c20` AS `c20`,
`episode`.`c21` AS `c21`,
`episode`.`c22` AS `c22`,
`episode`.`c23` AS `c23`,
`episode`.`idShow` AS `idShow`,
`files`.`strFilename` AS `strFileName`,
`path`.`strPath` AS `strPath`,
`files`.`playCount` AS `playCount`,
`files`.`lastPlayed` AS `lastPlayed`,
`files`.`dateAdded` AS `dateAdded`,
`tvshow`.`c00` AS `strTitle`,
`tvshow`.`c14` AS `strStudio`,
`tvshow`.`c05` AS `premiered`,
`tvshow`.`c13` AS `mpaa`,
`tvshow`.`c16` AS `strShowPath`,
`c78`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
`c78`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`,
`seasons`.`idSeason` AS `idSeason`
FROM (((((`c78`.`episode` join `c78`.`files` on((`files`.`idFile` = `episode`.`idFile`))) join `c78`.`tvshow` on((`tvshow`.`idShow` = `episode`.`idShow`))) left join `c78`.`seasons` on(((`seasons`.`idShow` = `episode`.`idShow`) and (`seasons`.`season` = `episode`.`c12`)))) join `c78`.`path` on((`files`.`idPath` = `path`.`idPath`))) left join `c78`.`bookmark` on(((`c78`.`bookmark`.`idFile` = `episode`.`idFile`) and (`c78`.`bookmark`.`type` = 1))));
CREATE VIEW `c78`.`movieview`
AS SELECT
`movie`.`idMovie` AS `idMovie`,
`movie`.`idFile` AS `idFile`,
`movie`.`c00` AS `c00`,
`movie`.`c01` AS `c01`,
`movie`.`c02` AS `c02`,
`movie`.`c03` AS `c03`,
`movie`.`c04` AS `c04`,
`movie`.`c05` AS `c05`,
`movie`.`c06` AS `c06`,
`movie`.`c07` AS `c07`,
`movie`.`c08` AS `c08`,
`movie`.`c09` AS `c09`,
`movie`.`c10` AS `c10`,
`movie`.`c11` AS `c11`,
`movie`.`c12` AS `c12`,
`movie`.`c13` AS `c13`,
`movie`.`c14` AS `c14`,
`movie`.`c15` AS `c15`,
`movie`.`c16` AS `c16`,
`movie`.`c17` AS `c17`,
`movie`.`c18` AS `c18`,
`movie`.`c19` AS `c19`,
`movie`.`c20` AS `c20`,
`movie`.`c21` AS `c21`,
`movie`.`c22` AS `c22`,
`movie`.`c23` AS `c23`,
`movie`.`idSet` AS `idSet`,
`sets`.`strSet` AS `strSet`,
`files`.`strFilename` AS `strFileName`,
`path`.`strPath` AS `strPath`,
`files`.`playCount` AS `playCount`,
`files`.`lastPlayed` AS `lastPlayed`,
`files`.`dateAdded` AS `dateAdded`,
`c78`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
`c78`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`
FROM ((((`c78`.`movie` left join `c78`.`sets` on((`sets`.`idSet` = `movie`.`idSet`))) join `c78`.`files` on((`files`.`idFile` = `movie`.`idFile`))) join `c78`.`path` on((`path`.`idPath` = `files`.`idPath`))) left join `c78`.`bookmark` on(((`c78`.`bookmark`.`idFile` = `movie`.`idFile`) and (`c78`.`bookmark`.`type` = 1))));
CREATE VIEW `c78`.`musicvideoview`
AS SELECT
`musicvideo`.`idMVideo` AS `idMVideo`,
`musicvideo`.`idFile` AS `idFile`,
`musicvideo`.`c00` AS `c00`,
`musicvideo`.`c01` AS `c01`,
`musicvideo`.`c02` AS `c02`,
`musicvideo`.`c03` AS `c03`,
`musicvideo`.`c04` AS `c04`,
`musicvideo`.`c05` AS `c05`,
`musicvideo`.`c06` AS `c06`,
`musicvideo`.`c07` AS `c07`,
`musicvideo`.`c08` AS `c08`,
`musicvideo`.`c09` AS `c09`,
`musicvideo`.`c10` AS `c10`,
`musicvideo`.`c11` AS `c11`,
`musicvideo`.`c12` AS `c12`,
`musicvideo`.`c13` AS `c13`,
`musicvideo`.`c14` AS `c14`,
`musicvideo`.`c15` AS `c15`,
`musicvideo`.`c16` AS `c16`,
`musicvideo`.`c17` AS `c17`,
`musicvideo`.`c18` AS `c18`,
`musicvideo`.`c19` AS `c19`,
`musicvideo`.`c20` AS `c20`,
`musicvideo`.`c21` AS `c21`,
`musicvideo`.`c22` AS `c22`,
`musicvideo`.`c23` AS `c23`,
`files`.`strFilename` AS `strFileName`,
`path`.`strPath` AS `strPath`,
`files`.`playCount` AS `playCount`,
`files`.`lastPlayed` AS `lastPlayed`,
`files`.`dateAdded` AS `dateAdded`,
`c78`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
`c78`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`
FROM (((`c78`.`musicvideo` join `c78`.`files` on((`files`.`idFile` = `musicvideo`.`idFile`))) join `c78`.`path` on((`path`.`idPath` = `files`.`idPath`))) left join `c78`.`bookmark` on(((`c78`.`bookmark`.`idFile` = `musicvideo`.`idFile`) and (`c78`.`bookmark`.`type` = 1))));
CREATE VIEW `c78`.`tvshowview`
AS SELECT
`tvshow`.`idShow` AS `idShow`,
`tvshow`.`c00` AS `c00`,
`tvshow`.`c01` AS `c01`,
`tvshow`.`c02` AS `c02`,
`tvshow`.`c03` AS `c03`,
`tvshow`.`c04` AS `c04`,
`tvshow`.`c05` AS `c05`,
`tvshow`.`c06` AS `c06`,
`tvshow`.`c07` AS `c07`,
`tvshow`.`c08` AS `c08`,
`tvshow`.`c09` AS `c09`,
`tvshow`.`c10` AS `c10`,
`tvshow`.`c11` AS `c11`,
`tvshow`.`c12` AS `c12`,
`tvshow`.`c13` AS `c13`,
`tvshow`.`c14` AS `c14`,
`tvshow`.`c15` AS `c15`,
`tvshow`.`c16` AS `c16`,
`tvshow`.`c17` AS `c17`,
`tvshow`.`c18` AS `c18`,
`tvshow`.`c19` AS `c19`,
`tvshow`.`c20` AS `c20`,
`tvshow`.`c21` AS `c21`,
`tvshow`.`c22` AS `c22`,
`tvshow`.`c23` AS `c23`,
`path`.`strPath` AS `strPath`,
`path`.`dateAdded` AS `dateAdded`,max(`files`.`lastPlayed`) AS `lastPlayed`,nullif(count(`episode`.`c12`),0) AS `totalCount`,count(`files`.`playCount`) AS `watchedcount`,nullif(count(distinct `episode`.`c12`),0) AS `totalSeasons`
FROM ((((`c78`.`tvshow` left join `c78`.`tvshowlinkpath` on((`tvshowlinkpath`.`idShow` = `tvshow`.`idShow`))) left join `c78`.`path` on((`path`.`idPath` = `tvshowlinkpath`.`idPath`))) left join `c78`.`episode` on((`episode`.`idShow` = `tvshow`.`idShow`))) left join `c78`.`files` on((`files`.`idFile` = `episode`.`idFile`))) group by `tvshow`.`idShow`;
CREATE DATABASE d78;
CREATE VIEW `d78`.`actorlinkepisode` AS SELECT * FROM `a78`.`actorlinkepisode`;
CREATE VIEW `d78`.`actorlinkmovie` AS SELECT * FROM `a78`.`actorlinkmovie`;
CREATE VIEW `d78`.`actorlinktvshow` AS SELECT * FROM `a78`.`actorlinktvshow`;
CREATE VIEW `d78`.`actors` AS SELECT * FROM `a78`.`actors`;
CREATE VIEW `d78`.`art` AS SELECT * FROM `a78`.`art`;
CREATE VIEW `d78`.`artistlinkmusicvideo` AS SELECT * FROM `a78`.`artistlinkmusicvideo`;
CREATE VIEW `d78`.`country` AS SELECT * FROM `a78`.`country`;
CREATE VIEW `d78`.`countrylinkmovie` AS SELECT * FROM `a78`.`countrylinkmovie`;
CREATE VIEW `d78`.`directorlinkepisode` AS SELECT * FROM `a78`.`directorlinkepisode`;
CREATE VIEW `d78`.`directorlinkmovie` AS SELECT * FROM `a78`.`directorlinkmovie`;
CREATE VIEW `d78`.`directorlinkmusicvideo` AS SELECT * FROM `a78`.`directorlinkmusicvideo`;
CREATE VIEW `d78`.`directorlinktvshow` AS SELECT * FROM `a78`.`directorlinktvshow`;
CREATE VIEW `d78`.`episode` AS SELECT * FROM `a78`.`episode`;
CREATE VIEW `d78`.`genre` AS SELECT * FROM `a78`.`genre`;
CREATE VIEW `d78`.`genrelinkmovie` AS SELECT * FROM `a78`.`genrelinkmovie`;
CREATE VIEW `d78`.`genrelinkmusicvideo` AS SELECT * FROM `a78`.`genrelinkmusicvideo`;
CREATE VIEW `d78`.`genrelinktvshow` AS SELECT * FROM `a78`.`genrelinktvshow`;
CREATE VIEW `d78`.`movie` AS SELECT * FROM `a78`.`movie`;
CREATE VIEW `d78`.`movielinktvshow` AS SELECT * FROM `a78`.`movielinktvshow`;
CREATE VIEW `d78`.`musicvideo` AS SELECT * FROM `a78`.`musicvideo`;
CREATE VIEW `d78`.`path` AS SELECT * FROM `a78`.`path`;
CREATE VIEW `d78`.`seasons` AS SELECT * FROM `a78`.`seasons`;
CREATE VIEW `d78`.`sets` AS SELECT * FROM `a78`.`sets`;
CREATE VIEW `d78`.`settings` AS SELECT * FROM `a78`.`settings`;
CREATE VIEW `d78`.`stacktimes` AS SELECT * FROM `a78`.`stacktimes`;
CREATE VIEW `d78`.`streamdetails` AS SELECT * FROM `a78`.`streamdetails`;
CREATE VIEW `d78`.`studio` AS SELECT * FROM `a78`.`studio`;
CREATE VIEW `d78`.`studiolinkmovie` AS SELECT * FROM `a78`.`studiolinkmovie`;
CREATE VIEW `d78`.`studiolinkmusicvideo` AS SELECT * FROM `a78`.`studiolinkmusicvideo`;
CREATE VIEW `d78`.`studiolinktvshow` AS SELECT * FROM `a78`.`studiolinktvshow`;
CREATE VIEW `d78`.`tag` AS SELECT * FROM `a78`.`tag`;
CREATE VIEW `d78`.`taglinks` AS SELECT * FROM `a78`.`taglinks`;
CREATE VIEW `d78`.`tvshow` AS SELECT * FROM `a78`.`tvshow`;
CREATE VIEW `d78`.`tvshowlinkpath` AS SELECT * FROM `a78`.`tvshowlinkpath`;
CREATE VIEW `d78`.`version` AS SELECT * FROM `a78`.`version`;
CREATE VIEW `d78`.`writerlinkepisode` AS SELECT * FROM `a78`.`writerlinkepisode`;
CREATE VIEW `d78`.`writerlinkmovie` AS SELECT * FROM `a78`.`writerlinkmovie`;
CREATE VIEW `d78`.`files`
AS SELECT
`a78`.`globalfiles`.`idFile` AS `idFile`,
`a78`.`globalfiles`.`idPath` AS `idPath`,
`a78`.`globalfiles`.`strFilename` AS `strFilename`,
`a78`.`globalfiles`.`playCount4` AS `playCount`,
`a78`.`globalfiles`.`lastPlayed4` AS `lastPlayed`,
`a78`.`globalfiles`.`dateAdded` AS `dateAdded`
FROM `a78`.`globalfiles`;
CREATE TABLE `d78`.`bookmark` (
`idBookmark` int(11) NOT NULL AUTO_INCREMENT,
`idFile` int(11) DEFAULT NULL,
`timeInSeconds` double DEFAULT NULL,
`totalTimeInSeconds` double DEFAULT NULL,
`thumbNailImage` text,
`player` text,
`playerState` text,
`type` int(11) DEFAULT NULL,
PRIMARY KEY (`idBookmark`),
KEY `ix_bookmark` (`idFile`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE VIEW `d78`.`episodeview`
AS SELECT
`episode`.`idEpisode` AS `idEpisode`,
`episode`.`idFile` AS `idFile`,
`episode`.`c00` AS `c00`,
`episode`.`c01` AS `c01`,
`episode`.`c02` AS `c02`,
`episode`.`c03` AS `c03`,
`episode`.`c04` AS `c04`,
`episode`.`c05` AS `c05`,
`episode`.`c06` AS `c06`,
`episode`.`c07` AS `c07`,
`episode`.`c08` AS `c08`,
`episode`.`c09` AS `c09`,
`episode`.`c10` AS `c10`,
`episode`.`c11` AS `c11`,
`episode`.`c12` AS `c12`,
`episode`.`c13` AS `c13`,
`episode`.`c14` AS `c14`,
`episode`.`c15` AS `c15`,
`episode`.`c16` AS `c16`,
`episode`.`c17` AS `c17`,
`episode`.`c18` AS `c18`,
`episode`.`c19` AS `c19`,
`episode`.`c20` AS `c20`,
`episode`.`c21` AS `c21`,
`episode`.`c22` AS `c22`,
`episode`.`c23` AS `c23`,
`episode`.`idShow` AS `idShow`,
`files`.`strFilename` AS `strFileName`,
`path`.`strPath` AS `strPath`,
`files`.`playCount` AS `playCount`,
`files`.`lastPlayed` AS `lastPlayed`,
`files`.`dateAdded` AS `dateAdded`,
`tvshow`.`c00` AS `strTitle`,
`tvshow`.`c14` AS `strStudio`,
`tvshow`.`c05` AS `premiered`,
`tvshow`.`c13` AS `mpaa`,
`tvshow`.`c16` AS `strShowPath`,
`d78`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
`d78`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`,
`seasons`.`idSeason` AS `idSeason`
FROM (((((`d78`.`episode` join `d78`.`files` on((`files`.`idFile` = `episode`.`idFile`))) join `d78`.`tvshow` on((`tvshow`.`idShow` = `episode`.`idShow`))) left join `d78`.`seasons` on(((`seasons`.`idShow` = `episode`.`idShow`) and (`seasons`.`season` = `episode`.`c12`)))) join `d78`.`path` on((`files`.`idPath` = `path`.`idPath`))) left join `d78`.`bookmark` on(((`d78`.`bookmark`.`idFile` = `episode`.`idFile`) and (`d78`.`bookmark`.`type` = 1))));
CREATE VIEW `d78`.`movieview`
AS SELECT
`movie`.`idMovie` AS `idMovie`,
`movie`.`idFile` AS `idFile`,
`movie`.`c00` AS `c00`,
`movie`.`c01` AS `c01`,
`movie`.`c02` AS `c02`,
`movie`.`c03` AS `c03`,
`movie`.`c04` AS `c04`,
`movie`.`c05` AS `c05`,
`movie`.`c06` AS `c06`,
`movie`.`c07` AS `c07`,
`movie`.`c08` AS `c08`,
`movie`.`c09` AS `c09`,
`movie`.`c10` AS `c10`,
`movie`.`c11` AS `c11`,
`movie`.`c12` AS `c12`,
`movie`.`c13` AS `c13`,
`movie`.`c14` AS `c14`,
`movie`.`c15` AS `c15`,
`movie`.`c16` AS `c16`,
`movie`.`c17` AS `c17`,
`movie`.`c18` AS `c18`,
`movie`.`c19` AS `c19`,
`movie`.`c20` AS `c20`,
`movie`.`c21` AS `c21`,
`movie`.`c22` AS `c22`,
`movie`.`c23` AS `c23`,
`movie`.`idSet` AS `idSet`,
`sets`.`strSet` AS `strSet`,
`files`.`strFilename` AS `strFileName`,
`path`.`strPath` AS `strPath`,
`files`.`playCount` AS `playCount`,
`files`.`lastPlayed` AS `lastPlayed`,
`files`.`dateAdded` AS `dateAdded`,
`d78`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
`d78`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`
FROM ((((`d78`.`movie` left join `d78`.`sets` on((`sets`.`idSet` = `movie`.`idSet`))) join `d78`.`files` on((`files`.`idFile` = `movie`.`idFile`))) join `d78`.`path` on((`path`.`idPath` = `files`.`idPath`))) left join `d78`.`bookmark` on(((`d78`.`bookmark`.`idFile` = `movie`.`idFile`) and (`d78`.`bookmark`.`type` = 1))));
CREATE VIEW `d78`.`musicvideoview`
AS SELECT
`musicvideo`.`idMVideo` AS `idMVideo`,
`musicvideo`.`idFile` AS `idFile`,
`musicvideo`.`c00` AS `c00`,
`musicvideo`.`c01` AS `c01`,
`musicvideo`.`c02` AS `c02`,
`musicvideo`.`c03` AS `c03`,
`musicvideo`.`c04` AS `c04`,
`musicvideo`.`c05` AS `c05`,
`musicvideo`.`c06` AS `c06`,
`musicvideo`.`c07` AS `c07`,
`musicvideo`.`c08` AS `c08`,
`musicvideo`.`c09` AS `c09`,
`musicvideo`.`c10` AS `c10`,
`musicvideo`.`c11` AS `c11`,
`musicvideo`.`c12` AS `c12`,
`musicvideo`.`c13` AS `c13`,
`musicvideo`.`c14` AS `c14`,
`musicvideo`.`c15` AS `c15`,
`musicvideo`.`c16` AS `c16`,
`musicvideo`.`c17` AS `c17`,
`musicvideo`.`c18` AS `c18`,
`musicvideo`.`c19` AS `c19`,
`musicvideo`.`c20` AS `c20`,
`musicvideo`.`c21` AS `c21`,
`musicvideo`.`c22` AS `c22`,
`musicvideo`.`c23` AS `c23`,
`files`.`strFilename` AS `strFileName`,
`path`.`strPath` AS `strPath`,
`files`.`playCount` AS `playCount`,
`files`.`lastPlayed` AS `lastPlayed`,
`files`.`dateAdded` AS `dateAdded`,
`d78`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
`d78`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`
FROM (((`d78`.`musicvideo` join `d78`.`files` on((`files`.`idFile` = `musicvideo`.`idFile`))) join `d78`.`path` on((`path`.`idPath` = `files`.`idPath`))) left join `d78`.`bookmark` on(((`d78`.`bookmark`.`idFile` = `musicvideo`.`idFile`) and (`d78`.`bookmark`.`type` = 1))));
CREATE VIEW `d78`.`tvshowview`
AS SELECT
`tvshow`.`idShow` AS `idShow`,
`tvshow`.`c00` AS `c00`,
`tvshow`.`c01` AS `c01`,
`tvshow`.`c02` AS `c02`,
`tvshow`.`c03` AS `c03`,
`tvshow`.`c04` AS `c04`,
`tvshow`.`c05` AS `c05`,
`tvshow`.`c06` AS `c06`,
`tvshow`.`c07` AS `c07`,
`tvshow`.`c08` AS `c08`,
`tvshow`.`c09` AS `c09`,
`tvshow`.`c10` AS `c10`,
`tvshow`.`c11` AS `c11`,
`tvshow`.`c12` AS `c12`,
`tvshow`.`c13` AS `c13`,
`tvshow`.`c14` AS `c14`,
`tvshow`.`c15` AS `c15`,
`tvshow`.`c16` AS `c16`,
`tvshow`.`c17` AS `c17`,
`tvshow`.`c18` AS `c18`,
`tvshow`.`c19` AS `c19`,
`tvshow`.`c20` AS `c20`,
`tvshow`.`c21` AS `c21`,
`tvshow`.`c22` AS `c22`,
`tvshow`.`c23` AS `c23`,
`path`.`strPath` AS `strPath`,
`path`.`dateAdded` AS `dateAdded`,max(`files`.`lastPlayed`) AS `lastPlayed`,nullif(count(`episode`.`c12`),0) AS `totalCount`,count(`files`.`playCount`) AS `watchedcount`,nullif(count(distinct `episode`.`c12`),0) AS `totalSeasons`
FROM ((((`d78`.`tvshow` left join `d78`.`tvshowlinkpath` on((`tvshowlinkpath`.`idShow` = `tvshow`.`idShow`))) left join `d78`.`path` on((`path`.`idPath` = `tvshowlinkpath`.`idPath`))) left join `d78`.`episode` on((`episode`.`idShow` = `tvshow`.`idShow`))) left join `d78`.`files` on((`files`.`idFile` = `episode`.`idFile`))) group by `tvshow`.`idShow`;
CREATE DATABASE e78;
CREATE VIEW `e78`.`actorlinkepisode` AS SELECT * FROM `a78`.`actorlinkepisode`;
CREATE VIEW `e78`.`actorlinkmovie` AS SELECT * FROM `a78`.`actorlinkmovie`;
CREATE VIEW `e78`.`actorlinktvshow` AS SELECT * FROM `a78`.`actorlinktvshow`;
CREATE VIEW `e78`.`actors` AS SELECT * FROM `a78`.`actors`;
CREATE VIEW `e78`.`art` AS SELECT * FROM `a78`.`art`;
CREATE VIEW `e78`.`artistlinkmusicvideo` AS SELECT * FROM `a78`.`artistlinkmusicvideo`;
CREATE VIEW `e78`.`country` AS SELECT * FROM `a78`.`country`;
CREATE VIEW `e78`.`countrylinkmovie` AS SELECT * FROM `a78`.`countrylinkmovie`;
CREATE VIEW `e78`.`directorlinkepisode` AS SELECT * FROM `a78`.`directorlinkepisode`;
CREATE VIEW `e78`.`directorlinkmovie` AS SELECT * FROM `a78`.`directorlinkmovie`;
CREATE VIEW `e78`.`directorlinkmusicvideo` AS SELECT * FROM `a78`.`directorlinkmusicvideo`;
CREATE VIEW `e78`.`directorlinktvshow` AS SELECT * FROM `a78`.`directorlinktvshow`;
CREATE VIEW `e78`.`episode` AS SELECT * FROM `a78`.`episode`;
CREATE VIEW `e78`.`genre` AS SELECT * FROM `a78`.`genre`;
CREATE VIEW `e78`.`genrelinkmovie` AS SELECT * FROM `a78`.`genrelinkmovie`;
CREATE VIEW `e78`.`genrelinkmusicvideo` AS SELECT * FROM `a78`.`genrelinkmusicvideo`;
CREATE VIEW `e78`.`genrelinktvshow` AS SELECT * FROM `a78`.`genrelinktvshow`;
CREATE VIEW `e78`.`movie` AS SELECT * FROM `a78`.`movie`;
CREATE VIEW `e78`.`movielinktvshow` AS SELECT * FROM `a78`.`movielinktvshow`;
CREATE VIEW `e78`.`musicvideo` AS SELECT * FROM `a78`.`musicvideo`;
CREATE VIEW `e78`.`path` AS SELECT * FROM `a78`.`path`;
CREATE VIEW `e78`.`seasons` AS SELECT * FROM `a78`.`seasons`;
CREATE VIEW `e78`.`sets` AS SELECT * FROM `a78`.`sets`;
CREATE VIEW `e78`.`settings` AS SELECT * FROM `a78`.`settings`;
CREATE VIEW `e78`.`stacktimes` AS SELECT * FROM `a78`.`stacktimes`;
CREATE VIEW `e78`.`streamdetails` AS SELECT * FROM `a78`.`streamdetails`;
CREATE VIEW `e78`.`studio` AS SELECT * FROM `a78`.`studio`;
CREATE VIEW `e78`.`studiolinkmovie` AS SELECT * FROM `a78`.`studiolinkmovie`;
CREATE VIEW `e78`.`studiolinkmusicvideo` AS SELECT * FROM `a78`.`studiolinkmusicvideo`;
CREATE VIEW `e78`.`studiolinktvshow` AS SELECT * FROM `a78`.`studiolinktvshow`;
CREATE VIEW `e78`.`tag` AS SELECT * FROM `a78`.`tag`;
CREATE VIEW `e78`.`taglinks` AS SELECT * FROM `a78`.`taglinks`;
CREATE VIEW `e78`.`tvshow` AS SELECT * FROM `a78`.`tvshow`;
CREATE VIEW `e78`.`tvshowlinkpath` AS SELECT * FROM `a78`.`tvshowlinkpath`;
CREATE VIEW `e78`.`version` AS SELECT * FROM `a78`.`version`;
CREATE VIEW `e78`.`writerlinkepisode` AS SELECT * FROM `a78`.`writerlinkepisode`;
CREATE VIEW `e78`.`writerlinkmovie` AS SELECT * FROM `a78`.`writerlinkmovie`;
CREATE VIEW `e78`.`files`
AS SELECT
`a78`.`globalfiles`.`idFile` AS `idFile`,
`a78`.`globalfiles`.`idPath` AS `idPath`,
`a78`.`globalfiles`.`strFilename` AS `strFilename`,
`a78`.`globalfiles`.`playCount5` AS `playCount`,
`a78`.`globalfiles`.`lastPlayed5` AS `lastPlayed`,
`a78`.`globalfiles`.`dateAdded` AS `dateAdded`
FROM `a78`.`globalfiles`;
CREATE TABLE `e78`.`bookmark` (
`idBookmark` int(11) NOT NULL AUTO_INCREMENT,
`idFile` int(11) DEFAULT NULL,
`timeInSeconds` double DEFAULT NULL,
`totalTimeInSeconds` double DEFAULT NULL,
`thumbNailImage` text,
`player` text,
`playerState` text,
`type` int(11) DEFAULT NULL,
PRIMARY KEY (`idBookmark`),
KEY `ix_bookmark` (`idFile`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE VIEW `e78`.`episodeview`
AS SELECT
`episode`.`idEpisode` AS `idEpisode`,
`episode`.`idFile` AS `idFile`,
`episode`.`c00` AS `c00`,
`episode`.`c01` AS `c01`,
`episode`.`c02` AS `c02`,
`episode`.`c03` AS `c03`,
`episode`.`c04` AS `c04`,
`episode`.`c05` AS `c05`,
`episode`.`c06` AS `c06`,
`episode`.`c07` AS `c07`,
`episode`.`c08` AS `c08`,
`episode`.`c09` AS `c09`,
`episode`.`c10` AS `c10`,
`episode`.`c11` AS `c11`,
`episode`.`c12` AS `c12`,
`episode`.`c13` AS `c13`,
`episode`.`c14` AS `c14`,
`episode`.`c15` AS `c15`,
`episode`.`c16` AS `c16`,
`episode`.`c17` AS `c17`,
`episode`.`c18` AS `c18`,
`episode`.`c19` AS `c19`,
`episode`.`c20` AS `c20`,
`episode`.`c21` AS `c21`,
`episode`.`c22` AS `c22`,
`episode`.`c23` AS `c23`,
`episode`.`idShow` AS `idShow`,
`files`.`strFilename` AS `strFileName`,
`path`.`strPath` AS `strPath`,
`files`.`playCount` AS `playCount`,
`files`.`lastPlayed` AS `lastPlayed`,
`files`.`dateAdded` AS `dateAdded`,
`tvshow`.`c00` AS `strTitle`,
`tvshow`.`c14` AS `strStudio`,
`tvshow`.`c05` AS `premiered`,
`tvshow`.`c13` AS `mpaa`,
`tvshow`.`c16` AS `strShowPath`,
`e78`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
`e78`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`,
`seasons`.`idSeason` AS `idSeason`
FROM (((((`e78`.`episode` join `e78`.`files` on((`files`.`idFile` = `episode`.`idFile`))) join `e78`.`tvshow` on((`tvshow`.`idShow` = `episode`.`idShow`))) left join `e78`.`seasons` on(((`seasons`.`idShow` = `episode`.`idShow`) and (`seasons`.`season` = `episode`.`c12`)))) join `e78`.`path` on((`files`.`idPath` = `path`.`idPath`))) left join `e78`.`bookmark` on(((`e78`.`bookmark`.`idFile` = `episode`.`idFile`) and (`e78`.`bookmark`.`type` = 1))));
CREATE VIEW `e78`.`movieview`
AS SELECT
`movie`.`idMovie` AS `idMovie`,
`movie`.`idFile` AS `idFile`,
`movie`.`c00` AS `c00`,
`movie`.`c01` AS `c01`,
`movie`.`c02` AS `c02`,
`movie`.`c03` AS `c03`,
`movie`.`c04` AS `c04`,
`movie`.`c05` AS `c05`,
`movie`.`c06` AS `c06`,
`movie`.`c07` AS `c07`,
`movie`.`c08` AS `c08`,
`movie`.`c09` AS `c09`,
`movie`.`c10` AS `c10`,
`movie`.`c11` AS `c11`,
`movie`.`c12` AS `c12`,
`movie`.`c13` AS `c13`,
`movie`.`c14` AS `c14`,
`movie`.`c15` AS `c15`,
`movie`.`c16` AS `c16`,
`movie`.`c17` AS `c17`,
`movie`.`c18` AS `c18`,
`movie`.`c19` AS `c19`,
`movie`.`c20` AS `c20`,
`movie`.`c21` AS `c21`,
`movie`.`c22` AS `c22`,
`movie`.`c23` AS `c23`,
`movie`.`idSet` AS `idSet`,
`sets`.`strSet` AS `strSet`,
`files`.`strFilename` AS `strFileName`,
`path`.`strPath` AS `strPath`,
`files`.`playCount` AS `playCount`,
`files`.`lastPlayed` AS `lastPlayed`,
`files`.`dateAdded` AS `dateAdded`,
`e78`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
`e78`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`
FROM ((((`e78`.`movie` left join `e78`.`sets` on((`sets`.`idSet` = `movie`.`idSet`))) join `e78`.`files` on((`files`.`idFile` = `movie`.`idFile`))) join `e78`.`path` on((`path`.`idPath` = `files`.`idPath`))) left join `e78`.`bookmark` on(((`e78`.`bookmark`.`idFile` = `movie`.`idFile`) and (`e78`.`bookmark`.`type` = 1))));
CREATE VIEW `e78`.`musicvideoview`
AS SELECT
`musicvideo`.`idMVideo` AS `idMVideo`,
`musicvideo`.`idFile` AS `idFile`,
`musicvideo`.`c00` AS `c00`,
`musicvideo`.`c01` AS `c01`,
`musicvideo`.`c02` AS `c02`,
`musicvideo`.`c03` AS `c03`,
`musicvideo`.`c04` AS `c04`,
`musicvideo`.`c05` AS `c05`,
`musicvideo`.`c06` AS `c06`,
`musicvideo`.`c07` AS `c07`,
`musicvideo`.`c08` AS `c08`,
`musicvideo`.`c09` AS `c09`,
`musicvideo`.`c10` AS `c10`,
`musicvideo`.`c11` AS `c11`,
`musicvideo`.`c12` AS `c12`,
`musicvideo`.`c13` AS `c13`,
`musicvideo`.`c14` AS `c14`,
`musicvideo`.`c15` AS `c15`,
`musicvideo`.`c16` AS `c16`,
`musicvideo`.`c17` AS `c17`,
`musicvideo`.`c18` AS `c18`,
`musicvideo`.`c19` AS `c19`,
`musicvideo`.`c20` AS `c20`,
`musicvideo`.`c21` AS `c21`,
`musicvideo`.`c22` AS `c22`,
`musicvideo`.`c23` AS `c23`,
`files`.`strFilename` AS `strFileName`,
`path`.`strPath` AS `strPath`,
`files`.`playCount` AS `playCount`,
`files`.`lastPlayed` AS `lastPlayed`,
`files`.`dateAdded` AS `dateAdded`,
`e78`.`bookmark`.`timeInSeconds` AS `resumeTimeInSeconds`,
`e78`.`bookmark`.`totalTimeInSeconds` AS `totalTimeInSeconds`
FROM (((`e78`.`musicvideo` join `e78`.`files` on((`files`.`idFile` = `musicvideo`.`idFile`))) join `e78`.`path` on((`path`.`idPath` = `files`.`idPath`))) left join `e78`.`bookmark` on(((`e78`.`bookmark`.`idFile` = `musicvideo`.`idFile`) and (`e78`.`bookmark`.`type` = 1))));
CREATE VIEW `e78`.`tvshowview`
AS SELECT
`tvshow`.`idShow` AS `idShow`,
`tvshow`.`c00` AS `c00`,
`tvshow`.`c01` AS `c01`,
`tvshow`.`c02` AS `c02`,
`tvshow`.`c03` AS `c03`,
`tvshow`.`c04` AS `c04`,
`tvshow`.`c05` AS `c05`,
`tvshow`.`c06` AS `c06`,
`tvshow`.`c07` AS `c07`,
`tvshow`.`c08` AS `c08`,
`tvshow`.`c09` AS `c09`,
`tvshow`.`c10` AS `c10`,
`tvshow`.`c11` AS `c11`,
`tvshow`.`c12` AS `c12`,
`tvshow`.`c13` AS `c13`,
`tvshow`.`c14` AS `c14`,
`tvshow`.`c15` AS `c15`,
`tvshow`.`c16` AS `c16`,
`tvshow`.`c17` AS `c17`,
`tvshow`.`c18` AS `c18`,
`tvshow`.`c19` AS `c19`,
`tvshow`.`c20` AS `c20`,
`tvshow`.`c21` AS `c21`,
`tvshow`.`c22` AS `c22`,
`tvshow`.`c23` AS `c23`,
`path`.`strPath` AS `strPath`,
`path`.`dateAdded` AS `dateAdded`,max(`files`.`lastPlayed`) AS `lastPlayed`,nullif(count(`episode`.`c12`),0) AS `totalCount`,count(`files`.`playCount`) AS `watchedcount`,nullif(count(distinct `episode`.`c12`),0) AS `totalSeasons`
FROM ((((`e78`.`tvshow` left join `e78`.`tvshowlinkpath` on((`tvshowlinkpath`.`idShow` = `tvshow`.`idShow`))) left join `e78`.`path` on((`path`.`idPath` = `tvshowlinkpath`.`idPath`))) left join `e78`.`episode` on((`episode`.`idShow` = `tvshow`.`idShow`))) left join `e78`.`files` on((`files`.`idFile` = `episode`.`idFile`))) group by `tvshow`.`idShow`;