7CCF7F1E1069F3AE00992676 /* Builtins.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CCF7F1B1069F3AE00992676 /* Builtins.cpp */; };
7CCF7FC9106A0DF500992676 /* TimeUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CCF7FC7106A0DF500992676 /* TimeUtils.cpp */; };
7CCF7FCA106A0DF500992676 /* TimeUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CCF7FC7106A0DF500992676 /* TimeUtils.cpp */; };
+ 7CD2C3AA11940B270009EFC1 /* DirectoryNodeCountry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CD2C3A811940B270009EFC1 /* DirectoryNodeCountry.cpp */; };
+ 7CD2C3AB11940B270009EFC1 /* DirectoryNodeCountry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CD2C3A811940B270009EFC1 /* DirectoryNodeCountry.cpp */; };
7CDAE9050FFCA3520040B25F /* DVDTSCorrection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CDAE9030FFCA3520040B25F /* DVDTSCorrection.cpp */; };
7CDAE9060FFCA3520040B25F /* DVDTSCorrection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CDAE9030FFCA3520040B25F /* DVDTSCorrection.cpp */; };
7CDAEA7D1001CD6E0040B25F /* karaokelyricstextustar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CDAEA7B1001CD6E0040B25F /* karaokelyricstextustar.cpp */; };
7CCF7F1C1069F3AE00992676 /* Builtins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Builtins.h; sourceTree = "<group>"; };
7CCF7FC7106A0DF500992676 /* TimeUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimeUtils.cpp; sourceTree = "<group>"; };
7CCF7FC8106A0DF500992676 /* TimeUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimeUtils.h; sourceTree = "<group>"; };
+ 7CD2C3A811940B270009EFC1 /* DirectoryNodeCountry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectoryNodeCountry.cpp; sourceTree = "<group>"; };
+ 7CD2C3A911940B270009EFC1 /* DirectoryNodeCountry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryNodeCountry.h; sourceTree = "<group>"; };
7CDAE9030FFCA3520040B25F /* DVDTSCorrection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DVDTSCorrection.cpp; sourceTree = "<group>"; };
7CDAE9040FFCA3520040B25F /* DVDTSCorrection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVDTSCorrection.h; sourceTree = "<group>"; };
7CDAEA7B1001CD6E0040B25F /* karaokelyricstextustar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = karaokelyricstextustar.cpp; path = karaoke/karaokelyricstextustar.cpp; sourceTree = "<group>"; };
E38E175F0D25F9FA00618676 /* VideoDatabaseDirectory */ = {
isa = PBXGroup;
children = (
+ 7CD2C3A811940B270009EFC1 /* DirectoryNodeCountry.cpp */,
+ 7CD2C3A911940B270009EFC1 /* DirectoryNodeCountry.h */,
E38E17600D25F9FA00618676 /* DirectoryNode.cpp */,
E38E17610D25F9FA00618676 /* DirectoryNode.h */,
E38E17620D25F9FA00618676 /* DirectoryNodeActor.cpp */,
18E9C8EE11834DF600DF8B9F /* GUIDialogAddonInfo.cpp in Sources */,
F52B063B11869862004B1D66 /* Skin.cpp in Sources */,
F52B06BA1187CE18004B1D66 /* DVDVideoCodecVDA.cpp in Sources */,
+ 7CD2C3AB11940B270009EFC1 /* DirectoryNodeCountry.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
18E9C8EF11834DF600DF8B9F /* GUIDialogAddonInfo.cpp in Sources */,
F52B063C11869862004B1D66 /* Skin.cpp in Sources */,
F52B06BB1187CE18004B1D66 /* DVDVideoCodecVDA.cpp in Sources */,
+ 7CD2C3AA11940B270009EFC1 /* DirectoryNodeCountry.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
<RegExp input="$$1" output="<genre>\1</genre>" dest="5+">
<expression repeat="yes">"/Sections/Genres/[^/]*/">([^<]*)</a></expression>
</RegExp>
+ <RegExp input="$$1" output="<country>\1</country>" dest="5+">
+ <expression repeat="yes">"/Sections/Countries/[^/]*/">([^<]*)</a></expression>
+ </RegExp>
<RegExp input="$$1" output="<studio>\1</studio>" dest="5+">
<expression repeat="yes">"/company/[^/]*/">([^<]*)</a></expression>
</RegExp>
<RegExp input="$$1" output="<studio>\1</studio>" dest="5+">
<expression repeat="yes"><studio.*?name="([^"]*)"</expression>
</RegExp>
+ <RegExp input="$$1" output="<country>\1</country>" dest="5+">
+ <expression repeat="yes"><country.*?name="([^"]*)"</expression>
+ </RegExp>
<RegExp input="$$1" output="<plot>\1</plot>" dest="5+">
<expression><overview>([^<]*)</overview></expression>
</RegExp>
<string id="571">Default</string>
<string id="572">Studio</string>
<string id="573">Path</string>
+ <string id="574">Country</string>
<string id="580">Sort direction</string>
<string id="581">Sort method</string>
<string id="20448">Could not download information</string>
<string id="20449">Server is most likely unavailable.</string>
<string id="20450">Would you like to continue scanning?</string>
+ <string id="20451">Countries</string>
<!-- up to 21329 is reserved for the video db !! !-->
<string id="21330">Show hidden files and directories</string>
<string id="571">Standard</string>
<string id="572">Studio</string>
<string id="573">Sti</string>
+ <string id="574">Land</string>
<string id="580">Sorteringsretning</string>
<string id="581">Sorteringsmetode</string>
<string id="582">Visningsmodus</string>
case SORT_METHOD_GENRE:
FillSortFields(SSortFileItem::ByGenre);
break;
+ case SORT_METHOD_COUNTRY:
+ FillSortFields(SSortFileItem::ByCountry);
+ break;
case SORT_METHOD_FILE:
FillSortFields(SSortFileItem::ByFile);
break;
dir->m_listItems->AddSortMethod(SORT_METHOD_GENRE, 515, LABEL_MASKS("%T", "%G"));
break;
}
+ case SORT_METHOD_COUNTRY:
+ {
+ dir->m_listItems->AddSortMethod(SORT_METHOD_COUNTRY, 574, LABEL_MASKS("%T", "%G"));
+ break;
+ }
case SORT_METHOD_VIDEO_TITLE:
{
dir->m_listItems->AddSortMethod(SORT_METHOD_VIDEO_TITLE, 369, LABEL_MASKS("%T", "%D"));
strLabel += strTemp;
}
+ // get country
+ if (params.GetCountryId() != -1)
+ {
+ videodatabase.GetCountryById(params.GetCountryId(), strTemp);
+ strLabel += strTemp;
+ }
+
// get set
if (params.GetSetId() != -1)
{
strLabel = g_localizeStrings.Get(344); break;
case NODE_TYPE_GENRE: // Genres
strLabel = g_localizeStrings.Get(135); break;
+ case NODE_TYPE_COUNTRY: // Countries
+ strLabel = g_localizeStrings.Get(20451); break;
case NODE_TYPE_YEAR: // Year
strLabel = g_localizeStrings.Get(562); break;
case NODE_TYPE_DIRECTOR: // Director
return "DefaultActor.png";
case NODE_TYPE_GENRE: // Genres
return "DefaultGenre.png";
+ case NODE_TYPE_COUNTRY: // Countries
+ return "DefaultCountry.png";
case NODE_TYPE_SETS: // Sets
return "DefaultSets.png";
case NODE_TYPE_YEAR: // Year
#include "DirectoryNodeRoot.h"
#include "DirectoryNodeOverview.h"
#include "DirectoryNodeGenre.h"
+#include "DirectoryNodeCountry.h"
#include "DirectoryNodeSets.h"
#include "DirectoryNodeTitleMovies.h"
#include "DirectoryNodeTitleTvShows.h"
return new CDirectoryNodeOverview(strName, pParent);
case NODE_TYPE_GENRE:
return new CDirectoryNodeGenre(strName, pParent);
+ case NODE_TYPE_COUNTRY:
+ return new CDirectoryNodeCountry(strName, pParent);
case NODE_TYPE_SETS:
return new CDirectoryNodeSets(strName, pParent);
case NODE_TYPE_YEAR:
NODE_TYPE_RECENTLY_ADDED_MUSICVIDEOS,
NODE_TYPE_TITLE_MUSICVIDEOS,
NODE_TYPE_MUSICVIDEOS_ALBUM,
- NODE_TYPE_SETS
+ NODE_TYPE_SETS,
+ NODE_TYPE_COUNTRY
} NODE_TYPE;
class CDirectoryNode
--- /dev/null
+/*
+ * Copyright (C) 2005-2008 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "DirectoryNodeCountry.h"
+#include "QueryParams.h"
+#include "VideoDatabase.h"
+
+using namespace XFILE::VIDEODATABASEDIRECTORY;
+
+CDirectoryNodeCountry::CDirectoryNodeCountry(const CStdString& strName, CDirectoryNode* pParent)
+ : CDirectoryNode(NODE_TYPE_COUNTRY, strName, pParent)
+{
+
+}
+
+NODE_TYPE CDirectoryNodeCountry::GetChildType()
+{
+ CQueryParams params;
+ CollectQueryParams(params);
+ return NODE_TYPE_TITLE_MOVIES;
+}
+
+bool CDirectoryNodeCountry::GetContent(CFileItemList& items)
+{
+ CVideoDatabase videodatabase;
+ if (!videodatabase.Open())
+ return false;
+
+ CQueryParams params;
+ CollectQueryParams(params);
+
+ bool bSuccess=videodatabase.GetCountriesNav(BuildPath(), items, params.GetContentType());
+
+ videodatabase.Close();
+
+ return bSuccess;
+}
--- /dev/null
+#pragma once
+/*
+ * Copyright (C) 2005-2008 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "DirectoryNode.h"
+
+namespace XFILE
+{
+ namespace VIDEODATABASEDIRECTORY
+ {
+ class CDirectoryNodeCountry : public CDirectoryNode
+ {
+ public:
+ CDirectoryNodeCountry(const CStdString& strName, CDirectoryNode* pParent);
+ protected:
+ virtual NODE_TYPE GetChildType();
+ virtual bool GetContent(CFileItemList& items);
+ };
+ }
+}
+
+
else if (GetName()=="6")
return NODE_TYPE_STUDIO;
else if (GetName()=="7")
+ return NODE_TYPE_COUNTRY;
+ else if (GetName()=="8")
return NODE_TYPE_SETS;
return NODE_TYPE_NONE;
vecRoot.push_back(g_localizeStrings.Get(344)); // Actors
vecRoot.push_back(g_localizeStrings.Get(20348)); // Directors
vecRoot.push_back(g_localizeStrings.Get(20388)); // Studios
+ vecRoot.push_back(g_localizeStrings.Get(20451)); // Countries
CVideoDatabase db;
if (db.Open())
{
CollectQueryParams(params);
CStdString strBaseDir=BuildPath();
- bool bSuccess=videodatabase.GetMoviesNav(strBaseDir, items, params.GetGenreId(), params.GetYear(), params.GetActorId(), params.GetDirectorId(),params.GetStudioId(),params.GetSetId());
+ bool bSuccess=videodatabase.GetMoviesNav(strBaseDir, items, params.GetGenreId(), params.GetYear(), params.GetActorId(), params.GetDirectorId(), params.GetStudioId(), params.GetCountryId(), params.GetSetId());
videodatabase.Close();
DirectoryNodeDirector.cpp \
DirectoryNodeEpisodes.cpp \
DirectoryNodeGenre.cpp \
+ DirectoryNodeCountry.cpp \
DirectoryNodeSets.cpp \
DirectoryNodeMoviesOverview.cpp \
DirectoryNodeOverview.cpp \
{
m_idMovie = -1;
m_idGenre = -1;
+ m_idCountry = -1;
m_idYear = -1;
m_idActor = -1;
m_idDirector = -1;
case NODE_TYPE_GENRE:
m_idGenre = idDb;
break;
+ case NODE_TYPE_COUNTRY:
+ m_idCountry = idDb;
+ break;
case NODE_TYPE_YEAR:
m_idYear = idDb;
break;
long GetMovieId() const { return m_idMovie; }
long GetYear() const { return m_idYear; }
long GetGenreId() const { return m_idGenre; }
+ long GetCountryId() const { return m_idCountry; }
long GetActorId() const { return m_idActor; }
long GetAlbumId() const { return m_idAlbum; }
long GetDirectorId() const { return m_idDirector; }
long m_idContent;
long m_idMovie;
long m_idGenre;
+ long m_idCountry;
long m_idYear;
long m_idActor;
long m_idDirector;
}
iLabel = 515;
}
+ else if (m_rule.m_field == CSmartPlaylistRule::FIELD_COUNTRY)
+ {
+ videodatabase.GetCountriesNav("videodb://2/1/",items,type);
+ iLabel = 574;
+ }
else if (m_rule.m_field == CSmartPlaylistRule::FIELD_ARTIST || m_rule.m_field == CSmartPlaylistRule::FIELD_ALBUMARTIST)
{
if (m_type.Equals("songs") || m_type.Equals("mixed") || m_type.Equals("albums"))
break;
case NODE_TYPE_MUSICVIDEOS_ALBUM:
case NODE_TYPE_GENRE:
+ case NODE_TYPE_COUNTRY:
case NODE_TYPE_STUDIO:
{
AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%T", "%R", "%L", "")); // Filename, Duration | Foldername, empty
destPath = "videodb://1/5/";
else if (strDestination.Equals("MovieStudios"))
destPath = "videodb://1/6/";
+ else if (strDestination.Equals("MovieCountries"))
+ destPath = "videodb://1/7/";
else if (strDestination.Equals("Movies"))
destPath = "videodb://1/";
else if (strDestination.Equals("MovieSets"))
items.SetContent("musicvideos");
else if (node == NODE_TYPE_GENRE)
items.SetContent("genres");
- else if (node == NODE_TYPE_ACTOR)
- {
- if (params.GetContentType() == VIDEODB_CONTENT_MUSICVIDEOS)
- items.SetContent("artists");
- else
- items.SetContent("actors");
- }
- else if (node == NODE_TYPE_DIRECTOR)
- items.SetContent("directors");
- else if (node == NODE_TYPE_STUDIO)
- items.SetContent("studios");
- else if (node == NODE_TYPE_YEAR)
- items.SetContent("years");
- else if (node == NODE_TYPE_MUSICVIDEOS_ALBUM)
- items.SetContent("albums");
- else
+ else if (node == NODE_TYPE_COUNTRY)
+ items.SetContent("countries");
+ else if (node == NODE_TYPE_ACTOR)
+ {
+ if (params.GetContentType() == VIDEODB_CONTENT_MUSICVIDEOS)
+ items.SetContent("artists");
+ else
+ items.SetContent("actors");
+ }
+ else if (node == NODE_TYPE_DIRECTOR)
+ items.SetContent("directors");
+ else if (node == NODE_TYPE_STUDIO)
+ items.SetContent("studios");
+ else if (node == NODE_TYPE_YEAR)
+ items.SetContent("years");
+ else if (node == NODE_TYPE_MUSICVIDEOS_ALBUM)
+ items.SetContent("albums");
+ else
items.SetContent("");
}
}
{ "director", CSmartPlaylistRule::FIELD_DIRECTOR, CSmartPlaylistRule::BROWSEABLE_FIELD, 20339 },
{ "actor", CSmartPlaylistRule::FIELD_ACTOR, CSmartPlaylistRule::BROWSEABLE_FIELD, 20337 },
{ "studio", CSmartPlaylistRule::FIELD_STUDIO, CSmartPlaylistRule::BROWSEABLE_FIELD, 572 },
+ { "country", CSmartPlaylistRule::FIELD_COUNTRY, CSmartPlaylistRule::BROWSEABLE_FIELD, 574 },
{ "numepisodes", CSmartPlaylistRule::FIELD_NUMEPISODES, CSmartPlaylistRule::NUMERIC_FIELD, 20360 },
{ "numwatched", CSmartPlaylistRule::FIELD_NUMWATCHED, CSmartPlaylistRule::NUMERIC_FIELD, 21441 },
{ "writers", CSmartPlaylistRule::FIELD_WRITER, CSmartPlaylistRule::BROWSEABLE_FIELD, 20417 },
fields.push_back(FIELD_PLAYCOUNT);
fields.push_back(FIELD_LASTPLAYED);
fields.push_back(FIELD_GENRE);
+ fields.push_back(FIELD_COUNTRY);
fields.push_back(FIELD_YEAR); // premiered
fields.push_back(FIELD_DIRECTOR);
if (!sortOrders)
query = "idmovie" + negate + " in (select idmovie from writerlinkmovie join actors on actors.idactor=writerlinkmovie.idwriter where actors.strActor" + parameter + ")";
else if (m_field == FIELD_STUDIO)
query = "idmovie" + negate + " in (select idmovie from studiolinkmovie join studio on studio.idstudio=studiolinkmovie.idstudio where studio.strStudio" + parameter + ")";
+ else if (m_field == FIELD_COUNTRY)
+ query = "idmovie" + negate + " in (select idmovie from countrylinkmovie join country on country.idcountry=countrylinkmovie.idcountry where country.strCountry" + parameter + ")";
else if (m_field == FIELD_HASTRAILER)
query = negate + GetDatabaseField(m_field, strType) + "!= ''";
else if (m_field == FIELD_LASTPLAYED && (m_operator == OPERATOR_LESS_THAN || m_operator == OPERATOR_BEFORE || m_operator == OPERATOR_NOT_IN_THE_LAST))
else if (field == FIELD_MPAA) result.Format("c%02d", VIDEODB_ID_MPAA);
else if (field == FIELD_TOP250) result.Format("c%02d", VIDEODB_ID_TOP250);
else if (field == FIELD_STUDIO) result.Format("c%02d", VIDEODB_ID_STUDIOS); // join required
+ else if (field == FIELD_COUNTRY) result.Format("c%02d", VIDEODB_ID_COUNTRY); // join required
else if (field == FIELD_HASTRAILER) result.Format("c%02d", VIDEODB_ID_TRAILER);
else if (field == FIELD_FILENAME) result = "strFilename";
else if (field == FIELD_PATH) result = "strPath";
FIELD_DIRECTOR,
FIELD_ACTOR,
FIELD_STUDIO,
+ FIELD_COUNTRY,
FIELD_MPAA,
FIELD_TOP250,
FIELD_NUMEPISODES,
item->SetSortLabel(item->GetVideoInfoTag()->m_strGenre);
}
+void SSortFileItem::ByCountry(CFileItemPtr &item)
+{
+ if (!item) return;
+ item->SetSortLabel(item->GetVideoInfoTag()->m_strCountry);
+}
+
+
void SSortFileItem::ByYear(CFileItemPtr &item)
{
if (!item) return;
static void ByProgramCount(CFileItemPtr &item);
static void ByGenre(CFileItemPtr &item);
+ static void ByCountry(CFileItemPtr &item);
static void ByYear(CFileItemPtr &item);
static void ByMovieTitle(CFileItemPtr &item);
SORT_METHOD_ALBUM,
SORT_METHOD_ALBUM_IGNORE_THE,
SORT_METHOD_GENRE,
+ SORT_METHOD_COUNTRY,
SORT_METHOD_YEAR,
SORT_METHOD_VIDEO_RATING,
SORT_METHOD_PROGRAM_COUNT,
m_pDS->exec("CREATE UNIQUE INDEX ix_genrelinkmovie_1 ON genrelinkmovie ( idGenre, idMovie)\n");
m_pDS->exec("CREATE UNIQUE INDEX ix_genrelinkmovie_2 ON genrelinkmovie ( idMovie, idGenre)\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");
+ m_pDS->exec("CREATE UNIQUE INDEX ix_countrylinkmovie_1 ON countrylinkmovie ( idCountry, idMovie)\n");
+ m_pDS->exec("CREATE UNIQUE INDEX ix_countrylinkmovie_2 ON countrylinkmovie ( idMovie, idCountry)\n");
+
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++)
}
//********************************************************************************************************************************
+int CVideoDatabase::AddCountry(const CStdString& strCountry)
+{
+ return AddToTable("country", "idCountry", "strCountry", strCountry);
+}
+
int CVideoDatabase::AddActor(const CStdString& strActor, const CStdString& strThumb)
{
try
AddToLinkTable("genrelinkmusicvideo", "idGenre", idGenre, "idMVideo", idMVideo);
}
+//****Country****
+void CVideoDatabase::AddCountryToMovie(int idMovie, int idCountry)
+{
+ AddToLinkTable("countrylinkmovie", "idCountry", idCountry, "idMovie", idMovie);
+}
+
//********************************************************************************************************************************
bool CVideoDatabase::HasMovieInfo(const CStdString& strFilenameAndPath)
{
}
}
+ // add countries...
+ if (!info.m_strCountry.IsEmpty())
+ {
+ CStdStringArray countries;
+ StringUtils::SplitString(info.m_strCountry, g_advancedSettings.m_videoItemSeparator, countries);
+ for (unsigned int i = 0; i < countries.size(); i++)
+ {
+ CStdString country(countries[i]);
+ country.Trim();
+ int idCountry = AddCountry(country);
+ AddCountryToMovie(idMovie, idCountry);
+ }
+ }
+
if (details.HasStreamDetails())
SetStreamDetailsForFileId(details.m_streamDetails, idFile);
strSQL=FormatSQL("delete from setlinkmovie where idMovie=%i", idMovie);
m_pDS->exec(strSQL.c_str());
+ strSQL=FormatSQL("delete from countrylinkmovie where idMovie=%i", idMovie);
+ m_pDS->exec(strSQL.c_str());
+
if (!bKeepThumb)
DeleteThumbForItem(strFilenameAndPath,false);
m_pDS->exec("CREATE UNIQUE INDEX ix_musicvideo_file_1 on musicvideo (idMVideo, idFile)");
m_pDS->exec("CREATE UNIQUE INDEX ix_musicvideo_file_2 on musicvideo (idFile, idMVideo)");
}
+ if (iVersion < 38)
+ {
+ m_pDS->exec("ALTER table movie add c21 text");
+ m_pDS->exec("ALTER table episode add c21 text");
+ m_pDS->exec("ALTER table musicvideo add c21 text");
+ m_pDS->exec("ALTER table tvshow add c21 text");
+
+ 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");
+ m_pDS->exec("CREATE UNIQUE INDEX ix_countrylinkmovie_1 ON countrylinkmovie ( idCountry, idMovie)\n");
+ m_pDS->exec("CREATE UNIQUE INDEX ix_countrylinkmovie_2 ON countrylinkmovie ( idMovie, idCountry)\n");
+ }
}
catch (...)
{
return GetNavCommon(strBaseDir, items, "genre", idContent);
}
+bool CVideoDatabase::GetCountriesNav(const CStdString& strBaseDir, CFileItemList& items, int idContent)
+{
+ return GetNavCommon(strBaseDir, items, "country", idContent);
+}
+
bool CVideoDatabase::GetStudiosNav(const CStdString& strBaseDir, CFileItemList& items, int idContent)
{
return GetNavCommon(strBaseDir, items, "studio", idContent);
return false;
}
-bool CVideoDatabase::GetMoviesNav(const CStdString& strBaseDir, CFileItemList& items, int idGenre, int idYear, int idActor, int idDirector, int idStudio, int idSet)
+bool CVideoDatabase::GetMoviesNav(const CStdString& strBaseDir, CFileItemList& items, int idGenre, int idYear, int idActor, int idDirector, int idStudio, int idCountry, int idSet)
{
CStdString where;
if (idGenre != -1)
where = FormatSQL("join genrelinkmovie on genrelinkmovie.idMovie=movieview.idMovie where genrelinkmovie.idGenre=%i", idGenre);
+ else if (idCountry != -1)
+ where = FormatSQL("join countrylinkmovie on countrylinkmovie.idMovie=movieview.idMovie where countrylinkmovie.idCountry=%i", idCountry);
else if (idStudio != -1)
where = FormatSQL("join studiolinkmovie on studiolinkmovie.idMovie=movieview.idMovie where studiolinkmovie.idStudio=%i", idStudio);
else if (idDirector != -1)
return false;
}
+bool CVideoDatabase::GetCountryById(int idCountry, CStdString& strCountry)
+{
+ try
+ {
+ if (NULL == m_pDB.get()) return false;
+ if (NULL == m_pDS.get()) return false;
+
+ CStdString strSQL=FormatSQL("select country.strCountry from country where country.idCountry=%i", idCountry);
+ m_pDS->query( strSQL.c_str() );
+
+ bool bResult = false;
+ if (!m_pDS->eof())
+ {
+ strCountry = m_pDS->fv("country.strCountry").get_asString();
+ bResult = true;
+ }
+ m_pDS->close();
+ return bResult;
+ }
+ catch (...)
+ {
+ CLog::Log(LOGERROR, "%s (%s) failed", __FUNCTION__, strCountry.c_str());
+ }
+ return false;
+}
+
bool CVideoDatabase::HasSets() const
{
try
}
}
+void CVideoDatabase::GetMovieCountriesByName(const CStdString& strSearch, CFileItemList& items)
+{
+ CStdString strSQL;
+
+ try
+ {
+ if (NULL == m_pDB.get()) return;
+ if (NULL == m_pDS.get()) return;
+
+ if (g_settings.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser)
+ strSQL=FormatSQL("select country.idCountry,country.strCountry,path.strPath from country,countrylinkmovie,movie,path,files where country.idCountry=countrylinkmovie.idCountry and countrylinkmovie.idMovie=movie.idMovie and files.idFile=movie.idFile and path.idPath=files.idPath and country.strCountry like '%%%s%%'",strSearch.c_str());
+ else
+ strSQL=FormatSQL("select distinct country.idCountry,country.strCountry from country,countrylinkmovie where countrylinkmovie.idCountry=country.idCountry and strCountry like '%%%s%%'", strSearch.c_str());
+ m_pDS->query( strSQL.c_str() );
+
+ while (!m_pDS->eof())
+ {
+ if (g_settings.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser)
+ if (!g_passwordManager.IsDatabasePathUnlocked(CStdString(m_pDS->fv("path.strPath").get_asString()),
+ g_settings.m_videoSources))
+ {
+ m_pDS->next();
+ continue;
+ }
+
+ CFileItemPtr pItem(new CFileItem(m_pDS->fv("country.strCountry").get_asString()));
+ CStdString strDir;
+ strDir.Format("%ld/", m_pDS->fv("country.idCountry").get_asInt());
+ pItem->m_strPath="videodb://1/1/"+ strDir;
+ pItem->m_bIsFolder=true;
+ items.Add(pItem);
+ m_pDS->next();
+ }
+ m_pDS->close();
+ }
+ catch (...)
+ {
+ CLog::Log(LOGERROR, "%s (%s) failed", __FUNCTION__, strSQL.c_str());
+ }
+}
+
void CVideoDatabase::GetTvShowGenresByName(const CStdString& strSearch, CFileItemList& items)
{
CStdString strSQL;
sql = "delete from genrelinkmovie where idMovie in " + moviesToDelete;
m_pDS->exec(sql.c_str());
+ CLog::Log(LOGDEBUG, "%s Cleaning countrylinkmovie table", __FUNCTION__);
+ sql = "delete from countrylinkmovie where idMovie in " + moviesToDelete;
+ m_pDS->exec(sql.c_str());
+
CLog::Log(LOGDEBUG, "%s Cleaning studiolinkmovie table", __FUNCTION__);
sql = "delete from studiolinkmovie where idMovie in " + moviesToDelete;
m_pDS->exec(sql.c_str());
sql = "delete from genre where idGenre not in (select distinct idGenre from genrelinkmovie) and idGenre not in (select distinct idGenre from genrelinktvshow) and idGenre not in (select distinct idGenre from genrelinkmusicvideo)";
m_pDS->exec(sql.c_str());
+ CLog::Log(LOGDEBUG, "%s Cleaning country table", __FUNCTION__);
+ sql = "delete from country where idCountry not in (select distinct idCountry from countrylinkmovie)";
+ m_pDS->exec(sql.c_str());
+
CLog::Log(LOGDEBUG, "%s Cleaning actor table of actors, directors and writers", __FUNCTION__);
sql = "delete from actors where idActor not in (select distinct idActor from actorlinkmovie) and idActor not in (select distinct idDirector from directorlinkmovie) and idActor not in (select distinct idWriter from writerlinkmovie) and idActor not in (select distinct idActor from actorlinktvshow) and idActor not in (select distinct idActor from actorlinkepisode) and idActor not in (select distinct idDirector from directorlinktvshow) and idActor not in (select distinct idDirector from directorlinkepisode) and idActor not in (select distinct idWriter from writerlinkepisode) and idActor not in (select distinct idArtist from artistlinkmusicvideo) and idActor not in (select distinct idDirector from directorlinkmusicvideo)";
m_pDS->exec(sql.c_str());
// these defines are based on how many columns we have and which column certain data is going to be in
// when we do GetDetailsForMovie()
-#define VIDEODB_MAX_COLUMNS 21
+#define VIDEODB_MAX_COLUMNS 22
#define VIDEODB_DETAILS_FILEID 1
#define VIDEODB_DETAILS_FILE VIDEODB_MAX_COLUMNS + 2
#define VIDEODB_DETAILS_PATH VIDEODB_MAX_COLUMNS + 3
VIDEODB_ID_STUDIOS = 18,
VIDEODB_ID_TRAILER = 19,
VIDEODB_ID_FANART = 20,
+ VIDEODB_ID_COUNTRY = 21,
VIDEODB_ID_MAX
} VIDEODB_IDS;
{ VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strPictureURL.m_spoof) },
{ VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strStudio) },
{ VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strTrailer) },
- { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_fanart.m_xml) }
+ { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_fanart.m_xml) },
+ { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strCountry) }
};
typedef enum // this enum MUST match the offset struct further down!! and make sure to keep min and max at -1 and sizeof(offsets)
void GetFilePathById(int idMovie, CStdString &filePath, VIDEODB_CONTENT_TYPE iType);
bool GetGenreById(int idGenre, CStdString& strGenre);
+ bool GetCountryById(int idCountry, CStdString& strCountry);
bool GetSetById(int idSet, CStdString& strSet);
int GetTvShowForEpisode(int idEpisode);
void GetTvShowGenresByName(const CStdString& strSearch, CFileItemList& items);
void GetMusicVideoGenresByName(const CStdString& strSearch, CFileItemList& items);
+ void GetMovieCountriesByName(const CStdString& strSearch, CFileItemList& items);
+
void GetMusicVideoAlbumsByName(const CStdString& strSearch, CFileItemList& items);
void GetMovieActorsByName(const CStdString& strSearch, CFileItemList& items);
// general browsing
bool GetGenresNav(const CStdString& strBaseDir, CFileItemList& items, int idContent=-1);
+ bool GetCountriesNav(const CStdString& strBaseDir, CFileItemList& items, int idContent=-1);
bool GetStudiosNav(const CStdString& strBaseDir, CFileItemList& items, int idContent=-1);
+ bool GetYearsNav(const CStdString& strBaseDir, CFileItemList& items, int idContent=-1);
bool GetActorsNav(const CStdString& strBaseDir, CFileItemList& items, int idContent=-1);
bool GetDirectorsNav(const CStdString& strBaseDir, CFileItemList& items, int idContent=-1);
bool GetWritersNav(const CStdString& strBaseDir, CFileItemList& items, int idContent=-1);
- bool GetYearsNav(const CStdString& strBaseDir, CFileItemList& items, int idContent=-1);
bool GetSetsNav(const CStdString& strBaseDir, CFileItemList& items, int idContent=-1, const CStdString &where = "");
bool GetMusicVideoAlbumsNav(const CStdString& strBaseDir, CFileItemList& items, int idArtist);
- bool GetMoviesNav(const CStdString& strBaseDir, CFileItemList& items, int idGenre=-1, int idYear=-1, int idActor=-1, int idDirector=-1, int idStudio=-1, int idSet=-1);
+ bool GetMoviesNav(const CStdString& strBaseDir, CFileItemList& items, int idGenre=-1, int idYear=-1, int idActor=-1, int idDirector=-1, int idStudio=-1, int idCountry=-1, int idSet=-1);
bool GetTvShowsNav(const CStdString& strBaseDir, CFileItemList& items, int idGenre=-1, int idYear=-1, int idActor=-1, int idDirector=-1, int idStudio=-1);
bool GetSeasonsNav(const CStdString& strBaseDir, CFileItemList& items, int idActor=-1, int idDirector=-1, int idGenre=-1, int idYear=-1, int idShow=-1);
bool GetEpisodesNav(const CStdString& strBaseDir, CFileItemList& items, int idGenre=-1, int idYear=-1, int idActor=-1, int idDirector=-1, int idShow=-1, int idSeason=-1);
int AddToTable(const CStdString& table, const CStdString& firstField, const CStdString& secondField, const CStdString& value);
int AddGenre(const CStdString& strGenre1);
int AddActor(const CStdString& strActor, const CStdString& strThumb);
+ int AddCountry(const CStdString& strCountry);
int AddSet(const CStdString& strSet);
int AddStudio(const CStdString& strStudio1);
+
int AddTvShow(const CStdString& strPath);
int AddMusicVideo(const CStdString& strFilenameAndPath);
void AddStudioToTvShow(int idTvShow, int idStudio);
void AddStudioToMusicVideo(int idMVideo, int idStudio);
+ void AddCountryToMovie(int idMovie, int idCountry);
+
void AddGenreAndDirectorsAndStudios(const CVideoInfoTag& details, std::vector<int>& vecDirectors, std::vector<int>& vecGenres, std::vector<int>& vecStudios);
void DeleteStreamDetails(int idFile);
private:
virtual bool CreateTables();
virtual bool UpdateOldVersion(int version);
- virtual int GetMinVersion() const { return 37; };
+ virtual int GetMinVersion() const { return 38; };
const char *GetDefaultDBName() const { return "MyVideos34.db"; };
void ConstructPath(CStdString& strDest, const CStdString& strPath, const CStdString& strFileName);
m_strDirector = "";
m_strWritingCredits = "";
m_strGenre = "";
+ m_strCountry = "";
m_strTagLine = "";
m_strPlotOutline = "";
m_strPlot = "";
XMLUtils::SetString(movie, "id", m_strIMDBNumber);
XMLUtils::SetAdditiveString(movie, "genre",
g_advancedSettings.m_videoItemSeparator, m_strGenre);
+ XMLUtils::SetAdditiveString(movie, "country",
+ g_advancedSettings.m_videoItemSeparator, m_strCountry);
XMLUtils::SetAdditiveString(movie, "set",
g_advancedSettings.m_videoItemSeparator, m_strSet);
XMLUtils::SetAdditiveString(movie, "credits",
ar << m_strDirector;
ar << m_strWritingCredits;
ar << m_strGenre;
+ ar << m_strCountry;
ar << m_strTagLine;
ar << m_strPlotOutline;
ar << m_strPlot;
ar >> m_strDirector;
ar >> m_strWritingCredits;
ar >> m_strGenre;
+ ar >> m_strCountry;
ar >> m_strTagLine;
ar >> m_strPlotOutline;
ar >> m_strPlot;
}
XMLUtils::GetAdditiveString(movie,"genre",g_advancedSettings.m_videoItemSeparator,m_strGenre);
+ XMLUtils::GetAdditiveString(movie,"country",g_advancedSettings.m_videoItemSeparator,m_strCountry);
XMLUtils::GetAdditiveString(movie,"credits",g_advancedSettings.m_videoItemSeparator,m_strWritingCredits);
XMLUtils::GetAdditiveString(movie,"director",g_advancedSettings.m_videoItemSeparator,m_strDirector);
XMLUtils::GetAdditiveString(movie,"showlink",g_advancedSettings.m_videoItemSeparator,m_strShowLink);
}
genre = genre->NextSiblingElement("Genre");
}
+ // countries
+ node = movie->FirstChild("Countries");
+ const TiXmlNode *country = node ? node->FirstChildElement("Country") : NULL;
+ while (country)
+ {
+ if (country && country->FirstChild())
+ {
+ strTemp = country->FirstChild()->Value();
+ if (m_strCountry.IsEmpty())
+ m_strCountry = strTemp;
+ else
+ m_strCountry += g_advancedSettings.m_videoItemSeparator+strTemp;
+ }
+ country = country->NextSibling("Countries");
+ }
// MyMovies categories to genres
if (g_advancedSettings.m_bVideoLibraryMyMoviesCategoriesToGenres)
{
CStdString m_strDirector;
CStdString m_strWritingCredits;
CStdString m_strGenre;
+ CStdString m_strCountry;
CStdString m_strTagLine;
CStdString m_strPlotOutline;
CStdString m_strTrailer;
{
if (strTest.Equals("videoplayer.title")) ret = VIDEOPLAYER_TITLE;
else if (strTest.Equals("videoplayer.genre")) ret = VIDEOPLAYER_GENRE;
+ else if (strTest.Equals("videoplayer.country")) ret = VIDEOPLAYER_COUNTRY;
else if (strTest.Equals("videoplayer.originaltitle")) ret = VIDEOPLAYER_ORIGINALTITLE;
else if (strTest.Equals("videoplayer.director")) ret = VIDEOPLAYER_DIRECTOR;
else if (strTest.Equals("videoplayer.year")) ret = VIDEOPLAYER_YEAR;
else if (info.Equals("pictureresolution")) return LISTITEM_PICTURE_RESOLUTION;
else if (info.Equals("picturedatetime")) return LISTITEM_PICTURE_DATETIME;
else if (info.Equals("studio")) return LISTITEM_STUDIO;
+ else if (info.Equals("country")) return LISTITEM_COUNTRY;
else if (info.Equals("mpaa")) return LISTITEM_MPAA;
else if (info.Equals("cast")) return LISTITEM_CAST;
else if (info.Equals("castandrole")) return LISTITEM_CAST_AND_ROLE;
case VIDEOPLAYER_TVSHOW:
case VIDEOPLAYER_PREMIERED:
case VIDEOPLAYER_STUDIO:
+ case VIDEOPLAYER_COUNTRY:
case VIDEOPLAYER_MPAA:
case VIDEOPLAYER_TOP250:
case VIDEOPLAYER_CAST:
case VIDEOPLAYER_STUDIO:
return m_currentFile->GetVideoInfoTag()->m_strStudio;
+ case VIDEOPLAYER_COUNTRY:
+ return m_currentFile->GetVideoInfoTag()->m_strCountry;
case VIDEOPLAYER_MPAA:
return m_currentFile->GetVideoInfoTag()->m_strMPAARating;
case VIDEOPLAYER_TOP250:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strStudio;
break;
+ case LISTITEM_COUNTRY:
+ if (item->HasVideoInfoTag())
+ return item->GetVideoInfoTag()->m_strCountry;
+ break;
case LISTITEM_MPAA:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strMPAARating;
#define VIDEOPLAYER_AUDIO_CHANNELS 289
#define VIDEOPLAYER_VIDEO_ASPECT 290
#define VIDEOPLAYER_HASTELETEXT 291
+#define VIDEOPLAYER_COUNTRY 292
#define AUDIOSCROBBLER_ENABLED 300
#define AUDIOSCROBBLER_CONN_STATE 301
#define LISTITEM_SUBTITLE_LANGUAGE (LISTITEM_START + 52)
#define LISTITEM_IS_FOLDER (LISTITEM_START + 53)
#define LISTITEM_ORIGINALTITLE (LISTITEM_START + 54)
+#define LISTITEM_COUNTRY (LISTITEM_START + 55)
#define LISTITEM_PROPERTY_START (LISTITEM_START + 200)
#define LISTITEM_PROPERTY_END (LISTITEM_PROPERTY_START + 1000)