void CTextureDatabase::CreateTables()
{
- CLog::Log(LOGINFO, "create texture table");
- m_pDS->exec("CREATE TABLE texture (id integer primary key, url text, cachedurl text, imagehash text, lasthashcheck text)");
+ CLog::Log(LOGINFO, "create texture table");
+ m_pDS->exec("CREATE TABLE texture (id integer primary key, url text, cachedurl text, imagehash text, lasthashcheck text)");
- CLog::Log(LOGINFO, "create sizes table, index, and trigger");
- m_pDS->exec("CREATE TABLE sizes (idtexture integer, size integer, width integer, height integer, usecount integer, lastusetime text)");
+ CLog::Log(LOGINFO, "create sizes table, index, and trigger");
+ m_pDS->exec("CREATE TABLE sizes (idtexture integer, size integer, width integer, height integer, usecount integer, lastusetime text)");
- CLog::Log(LOGINFO, "create path table");
- m_pDS->exec("CREATE TABLE path (id integer primary key, url text, type text, texture text)\n");
+ CLog::Log(LOGINFO, "create path table");
+ m_pDS->exec("CREATE TABLE path (id integer primary key, url text, type text, texture text)\n");
}
void CTextureDatabase::CreateAnalytics()
void CAddonDatabase::CreateTables()
{
- CLog::Log(LOGINFO, "create addon table");
- m_pDS->exec("CREATE TABLE addon (id integer primary key, type text,"
- "name text, summary text, description text, stars integer,"
- "path text, addonID text, icon text, version text, "
- "changelog text, fanart text, author text, disclaimer text,"
- "minversion text)\n");
+ CLog::Log(LOGINFO, "create addon table");
+ m_pDS->exec("CREATE TABLE addon (id integer primary key, type text,"
+ "name text, summary text, description text, stars integer,"
+ "path text, addonID text, icon text, version text, "
+ "changelog text, fanart text, author text, disclaimer text,"
+ "minversion text)\n");
- CLog::Log(LOGINFO, "create addonextra table");
- m_pDS->exec("CREATE TABLE addonextra (id integer, key text, value text)\n");
+ CLog::Log(LOGINFO, "create addonextra table");
+ m_pDS->exec("CREATE TABLE addonextra (id integer, key text, value text)\n");
- CLog::Log(LOGINFO, "create dependencies table");
- m_pDS->exec("CREATE TABLE dependencies (id integer, addon text, version text, optional boolean)\n");
+ CLog::Log(LOGINFO, "create dependencies table");
+ m_pDS->exec("CREATE TABLE dependencies (id integer, addon text, version text, optional boolean)\n");
- CLog::Log(LOGINFO, "create repo table");
- m_pDS->exec("CREATE TABLE repo (id integer primary key, addonID text,"
- "checksum text, lastcheck text)\n");
+ CLog::Log(LOGINFO, "create repo table");
+ m_pDS->exec("CREATE TABLE repo (id integer primary key, addonID text,"
+ "checksum text, lastcheck text)\n");
- CLog::Log(LOGINFO, "create addonlinkrepo table");
- m_pDS->exec("CREATE TABLE addonlinkrepo (idRepo integer, idAddon integer)\n");
+ CLog::Log(LOGINFO, "create addonlinkrepo table");
+ m_pDS->exec("CREATE TABLE addonlinkrepo (idRepo integer, idAddon integer)\n");
- CLog::Log(LOGINFO, "create disabled table");
- m_pDS->exec("CREATE TABLE disabled (id integer primary key, addonID text)\n");
+ CLog::Log(LOGINFO, "create disabled table");
+ m_pDS->exec("CREATE TABLE disabled (id integer primary key, addonID text)\n");
- CLog::Log(LOGINFO, "create broken table");
- m_pDS->exec("CREATE TABLE broken (id integer primary key, addonID text, reason text)\n");
+ CLog::Log(LOGINFO, "create broken table");
+ m_pDS->exec("CREATE TABLE broken (id integer primary key, addonID text, reason text)\n");
- CLog::Log(LOGINFO, "create blacklist table");
- m_pDS->exec("CREATE TABLE blacklist (id integer primary key, addonID text, version text)\n");
+ CLog::Log(LOGINFO, "create blacklist table");
+ m_pDS->exec("CREATE TABLE blacklist (id integer primary key, addonID text, version text)\n");
- CLog::Log(LOGINFO, "create package table");
- m_pDS->exec("CREATE TABLE package (id integer primary key, addonID text, filename text, hash text)\n");
+ CLog::Log(LOGINFO, "create package table");
+ m_pDS->exec("CREATE TABLE package (id integer primary key, addonID text, filename text, hash text)\n");
}
void CAddonDatabase::CreateAnalytics()
void CEpgDatabase::CreateTables(void)
{
- CLog::Log(LOGINFO, "EpgDB - %s - creating tables", __FUNCTION__);
-
- CLog::Log(LOGDEBUG, "EpgDB - %s - creating table 'epg'", __FUNCTION__);
- m_pDS->exec(
- "CREATE TABLE epg ("
- "idEpg integer primary key, "
- "sName varchar(64),"
- "sScraperName varchar(32)"
- ")"
- );
-
- CLog::Log(LOGDEBUG, "EpgDB - %s - creating table 'epgtags'", __FUNCTION__);
- m_pDS->exec(
- "CREATE TABLE epgtags ("
- "idBroadcast integer primary key, "
- "iBroadcastUid integer, "
- "idEpg integer, "
- "sTitle varchar(128), "
- "sPlotOutline text, "
- "sPlot text, "
- "iStartTime integer, "
- "iEndTime integer, "
- "iGenreType integer, "
- "iGenreSubType integer, "
- "sGenre varchar(128), "
- "iFirstAired integer, "
- "iParentalRating integer, "
- "iStarRating integer, "
- "bNotify bool, "
- "iSeriesId integer, "
- "iEpisodeId integer, "
- "iEpisodePart integer, "
- "sEpisodeName varchar(128)"
- ")"
- );
- CLog::Log(LOGDEBUG, "EpgDB - %s - creating table 'lastepgscan'", __FUNCTION__);
- m_pDS->exec("CREATE TABLE lastepgscan ("
- "idEpg integer primary key, "
- "sLastScan varchar(20)"
- ")"
- );
+ CLog::Log(LOGINFO, "EpgDB - %s - creating tables", __FUNCTION__);
+
+ CLog::Log(LOGDEBUG, "EpgDB - %s - creating table 'epg'", __FUNCTION__);
+ m_pDS->exec(
+ "CREATE TABLE epg ("
+ "idEpg integer primary key, "
+ "sName varchar(64),"
+ "sScraperName varchar(32)"
+ ")"
+ );
+
+ CLog::Log(LOGDEBUG, "EpgDB - %s - creating table 'epgtags'", __FUNCTION__);
+ m_pDS->exec(
+ "CREATE TABLE epgtags ("
+ "idBroadcast integer primary key, "
+ "iBroadcastUid integer, "
+ "idEpg integer, "
+ "sTitle varchar(128), "
+ "sPlotOutline text, "
+ "sPlot text, "
+ "iStartTime integer, "
+ "iEndTime integer, "
+ "iGenreType integer, "
+ "iGenreSubType integer, "
+ "sGenre varchar(128), "
+ "iFirstAired integer, "
+ "iParentalRating integer, "
+ "iStarRating integer, "
+ "bNotify bool, "
+ "iSeriesId integer, "
+ "iEpisodeId integer, "
+ "iEpisodePart integer, "
+ "sEpisodeName varchar(128)"
+ ")"
+ );
+ CLog::Log(LOGDEBUG, "EpgDB - %s - creating table 'lastepgscan'", __FUNCTION__);
+ m_pDS->exec("CREATE TABLE lastepgscan ("
+ "idEpg integer primary key, "
+ "sLastScan varchar(20)"
+ ")"
+ );
}
void CEpgDatabase::CreateAnalytics()
void CMusicDatabase::CreateTables()
{
- CLog::Log(LOGINFO, "create artist table");
- m_pDS->exec("CREATE TABLE artist ( idArtist integer primary key, "
- " strArtist varchar(256), strMusicBrainzArtistID text, "
- " strBorn text, strFormed text, strGenres text, strMoods text, "
- " strStyles text, strInstruments text, strBiography text, "
- " strDied text, strDisbanded text, strYearsActive text, "
- " strImage text, strFanart text, "
- " lastScraped varchar(20) default NULL, "
- " dateAdded varchar (20) default NULL)");
- CLog::Log(LOGINFO, "create album table");
- m_pDS->exec("CREATE TABLE album (idAlbum integer primary key, "
- " strAlbum varchar(256), strMusicBrainzAlbumID text, "
- " strArtists text, strGenres text, "
- " iYear integer, idThumb integer, "
- " bCompilation integer not null default '0', "
- " strMoods text, strStyles text, strThemes text, "
- " strReview text, strImage text, strLabel text, "
- " strType text, "
- " iRating integer, "
- " lastScraped varchar(20) default NULL, "
- " dateAdded varchar (20) default NULL)");
- CLog::Log(LOGINFO, "create album_artist table");
- m_pDS->exec("CREATE TABLE album_artist ( idArtist integer, idAlbum integer, strJoinPhrase text, boolFeatured integer, iOrder integer, strArtist text )\n");
- CLog::Log(LOGINFO, "create album_genre table");
- m_pDS->exec("CREATE TABLE album_genre ( idGenre integer, idAlbum integer, iOrder integer )\n");
-
- CLog::Log(LOGINFO, "create genre table");
- m_pDS->exec("CREATE TABLE genre ( idGenre integer primary key, strGenre varchar(256))\n");
- CLog::Log(LOGINFO, "create path table");
- m_pDS->exec("CREATE TABLE path ( idPath integer primary key, strPath varchar(512), strHash text)\n");
- CLog::Log(LOGINFO, "create song table");
- m_pDS->exec("CREATE TABLE song ( idSong integer primary key, "
- " idAlbum integer, idPath integer, "
- " strArtists text, strGenres text, strTitle varchar(512), "
- " iTrack integer, iDuration integer, iYear integer, "
- " dwFileNameCRC text, "
- " strFileName text, strMusicBrainzTrackID text, "
- " iTimesPlayed integer, iStartOffset integer, iEndOffset integer, "
- " idThumb integer, "
- " lastplayed varchar(20) default NULL, "
- " rating char default '0', comment text)");
- CLog::Log(LOGINFO, "create song_artist table");
- m_pDS->exec("CREATE TABLE song_artist ( idArtist integer, idSong integer, strJoinPhrase text, boolFeatured integer, iOrder integer, strArtist text )\n");
- CLog::Log(LOGINFO, "create song_genre table");
- m_pDS->exec("CREATE TABLE song_genre ( idGenre integer, idSong integer, iOrder integer )\n");
-
- CLog::Log(LOGINFO, "create albuminfosong table");
- m_pDS->exec("CREATE TABLE albuminfosong ( idAlbumInfoSong integer primary key, idAlbumInfo integer, iTrack integer, strTitle text, iDuration integer)\n");
-
- CLog::Log(LOGINFO, "create content table");
- m_pDS->exec("CREATE TABLE content (strPath text, strScraperPath text, strContent text, strSettings text)\n");
- CLog::Log(LOGINFO, "create discography table");
- m_pDS->exec("CREATE TABLE discography (idArtist integer, strAlbum text, strYear text)\n");
-
- CLog::Log(LOGINFO, "create karaokedata table");
- m_pDS->exec("CREATE TABLE karaokedata ( iKaraNumber integer, idSong integer, iKaraDelay integer, strKaraEncoding text, "
- "strKaralyrics text, strKaraLyrFileCRC text )\n");
-
- CLog::Log(LOGINFO, "create art table");
- m_pDS->exec("CREATE TABLE art(art_id INTEGER PRIMARY KEY, media_id INTEGER, media_type TEXT, type TEXT, url TEXT)");
-
- // Add 'Karaoke' genre
- AddGenre( "Karaoke" );
+ CLog::Log(LOGINFO, "create artist table");
+ m_pDS->exec("CREATE TABLE artist ( idArtist integer primary key, "
+ " strArtist varchar(256), strMusicBrainzArtistID text, "
+ " strBorn text, strFormed text, strGenres text, strMoods text, "
+ " strStyles text, strInstruments text, strBiography text, "
+ " strDied text, strDisbanded text, strYearsActive text, "
+ " strImage text, strFanart text, "
+ " lastScraped varchar(20) default NULL, "
+ " dateAdded varchar (20) default NULL)");
+ CLog::Log(LOGINFO, "create album table");
+ m_pDS->exec("CREATE TABLE album (idAlbum integer primary key, "
+ " strAlbum varchar(256), strMusicBrainzAlbumID text, "
+ " strArtists text, strGenres text, "
+ " iYear integer, idThumb integer, "
+ " bCompilation integer not null default '0', "
+ " strMoods text, strStyles text, strThemes text, "
+ " strReview text, strImage text, strLabel text, "
+ " strType text, "
+ " iRating integer, "
+ " lastScraped varchar(20) default NULL, "
+ " dateAdded varchar (20) default NULL)");
+ CLog::Log(LOGINFO, "create album_artist table");
+ m_pDS->exec("CREATE TABLE album_artist (idArtist integer, idAlbum integer, strJoinPhrase text, boolFeatured integer, iOrder integer, strArtist text)");
+ CLog::Log(LOGINFO, "create album_genre table");
+ m_pDS->exec("CREATE TABLE album_genre (idGenre integer, idAlbum integer, iOrder integer)");
+
+ CLog::Log(LOGINFO, "create genre table");
+ m_pDS->exec("CREATE TABLE genre (idGenre integer primary key, strGenre varchar(256))");
+ CLog::Log(LOGINFO, "create path table");
+ m_pDS->exec("CREATE TABLE path (idPath integer primary key, strPath varchar(512), strHash text)");
+ CLog::Log(LOGINFO, "create song table");
+ m_pDS->exec("CREATE TABLE song (idSong integer primary key, "
+ " idAlbum integer, idPath integer, "
+ " strArtists text, strGenres text, strTitle varchar(512), "
+ " iTrack integer, iDuration integer, iYear integer, "
+ " dwFileNameCRC text, "
+ " strFileName text, strMusicBrainzTrackID text, "
+ " iTimesPlayed integer, iStartOffset integer, iEndOffset integer, "
+ " idThumb integer, "
+ " lastplayed varchar(20) default NULL, "
+ " rating char default '0', comment text)");
+ CLog::Log(LOGINFO, "create song_artist table");
+ m_pDS->exec("CREATE TABLE song_artist (idArtist integer, idSong integer, strJoinPhrase text, boolFeatured integer, iOrder integer, strArtist text)");
+ CLog::Log(LOGINFO, "create song_genre table");
+ m_pDS->exec("CREATE TABLE song_genre (idGenre integer, idSong integer, iOrder integer)");
+
+ CLog::Log(LOGINFO, "create albuminfosong table");
+ m_pDS->exec("CREATE TABLE albuminfosong (idAlbumInfoSong integer primary key, idAlbumInfo integer, iTrack integer, strTitle text, iDuration integer)");
+
+ CLog::Log(LOGINFO, "create content table");
+ m_pDS->exec("CREATE TABLE content (strPath text, strScraperPath text, strContent text, strSettings text)");
+ CLog::Log(LOGINFO, "create discography table");
+ m_pDS->exec("CREATE TABLE discography (idArtist integer, strAlbum text, strYear text)");
+
+ CLog::Log(LOGINFO, "create karaokedata table");
+ m_pDS->exec("CREATE TABLE karaokedata (iKaraNumber integer, idSong integer, iKaraDelay integer, strKaraEncoding text, "
+ "strKaralyrics text, strKaraLyrFileCRC text)");
+
+ CLog::Log(LOGINFO, "create art table");
+ m_pDS->exec("CREATE TABLE art(art_id INTEGER PRIMARY KEY, media_id INTEGER, media_type TEXT, type TEXT, url TEXT)");
+
+ // Add 'Karaoke' genre
+ AddGenre( "Karaoke" );
}
void CMusicDatabase::CreateAnalytics()
{
- CLog::Log(LOGINFO, "create album index");
+ CLog::Log(LOGINFO, "%s - creating indices", __FUNCTION__);
m_pDS->exec("CREATE INDEX idxAlbum ON album(strAlbum(255))");
- CLog::Log(LOGINFO, "create album compilation index");
m_pDS->exec("CREATE INDEX idxAlbum_1 ON album(bCompilation)");
- CLog::Log(LOGINFO, "create unique album name index");
m_pDS->exec("CREATE UNIQUE INDEX idxAlbum_2 ON album(strMusicBrainzAlbumID(36))");
- CLog::Log(LOGINFO, "create album_artist indexes");
- m_pDS->exec("CREATE UNIQUE INDEX idxAlbumArtist_1 ON album_artist ( idAlbum, idArtist )\n");
- m_pDS->exec("CREATE UNIQUE INDEX idxAlbumArtist_2 ON album_artist ( idArtist, idAlbum )\n");
- m_pDS->exec("CREATE INDEX idxAlbumArtist_3 ON album_artist ( boolFeatured )\n");
+ m_pDS->exec("CREATE UNIQUE INDEX idxAlbumArtist_1 ON album_artist ( idAlbum, idArtist )");
+ m_pDS->exec("CREATE UNIQUE INDEX idxAlbumArtist_2 ON album_artist ( idArtist, idAlbum )");
+ m_pDS->exec("CREATE INDEX idxAlbumArtist_3 ON album_artist ( boolFeatured )");
- CLog::Log(LOGINFO, "create album_genre indexes");
- m_pDS->exec("CREATE UNIQUE INDEX idxAlbumGenre_1 ON album_genre ( idAlbum, idGenre )\n");
- m_pDS->exec("CREATE UNIQUE INDEX idxAlbumGenre_2 ON album_genre ( idGenre, idAlbum )\n");
+ m_pDS->exec("CREATE UNIQUE INDEX idxAlbumGenre_1 ON album_genre ( idAlbum, idGenre )");
+ m_pDS->exec("CREATE UNIQUE INDEX idxAlbumGenre_2 ON album_genre ( idGenre, idAlbum )");
- CLog::Log(LOGINFO, "create genre index");
m_pDS->exec("CREATE INDEX idxGenre ON genre(strGenre(255))");
- CLog::Log(LOGINFO, "create artist indexes");
m_pDS->exec("CREATE INDEX idxArtist ON artist(strArtist(255))");
m_pDS->exec("CREATE UNIQUE INDEX idxArtist1 ON artist(strMusicBrainzArtistID(36))");
- CLog::Log(LOGINFO, "create path index");
m_pDS->exec("CREATE INDEX idxPath ON path(strPath(255))");
- CLog::Log(LOGINFO, "create song index");
m_pDS->exec("CREATE INDEX idxSong ON song(strTitle(255))");
- CLog::Log(LOGINFO, "create song index1");
m_pDS->exec("CREATE INDEX idxSong1 ON song(iTimesPlayed)");
- CLog::Log(LOGINFO, "create song index2");
m_pDS->exec("CREATE INDEX idxSong2 ON song(lastplayed)");
- CLog::Log(LOGINFO, "create song index3");
m_pDS->exec("CREATE INDEX idxSong3 ON song(idAlbum)");
- CLog::Log(LOGINFO, "create song index6");
m_pDS->exec("CREATE INDEX idxSong6 ON song( idPath, strFileName(255) )");
- CLog::Log(LOGINFO, "create song index7");
m_pDS->exec("CREATE UNIQUE INDEX idxSong7 ON song( idAlbum, strMusicBrainzTrackID(36) )");
- CLog::Log(LOGINFO, "create song_artist indexes");
- m_pDS->exec("CREATE UNIQUE INDEX idxSongArtist_1 ON song_artist ( idSong, idArtist )\n");
- m_pDS->exec("CREATE UNIQUE INDEX idxSongArtist_2 ON song_artist ( idArtist, idSong )\n");
- m_pDS->exec("CREATE INDEX idxSongArtist_3 ON song_artist ( boolFeatured )\n");
+ m_pDS->exec("CREATE UNIQUE INDEX idxSongArtist_1 ON song_artist ( idSong, idArtist )");
+ m_pDS->exec("CREATE UNIQUE INDEX idxSongArtist_2 ON song_artist ( idArtist, idSong )");
+ m_pDS->exec("CREATE INDEX idxSongArtist_3 ON song_artist ( boolFeatured )");
- CLog::Log(LOGINFO, "create song_genre indexes");
- m_pDS->exec("CREATE UNIQUE INDEX idxSongGenre_1 ON song_genre ( idSong, idGenre )\n");
- m_pDS->exec("CREATE UNIQUE INDEX idxSongGenre_2 ON song_genre ( idGenre, idSong )\n");
- //m_pDS->exec("CREATE INDEX idxSong ON song(dwFileNameCRC)");
+ m_pDS->exec("CREATE UNIQUE INDEX idxSongGenre_1 ON song_genre ( idSong, idGenre )");
+ m_pDS->exec("CREATE UNIQUE INDEX idxSongGenre_2 ON song_genre ( idGenre, idSong )");
- CLog::Log(LOGINFO, "create albuminfosong indexes");
- m_pDS->exec("CREATE INDEX idxAlbumInfoSong_1 ON albuminfosong ( idAlbumInfo )\n");
+ m_pDS->exec("CREATE INDEX idxAlbumInfoSong_1 ON albuminfosong ( idAlbumInfo )");
- CLog::Log(LOGINFO, "create karaokedata index");
m_pDS->exec("CREATE INDEX idxKaraNumber on karaokedata(iKaraNumber)");
m_pDS->exec("CREATE INDEX idxKarSong on karaokedata(idSong)");
- CLog::Log(LOGINFO, "create discography indexes");
- m_pDS->exec("CREATE INDEX idxDiscography_1 ON discography ( idArtist )\n");
+ m_pDS->exec("CREATE INDEX idxDiscography_1 ON discography ( idArtist )");
m_pDS->exec("CREATE INDEX ix_art ON art(media_id, media_type(20), type(20))");
void CPVRDatabase::CreateTables()
{
- CLog::Log(LOGINFO, "PVR - %s - creating tables", __FUNCTION__);
-
- CLog::Log(LOGDEBUG, "PVR - %s - creating table 'clients'", __FUNCTION__);
- m_pDS->exec(
- "CREATE TABLE clients ("
- "idClient integer primary key, "
- "sName varchar(64), "
- "sUid varchar(32)"
- ")"
- );
-
- CLog::Log(LOGDEBUG, "PVR - %s - creating table 'channels'", __FUNCTION__);
- m_pDS->exec(
- "CREATE TABLE channels ("
- "idChannel integer primary key, "
- "iUniqueId integer, "
- "bIsRadio bool, "
- "bIsHidden bool, "
- "bIsUserSetIcon bool, "
- "bIsLocked bool, "
- "sIconPath varchar(255), "
- "sChannelName varchar(64), "
- "bIsVirtual bool, "
- "bEPGEnabled bool, "
- "sEPGScraper varchar(32), "
- "iLastWatched integer,"
-
- // TODO use mapping table
- "iClientId integer, "
- "iClientChannelNumber integer, "
- "sInputFormat varchar(32), "
- "sStreamURL varchar(255), "
- "iEncryptionSystem integer, "
-
- "idEpg integer"
- ")"
- );
-
- // TODO use a mapping table so multiple backends per channel can be implemented
- // CLog::Log(LOGDEBUG, "PVR - %s - creating table 'map_channels_clients'", __FUNCTION__);
- // m_pDS->exec(
- // "CREATE TABLE map_channels_clients ("
- // "idChannel integer primary key, "
- // "idClient integer, "
- // "iClientChannelNumber integer,"
- // "sInputFormat string,"
- // "sStreamURL string,"
- // "iEncryptionSystem integer"
- // ");"
- // );
- // m_pDS->exec("CREATE UNIQUE INDEX idx_idChannel_idClient on map_channels_clients(idChannel, idClient);");
-
- CLog::Log(LOGDEBUG, "PVR - %s - creating table 'channelgroups'", __FUNCTION__);
- m_pDS->exec(
- "CREATE TABLE channelgroups ("
- "idGroup integer primary key,"
- "bIsRadio bool, "
- "iGroupType integer, "
- "sName varchar(64)"
- ")"
- );
-
- CLog::Log(LOGDEBUG, "PVR - %s - creating table 'map_channelgroups_channels'", __FUNCTION__);
- m_pDS->exec(
- "CREATE TABLE map_channelgroups_channels ("
- "idChannel integer, "
- "idGroup integer, "
- "iChannelNumber integer"
- ")"
- );
-
- CLog::Log(LOGDEBUG, "PVR - %s - creating table 'channelsettings'", __FUNCTION__);
- m_pDS->exec(
- "CREATE TABLE channelsettings ("
- "idChannel integer primary key, "
- "iInterlaceMethod integer, "
- "iViewMode integer, "
- "fCustomZoomAmount float, "
- "fPixelRatio float, "
- "iAudioStream integer, "
- "iSubtitleStream integer,"
- "fSubtitleDelay float, "
- "bSubtitles bool, "
- "fBrightness float, "
- "fContrast float, "
- "fGamma float,"
- "fVolumeAmplification float, "
- "fAudioDelay float, "
- "bOutputToAllSpeakers bool, "
- "bCrop bool, "
- "iCropLeft integer, "
- "iCropRight integer, "
- "iCropTop integer, "
- "iCropBottom integer, "
- "fSharpness float, "
- "fNoiseReduction float, "
- "fCustomVerticalShift float, "
- "bCustomNonLinStretch bool, "
- "bPostProcess bool, "
- "iScalingMethod integer, "
- "iDeinterlaceMode integer "
- ")"
- );
-
- // disable all PVR add-on when started the first time
- ADDON::VECADDONS addons;
- if (!CAddonMgr::Get().GetAddons(ADDON_PVRDLL, addons, true))
- CLog::Log(LOGERROR, "PVR - %s - failed to get add-ons from the add-on manager", __FUNCTION__);
- else
- {
- for (IVECADDONS it = addons.begin(); it != addons.end(); it++)
- CAddonMgr::Get().DisableAddon(it->get()->ID());
- }
+ CLog::Log(LOGINFO, "PVR - %s - creating tables", __FUNCTION__);
+
+ CLog::Log(LOGDEBUG, "PVR - %s - creating table 'clients'", __FUNCTION__);
+ m_pDS->exec(
+ "CREATE TABLE clients ("
+ "idClient integer primary key, "
+ "sName varchar(64), "
+ "sUid varchar(32)"
+ ")"
+ );
+
+ CLog::Log(LOGDEBUG, "PVR - %s - creating table 'channels'", __FUNCTION__);
+ m_pDS->exec(
+ "CREATE TABLE channels ("
+ "idChannel integer primary key, "
+ "iUniqueId integer, "
+ "bIsRadio bool, "
+ "bIsHidden bool, "
+ "bIsUserSetIcon bool, "
+ "bIsLocked bool, "
+ "sIconPath varchar(255), "
+ "sChannelName varchar(64), "
+ "bIsVirtual bool, "
+ "bEPGEnabled bool, "
+ "sEPGScraper varchar(32), "
+ "iLastWatched integer,"
+
+ // TODO use mapping table
+ "iClientId integer, "
+ "iClientChannelNumber integer, "
+ "sInputFormat varchar(32), "
+ "sStreamURL varchar(255), "
+ "iEncryptionSystem integer, "
+
+ "idEpg integer"
+ ")"
+ );
+
+ // TODO use a mapping table so multiple backends per channel can be implemented
+ // CLog::Log(LOGDEBUG, "PVR - %s - creating table 'map_channels_clients'", __FUNCTION__);
+ // m_pDS->exec(
+ // "CREATE TABLE map_channels_clients ("
+ // "idChannel integer primary key, "
+ // "idClient integer, "
+ // "iClientChannelNumber integer,"
+ // "sInputFormat string,"
+ // "sStreamURL string,"
+ // "iEncryptionSystem integer"
+ // ");"
+ // );
+ // m_pDS->exec("CREATE UNIQUE INDEX idx_idChannel_idClient on map_channels_clients(idChannel, idClient);");
+
+ CLog::Log(LOGDEBUG, "PVR - %s - creating table 'channelgroups'", __FUNCTION__);
+ m_pDS->exec(
+ "CREATE TABLE channelgroups ("
+ "idGroup integer primary key,"
+ "bIsRadio bool, "
+ "iGroupType integer, "
+ "sName varchar(64)"
+ ")"
+ );
+
+ CLog::Log(LOGDEBUG, "PVR - %s - creating table 'map_channelgroups_channels'", __FUNCTION__);
+ m_pDS->exec(
+ "CREATE TABLE map_channelgroups_channels ("
+ "idChannel integer, "
+ "idGroup integer, "
+ "iChannelNumber integer"
+ ")"
+ );
+
+ CLog::Log(LOGDEBUG, "PVR - %s - creating table 'channelsettings'", __FUNCTION__);
+ m_pDS->exec(
+ "CREATE TABLE channelsettings ("
+ "idChannel integer primary key, "
+ "iInterlaceMethod integer, "
+ "iViewMode integer, "
+ "fCustomZoomAmount float, "
+ "fPixelRatio float, "
+ "iAudioStream integer, "
+ "iSubtitleStream integer,"
+ "fSubtitleDelay float, "
+ "bSubtitles bool, "
+ "fBrightness float, "
+ "fContrast float, "
+ "fGamma float,"
+ "fVolumeAmplification float, "
+ "fAudioDelay float, "
+ "bOutputToAllSpeakers bool, "
+ "bCrop bool, "
+ "iCropLeft integer, "
+ "iCropRight integer, "
+ "iCropTop integer, "
+ "iCropBottom integer, "
+ "fSharpness float, "
+ "fNoiseReduction float, "
+ "fCustomVerticalShift float, "
+ "bCustomNonLinStretch bool, "
+ "bPostProcess bool, "
+ "iScalingMethod integer, "
+ "iDeinterlaceMode integer "
+ ")"
+ );
+
+ // disable all PVR add-on when started the first time
+ ADDON::VECADDONS addons;
+ if (!CAddonMgr::Get().GetAddons(ADDON_PVRDLL, addons, true))
+ CLog::Log(LOGERROR, "PVR - %s - failed to get add-ons from the add-on manager", __FUNCTION__);
+ else
+ {
+ for (IVECADDONS it = addons.begin(); it != addons.end(); it++)
+ CAddonMgr::Get().DisableAddon(it->get()->ID());
+ }
}
void CPVRDatabase::CreateAnalytics()
void CVideoDatabase::CreateTables()
{
- CLog::Log(LOGINFO, "create bookmark table");
- m_pDS->exec("CREATE TABLE bookmark ( idBookmark integer primary key, idFile integer, timeInSeconds double, totalTimeInSeconds double, thumbNailImage text, player text, playerState text, type integer)\n");
+ CLog::Log(LOGINFO, "create bookmark table");
+ m_pDS->exec("CREATE TABLE bookmark ( idBookmark integer primary key, idFile integer, timeInSeconds double, totalTimeInSeconds double, thumbNailImage text, player text, playerState text, type integer)\n");
- CLog::Log(LOGINFO, "create settings table");
- m_pDS->exec("CREATE TABLE settings ( idFile integer, Deinterlace bool,"
- "ViewMode integer,ZoomAmount float, PixelRatio float, VerticalShift float, AudioStream integer, SubtitleStream integer,"
- "SubtitleDelay float, SubtitlesOn bool, Brightness float, Contrast float, Gamma float,"
- "VolumeAmplification float, AudioDelay float, OutputToAllSpeakers bool, ResumeTime integer, Crop bool, CropLeft integer,"
- "CropRight integer, CropTop integer, CropBottom integer, Sharpness float, NoiseReduction float, NonLinStretch bool, PostProcess bool,"
- "ScalingMethod integer, DeinterlaceMode integer, StereoMode integer, StereoInvert bool)\n");
+ CLog::Log(LOGINFO, "create settings table");
+ m_pDS->exec("CREATE TABLE settings ( idFile integer, Deinterlace bool,"
+ "ViewMode integer,ZoomAmount float, PixelRatio float, VerticalShift float, AudioStream integer, SubtitleStream integer,"
+ "SubtitleDelay float, SubtitlesOn bool, Brightness float, Contrast float, Gamma float,"
+ "VolumeAmplification float, AudioDelay float, OutputToAllSpeakers bool, ResumeTime integer, Crop bool, CropLeft integer,"
+ "CropRight integer, CropTop integer, CropBottom integer, Sharpness float, NoiseReduction float, NonLinStretch bool, PostProcess bool,"
+ "ScalingMethod integer, DeinterlaceMode integer, StereoMode integer, StereoInvert bool)\n");
- CLog::Log(LOGINFO, "create stacktimes table");
- m_pDS->exec("CREATE TABLE stacktimes (idFile integer, times text)\n");
+ CLog::Log(LOGINFO, "create stacktimes table");
+ m_pDS->exec("CREATE TABLE stacktimes (idFile integer, times text)\n");
- CLog::Log(LOGINFO, "create genre table");
- m_pDS->exec("CREATE TABLE genre ( idGenre integer primary key, strGenre text)\n");
+ CLog::Log(LOGINFO, "create genre table");
+ m_pDS->exec("CREATE TABLE genre ( idGenre integer primary key, strGenre text)\n");
- CLog::Log(LOGINFO, "create genrelinkmovie table");
- m_pDS->exec("CREATE TABLE genrelinkmovie ( idGenre integer, idMovie integer)\n");
+ CLog::Log(LOGINFO, "create genrelinkmovie table");
+ m_pDS->exec("CREATE TABLE genrelinkmovie ( idGenre integer, idMovie integer)\n");
- CLog::Log(LOGINFO, "create country table");
- m_pDS->exec("CREATE TABLE country ( idCountry integer primary key, strCountry text)\n");
+ CLog::Log(LOGINFO, "create country table");
+ m_pDS->exec("CREATE TABLE country ( idCountry integer primary key, strCountry text)\n");
- CLog::Log(LOGINFO, "create countrylinkmovie table");
- m_pDS->exec("CREATE TABLE countrylinkmovie ( idCountry integer, idMovie integer)\n");
+ CLog::Log(LOGINFO, "create countrylinkmovie table");
+ m_pDS->exec("CREATE TABLE countrylinkmovie ( idCountry integer, idMovie integer)\n");
- CLog::Log(LOGINFO, "create movie table");
- CStdString columns = "CREATE TABLE movie ( idMovie integer primary key, idFile integer";
+ CLog::Log(LOGINFO, "create movie table");
+ CStdString columns = "CREATE TABLE movie ( idMovie integer primary key, idFile integer";
- for (int i = 0; i < VIDEODB_MAX_COLUMNS; i++)
- columns += StringUtils::Format(",c%02d text", i);
+ for (int i = 0; i < VIDEODB_MAX_COLUMNS; i++)
+ columns += StringUtils::Format(",c%02d text", i);
- columns += ", idSet integer)";
- m_pDS->exec(columns.c_str());
+ columns += ", idSet integer)";
+ m_pDS->exec(columns.c_str());
- CLog::Log(LOGINFO, "create actorlinkmovie table");
- m_pDS->exec("CREATE TABLE actorlinkmovie ( idActor integer, idMovie integer, strRole text, iOrder integer)\n");
+ CLog::Log(LOGINFO, "create actorlinkmovie table");
+ m_pDS->exec("CREATE TABLE actorlinkmovie ( idActor integer, idMovie integer, strRole text, iOrder integer)\n");
- CLog::Log(LOGINFO, "create directorlinkmovie table");
- m_pDS->exec("CREATE TABLE directorlinkmovie ( idDirector integer, idMovie integer)\n");
+ CLog::Log(LOGINFO, "create directorlinkmovie table");
+ m_pDS->exec("CREATE TABLE directorlinkmovie ( idDirector integer, idMovie integer)\n");
- CLog::Log(LOGINFO, "create writerlinkmovie table");
- m_pDS->exec("CREATE TABLE writerlinkmovie ( idWriter integer, idMovie integer)\n");
+ CLog::Log(LOGINFO, "create writerlinkmovie table");
+ m_pDS->exec("CREATE TABLE writerlinkmovie ( idWriter integer, idMovie integer)\n");
- CLog::Log(LOGINFO, "create actors table");
- m_pDS->exec("CREATE TABLE actors ( idActor integer primary key, strActor text, strThumb text )\n");
+ CLog::Log(LOGINFO, "create actors table");
+ m_pDS->exec("CREATE TABLE actors ( idActor integer primary key, strActor text, strThumb text )\n");
- CLog::Log(LOGINFO, "create path table");
- m_pDS->exec("CREATE TABLE path ( idPath integer primary key, strPath text, strContent text, strScraper text, strHash text, scanRecursive integer, useFolderNames bool, strSettings text, noUpdate bool, exclude bool, dateAdded text)");
+ CLog::Log(LOGINFO, "create path table");
+ m_pDS->exec("CREATE TABLE path ( idPath integer primary key, strPath text, strContent text, strScraper text, strHash text, scanRecursive integer, useFolderNames bool, strSettings text, noUpdate bool, exclude bool, dateAdded text)");
- CLog::Log(LOGINFO, "create files table");
- m_pDS->exec("CREATE TABLE files ( idFile integer primary key, idPath integer, strFilename text, playCount integer, lastPlayed text, dateAdded text)");
+ CLog::Log(LOGINFO, "create files table");
+ m_pDS->exec("CREATE TABLE files ( idFile integer primary key, idPath integer, strFilename text, playCount integer, lastPlayed text, dateAdded text)");
- CLog::Log(LOGINFO, "create tvshow table");
- columns = "CREATE TABLE tvshow ( idShow integer primary key";
+ CLog::Log(LOGINFO, "create tvshow table");
+ columns = "CREATE TABLE tvshow ( idShow integer primary key";
- for (int i = 0; i < VIDEODB_MAX_COLUMNS; i++)
- columns += StringUtils::Format(",c%02d text", i);;
+ for (int i = 0; i < VIDEODB_MAX_COLUMNS; i++)
+ columns += StringUtils::Format(",c%02d text", i);;
- columns += ")";
- m_pDS->exec(columns.c_str());
+ columns += ")";
+ m_pDS->exec(columns.c_str());
- CLog::Log(LOGINFO, "create directorlinktvshow table");
- m_pDS->exec("CREATE TABLE directorlinktvshow ( idDirector integer, idShow integer)\n");
+ CLog::Log(LOGINFO, "create directorlinktvshow table");
+ m_pDS->exec("CREATE TABLE directorlinktvshow ( idDirector integer, idShow integer)\n");
- CLog::Log(LOGINFO, "create actorlinktvshow table");
- m_pDS->exec("CREATE TABLE actorlinktvshow ( idActor integer, idShow integer, strRole text, iOrder integer)\n");
+ CLog::Log(LOGINFO, "create actorlinktvshow table");
+ m_pDS->exec("CREATE TABLE actorlinktvshow ( idActor integer, idShow integer, strRole text, iOrder integer)\n");
- CLog::Log(LOGINFO, "create studiolinktvshow table");
- m_pDS->exec("CREATE TABLE studiolinktvshow ( idStudio integer, idShow integer)\n");
+ CLog::Log(LOGINFO, "create studiolinktvshow table");
+ m_pDS->exec("CREATE TABLE studiolinktvshow ( idStudio integer, idShow integer)\n");
- CLog::Log(LOGINFO, "create episode table");
- columns = "CREATE TABLE episode ( idEpisode integer primary key, idFile integer";
- for (int i = 0; i < VIDEODB_MAX_COLUMNS; i++)
- {
- CStdString column;
- if ( i == VIDEODB_ID_EPISODE_SEASON || i == VIDEODB_ID_EPISODE_EPISODE || i == VIDEODB_ID_EPISODE_BOOKMARK)
- column = StringUtils::Format(",c%02d varchar(24)", i);
- else
- column = StringUtils::Format(",c%02d text", i);
+ CLog::Log(LOGINFO, "create episode table");
+ columns = "CREATE TABLE episode ( idEpisode integer primary key, idFile integer";
+ for (int i = 0; i < VIDEODB_MAX_COLUMNS; i++)
+ {
+ CStdString column;
+ if ( i == VIDEODB_ID_EPISODE_SEASON || i == VIDEODB_ID_EPISODE_EPISODE || i == VIDEODB_ID_EPISODE_BOOKMARK)
+ column = StringUtils::Format(",c%02d varchar(24)", i);
+ else
+ column = StringUtils::Format(",c%02d text", i);
- columns += column;
- }
- columns += ", idShow integer)";
- m_pDS->exec(columns.c_str());
+ columns += column;
+ }
+ columns += ", idShow integer)";
+ m_pDS->exec(columns.c_str());
- CLog::Log(LOGINFO, "create tvshowlinkpath table");
- m_pDS->exec("CREATE TABLE tvshowlinkpath (idShow integer, idPath integer)\n");
+ CLog::Log(LOGINFO, "create tvshowlinkpath table");
+ m_pDS->exec("CREATE TABLE tvshowlinkpath (idShow integer, idPath integer)\n");
- CLog::Log(LOGINFO, "create actorlinkepisode table");
- m_pDS->exec("CREATE TABLE actorlinkepisode ( idActor integer, idEpisode integer, strRole text, iOrder integer)\n");
+ CLog::Log(LOGINFO, "create actorlinkepisode table");
+ m_pDS->exec("CREATE TABLE actorlinkepisode ( idActor integer, idEpisode integer, strRole text, iOrder integer)\n");
- CLog::Log(LOGINFO, "create directorlinkepisode table");
- m_pDS->exec("CREATE TABLE directorlinkepisode ( idDirector integer, idEpisode integer)\n");
+ CLog::Log(LOGINFO, "create directorlinkepisode table");
+ m_pDS->exec("CREATE TABLE directorlinkepisode ( idDirector integer, idEpisode integer)\n");
- CLog::Log(LOGINFO, "create writerlinkepisode table");
- m_pDS->exec("CREATE TABLE writerlinkepisode ( idWriter integer, idEpisode integer)\n");
+ CLog::Log(LOGINFO, "create writerlinkepisode table");
+ m_pDS->exec("CREATE TABLE writerlinkepisode ( idWriter integer, idEpisode integer)\n");
- CLog::Log(LOGINFO, "create genrelinktvshow table");
- m_pDS->exec("CREATE TABLE genrelinktvshow ( idGenre integer, idShow integer)\n");
+ CLog::Log(LOGINFO, "create genrelinktvshow table");
+ m_pDS->exec("CREATE TABLE genrelinktvshow ( idGenre integer, idShow integer)\n");
- CLog::Log(LOGINFO, "create movielinktvshow table");
- m_pDS->exec("CREATE TABLE movielinktvshow ( idMovie integer, IdShow integer)\n");
+ CLog::Log(LOGINFO, "create movielinktvshow table");
+ m_pDS->exec("CREATE TABLE movielinktvshow ( idMovie integer, IdShow integer)\n");
- CLog::Log(LOGINFO, "create studio table");
- m_pDS->exec("CREATE TABLE studio ( idStudio integer primary key, strStudio text)\n");
+ CLog::Log(LOGINFO, "create studio table");
+ m_pDS->exec("CREATE TABLE studio ( idStudio integer primary key, strStudio text)\n");
- CLog::Log(LOGINFO, "create studiolinkmovie table");
- m_pDS->exec("CREATE TABLE studiolinkmovie ( idStudio integer, idMovie integer)\n");
+ CLog::Log(LOGINFO, "create studiolinkmovie table");
+ m_pDS->exec("CREATE TABLE studiolinkmovie ( idStudio integer, idMovie integer)\n");
- CLog::Log(LOGINFO, "create musicvideo table");
- columns = "CREATE TABLE musicvideo ( idMVideo integer primary key, idFile integer";
- for (int i = 0; i < VIDEODB_MAX_COLUMNS; i++)
- columns += StringUtils::Format(",c%02d text", i);;
+ CLog::Log(LOGINFO, "create musicvideo table");
+ columns = "CREATE TABLE musicvideo ( idMVideo integer primary key, idFile integer";
+ for (int i = 0; i < VIDEODB_MAX_COLUMNS; i++)
+ columns += StringUtils::Format(",c%02d text", i);;
- columns += ")";
- m_pDS->exec(columns.c_str());
+ columns += ")";
+ m_pDS->exec(columns.c_str());
- CLog::Log(LOGINFO, "create artistlinkmusicvideo table");
- m_pDS->exec("CREATE TABLE artistlinkmusicvideo ( idArtist integer, idMVideo integer)\n");
+ CLog::Log(LOGINFO, "create artistlinkmusicvideo table");
+ m_pDS->exec("CREATE TABLE artistlinkmusicvideo ( idArtist integer, idMVideo integer)\n");
- CLog::Log(LOGINFO, "create genrelinkmusicvideo table");
- m_pDS->exec("CREATE TABLE genrelinkmusicvideo ( idGenre integer, idMVideo integer)\n");
+ CLog::Log(LOGINFO, "create genrelinkmusicvideo table");
+ m_pDS->exec("CREATE TABLE genrelinkmusicvideo ( idGenre integer, idMVideo integer)\n");
- CLog::Log(LOGINFO, "create studiolinkmusicvideo table");
- m_pDS->exec("CREATE TABLE studiolinkmusicvideo ( idStudio integer, idMVideo integer)\n");
+ CLog::Log(LOGINFO, "create studiolinkmusicvideo table");
+ m_pDS->exec("CREATE TABLE studiolinkmusicvideo ( idStudio integer, idMVideo integer)\n");
- CLog::Log(LOGINFO, "create directorlinkmusicvideo table");
- m_pDS->exec("CREATE TABLE directorlinkmusicvideo ( idDirector integer, idMVideo integer)\n");
+ CLog::Log(LOGINFO, "create directorlinkmusicvideo table");
+ m_pDS->exec("CREATE TABLE directorlinkmusicvideo ( idDirector integer, idMVideo integer)\n");
- CLog::Log(LOGINFO, "create streaminfo table");
- m_pDS->exec("CREATE TABLE streamdetails (idFile integer, iStreamType integer, "
- "strVideoCodec text, fVideoAspect float, iVideoWidth integer, iVideoHeight integer, "
- "strAudioCodec text, iAudioChannels integer, strAudioLanguage text, strSubtitleLanguage text, iVideoDuration integer, strStereoMode text)");
+ CLog::Log(LOGINFO, "create streaminfo table");
+ m_pDS->exec("CREATE TABLE streamdetails (idFile integer, iStreamType integer, "
+ "strVideoCodec text, fVideoAspect float, iVideoWidth integer, iVideoHeight integer, "
+ "strAudioCodec text, iAudioChannels integer, strAudioLanguage text, strSubtitleLanguage text, iVideoDuration integer, strStereoMode text)");
- CLog::Log(LOGINFO, "create sets table");
- m_pDS->exec("CREATE TABLE sets ( idSet integer primary key, strSet text)\n");
+ CLog::Log(LOGINFO, "create sets table");
+ m_pDS->exec("CREATE TABLE sets ( idSet integer primary key, strSet text)\n");
- CLog::Log(LOGINFO, "create seasons table");
- m_pDS->exec("CREATE TABLE seasons ( idSeason integer primary key, idShow integer, season integer)");
+ CLog::Log(LOGINFO, "create seasons table");
+ m_pDS->exec("CREATE TABLE seasons ( idSeason integer primary key, idShow integer, season integer)");
- CLog::Log(LOGINFO, "create art table");
- m_pDS->exec("CREATE TABLE art(art_id INTEGER PRIMARY KEY, media_id INTEGER, media_type TEXT, type TEXT, url TEXT)");
+ CLog::Log(LOGINFO, "create art table");
+ m_pDS->exec("CREATE TABLE art(art_id INTEGER PRIMARY KEY, media_id INTEGER, media_type TEXT, type TEXT, url TEXT)");
- CLog::Log(LOGINFO, "create tag table");
- m_pDS->exec("CREATE TABLE tag (idTag integer primary key, strTag text)");
+ CLog::Log(LOGINFO, "create tag table");
+ m_pDS->exec("CREATE TABLE tag (idTag integer primary key, strTag text)");
- CLog::Log(LOGINFO, "create taglinks table");
- m_pDS->exec("CREATE TABLE taglinks (idTag integer, idMedia integer, media_type TEXT)");
+ CLog::Log(LOGINFO, "create taglinks table");
+ m_pDS->exec("CREATE TABLE taglinks (idTag integer, idMedia integer, media_type TEXT)");
}
void CVideoDatabase::CreateAnalytics()
void CViewDatabase::CreateTables()
{
- CLog::Log(LOGINFO, "create view table");
- m_pDS->exec("CREATE TABLE view ("
- "idView integer primary key,"
- "window integer,"
- "path text,"
- "viewMode integer,"
- "sortMethod integer,"
- "sortOrder integer,"
- "sortAttributes integer,"
- "skin text)\n");
+ CLog::Log(LOGINFO, "create view table");
+ m_pDS->exec("CREATE TABLE view ("
+ "idView integer primary key,"
+ "window integer,"
+ "path text,"
+ "viewMode integer,"
+ "sortMethod integer,"
+ "sortOrder integer,"
+ "sortAttributes integer,"
+ "skin text)\n");
}
void CViewDatabase::CreateAnalytics()