Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Mysql gui #451

Closed
wants to merge 1 commit into from

8 participants

@amet

ok, this moves MySql DB settings from advancedsettings.xml to GUI under Video/Music Library

@firnsy
I would love your ack for this whole thing, especially the timeout in the first commit

and thx "grumpy" for the patience :)

amet

@davilla
Collaborator

+1

@JezzX
Collaborator

This was discussed in the team forum a while ago and basically was decided

"don't think it should be added to the GUI until there is easy to set up instructions for all the 3 main platforms on the wiki (as well as tweaks to make it run faster) and it can handle images (thumbnails/fanart) as well"

The only things that should be in the UI are things that will also not require other things as well

btw its a post by firnsy under the title "Database (metadata) settings - From AS.xml to the GUI?"

@amet

@JezzX

Yeah, I agree but seeing how many users use it on iOS/atv2 platform there really isn't much harm in putting it in GUI.

As for the thumbs, there is a band-aid solution for that until we refactor thumbs and extraction of the existing urls from remote db

@JezzX
Collaborator

yeah I know but the thumbnail path substitution still requires editing AS.xml anyway so its kind of pointless to put on in and not the other.
Also from my point of view many "iOS/atv2" users may use it but they do not 'require' it in order for xbmc to work properly so to me its still an advanced setting and spiff, jmarshall, natethomas and Malard all also agreed that it will cause more harm than good in user support

P.S. I bumped the topic int he team forum so go look

@amet

As I said, there is a band aid solution for thumb path substitution ...

As for the users support, I can't see how telling an average user to ssh in and use vi to edit as.XML is easier. I actually don't care anymore :) mine is setup, that's all that matters by the looks of things

Bb in a week

@topfs2
Collaborator

I definatly think its a wrong move to put this in the GUI, MySQL is not a good end solution for users and IMO never had. It does do something we need (and many wants) but we need to make a fool proof way of going about this. MySQL is not that way IMO. Remote Database and such is all good but MySQL no. It makes sense to support it but IMO the users which needs it and can handle setting it up can handle setting up the as.xml, the opposite is not true.

Definatly has my -1, our GUI is far to complicated with far to many complicated knobs IMO already.

@Albinoman887

i completely agree this is not a good idea at all coming from an end user who CAN edit the as.xml i would not want this in the GUI if you cant edit a as.xml you shouldnt be messing my SQL anyways

@amet

Well, it was worth a try... I agree that this is not ideal but it was definitely better than telling someone to edit as.xml

As for not messing with mysql if you can't edit as.xml..... BS, it takes 10 seconds to install it on some systems and it doesn't require any knowledge other than clicking "install" ...

@amet amet closed this
@topfs2
Collaborator

Well thats not really true, you need to move your thumbnails and do path substitution. As I have stated previously if we didn't need to do that I could almost agree it would be valid to have. I still don't like the idea of having a backend which doesn't serve the content aswell (both thumbnails and the actual media) as it just leads to problems for the vast majority of users and does not live up to the quality of the experience we want (IMO)

@amet

And I have said more than once that there is a fix for remote thumbs...

@firnsy
Collaborator

"... I still don't like the idea of having a backend which doesn't serve the content aswell (both thumbnails and the actual media) as it just leads to problems for the vast majority of users and does not live up to the quality of the experience we want (IMO)"

This would infer that the sqlite/local file system does not live up to the quality of the experience we want (IYO) ;)

I think what the mysql backend has shown is that centralised storage of media/metadata is quickly becoming more of a norm than a niche.

@ghost

the idea here was that we already have a whole platform of users using this. we'd stick these in, and a bandaid in the eden release branch to set the substitute crap from the gui. that way we don't have to point atv2 et al users to advancedsettings.xml, which really feels bad.

we all agree this is fugly. but we're exposing it to these users no matter.

@topfs2
Collaborator

"This would infer that the sqlite/local file system does not live up to the quality of the experience we want (IYO) ;)"

Que? On local and sqlite you store the thumbs locally, while they may not be INSIDE the db they are locally so if the db is accessible the thumbs are too (unless something is really wrong). That media needs to be on the server which has the db is a bit overkill I agree though :)

"I think what the mysql backend has shown is that centralised storage of media/metadata is quickly becoming more of a norm than a niche."

I'm not arguing if having media/metadata centralized or distributed is a valid thing, I fully agree it is. MySQL and path substitution is far from the nicest solution to this though. A solution which IMO falls very far from the quality of the rest of XBMC, which is why I'm against it

@cptspiff IMO what we put in gui settings is what we showcase as a fully working and valid feature which is in agreement with our quality standards. While mysql does fill a feature known to be wanted it does not IMO fill the quality (or user experience) standards we have on XBMC.

Somehow I'd feel more comfortable if this was an addon, so you download the addon configure and restart. That might be a little bit more fugly but atleast its outside of what we consider "official" and what we consider in line with our quality standards. It would then be extremely clear its a bandaid solution.

@amet amet reopened this
@bradvido

As a heavy mysql user, I agree that for those of us setting up a distributed system, editing the XML and configuring the thumb paths is something we can handle.
This probably shouldn't be in the GUI yet because (as mentioned) it requires configuring things that are outside of XBMC.

What I'd love to see XBMC do is to prompt the user when installing --> Will this be a single instance or a distributed XBMC system? If distributed, ask them what type of database they will be using and configure at that point.

This still leaves the issue of thumbs, but that's a different topic. (I think they should be in the DB and cleaned automatically: http://forum.xbmc.org/showthread.php?t=96097)

@smidley

I agree with @bradvido There should be an option during installation. "Enable SQL Database Features" - Don't check this if you're a new user.

@amet amet closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
10 language/English/strings.xml
@@ -701,7 +701,15 @@
<string id="796">Continuous repeat delay (ms)</string>
<string id="797">Maximum number of clients</string>
<string id="798">Internet access</string>
-
+ <string id="799">Connected to MySQL database successfully</string>
+ <string id="800">Could not connect to MySQL database</string>
+ <string id="801">Database</string>
+ <string id="802">SQLite</string>
+ <string id="803">MySQL</string>
+
+ <string id="805">Test Database Settings</string>
+ <string id="806">- Name</string>
+
<string id="850">Invalid port number entered</string>
<string id="851">Valid port range is 1-65535</string>
<string id="852">Valid port range is 1024-65535</string>
View
4 xbmc/dbwrappers/mysqldataset.cpp
@@ -27,6 +27,7 @@
#include "utils/log.h"
#include "system.h" // for GetLastError()
#include "mysql/errmsg.h"
+#include "settings/GUISettings.h"
#ifdef _WIN32
#pragma comment(lib, "mysqlclient.lib")
#endif
@@ -155,6 +156,8 @@ int MysqlDatabase::connect(bool create_new) {
CLog::Log(LOGERROR, "Unable to open database: %s [%d](%s)",
db.c_str(), mysql_errno(conn), mysql_error(conn));
+
+ g_guiSettings.SetInt("videolibrary.type", 0); //we cant connect, go back to sqlite
return DB_CONNECTION_NONE;
}
catch(...)
@@ -162,6 +165,7 @@ int MysqlDatabase::connect(bool create_new) {
CLog::Log(LOGERROR, "Unable to open database: %s (%u)",
db.c_str(), GetLastError());
}
+ g_guiSettings.SetInt("videolibrary.type", 0); //we cant connect, go back to sqlite
return DB_CONNECTION_NONE;
}
View
15 xbmc/music/MusicDatabase.cpp
@@ -87,7 +87,20 @@ CMusicDatabase::~CMusicDatabase(void)
bool CMusicDatabase::Open()
{
- return CDatabase::Open(g_advancedSettings.m_databaseMusic);
+ g_settings.m_databaseMusic.type = (CStdString*)g_guiSettings.GetInt("musiclibrary.type") > 0 ? "mysql" : "sqlite3";
+ g_settings.m_databaseMusic.host = g_guiSettings.GetString("musiclibrary.host");
+ g_settings.m_databaseMusic.port = g_guiSettings.GetString("musiclibrary.port");
+ g_settings.m_databaseMusic.user = g_guiSettings.GetString("musiclibrary.user");
+ g_settings.m_databaseMusic.pass = g_guiSettings.GetString("musiclibrary.pass");
+ g_settings.m_databaseMusic.name = g_guiSettings.GetString("musiclibrary.name");
+
+ if (CDatabase::Open(g_settings.m_databaseMusic))
+ {
+ CommitTransaction();
+ return true;
+ }
+ g_guiSettings.SetInt("musiclibrary.type", 0);
+ return false;
}
bool CMusicDatabase::CreateTables()
View
22 xbmc/settings/AdvancedSettings.cpp
@@ -872,28 +872,6 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file)
XMLUtils::GetBoolean(pRootElement, "measurerefreshrate", m_measureRefreshrate);
- TiXmlElement* pDatabase = pRootElement->FirstChildElement("videodatabase");
- if (pDatabase)
- {
- CLog::Log(LOGWARNING, "VIDEO database configuration is experimental.");
- XMLUtils::GetString(pDatabase, "type", m_databaseVideo.type);
- XMLUtils::GetString(pDatabase, "host", m_databaseVideo.host);
- XMLUtils::GetString(pDatabase, "port", m_databaseVideo.port);
- XMLUtils::GetString(pDatabase, "user", m_databaseVideo.user);
- XMLUtils::GetString(pDatabase, "pass", m_databaseVideo.pass);
- XMLUtils::GetString(pDatabase, "name", m_databaseVideo.name);
- }
-
- pDatabase = pRootElement->FirstChildElement("musicdatabase");
- if (pDatabase)
- {
- XMLUtils::GetString(pDatabase, "type", m_databaseMusic.type);
- XMLUtils::GetString(pDatabase, "host", m_databaseMusic.host);
- XMLUtils::GetString(pDatabase, "port", m_databaseMusic.port);
- XMLUtils::GetString(pDatabase, "user", m_databaseMusic.user);
- XMLUtils::GetString(pDatabase, "pass", m_databaseMusic.pass);
- XMLUtils::GetString(pDatabase, "name", m_databaseMusic.name);
- }
pElement = pRootElement->FirstChildElement("enablemultimediakeys");
if (pElement)
View
13 xbmc/settings/AdvancedSettings.h
@@ -26,16 +26,6 @@
class TiXmlElement;
-struct DatabaseSettings
-{
- CStdString type;
- CStdString host;
- CStdString port;
- CStdString user;
- CStdString pass;
- CStdString name;
-};
-
struct TVShowRegexp
{
bool byDate;
@@ -283,9 +273,6 @@ class CAdvancedSettings
bool m_measureRefreshrate; //when true the videoreferenceclock will measure the refreshrate when direct3d is used
//otherwise it will use the windows refreshrate
- DatabaseSettings m_databaseMusic; // advanced music database setup
- DatabaseSettings m_databaseVideo; // advanced video database setup
-
bool m_guiVisualizeDirtyRegions;
int m_guiAlgorithmDirtyRegions;
int m_guiDirtyRegionNoFlipTimeout;
View
32 xbmc/settings/GUISettings.cpp
@@ -272,9 +272,23 @@ void CGUISettings::Initialize()
AddBool(ml,"musiclibrary.downloadinfo", 20192, false);
AddDefaultAddon(ml, "musiclibrary.albumsscraper", 20193, "metadata.albums.allmusic.com", ADDON_SCRAPER_ALBUMS);
AddDefaultAddon(ml, "musiclibrary.artistsscraper", 20194, "metadata.artists.allmusic.com", ADDON_SCRAPER_ARTISTS);
+
+ AddSeparator(ml,"musiclibrary.sep2");
+ map<int,int> musicDatabase;
+ musicDatabase.insert(make_pair(802,0));
+ musicDatabase.insert(make_pair(803,1));
+
+ AddInt(ml, "musiclibrary.type", 801, 1, musicDatabase, SPIN_CONTROL_TEXT);
+
+ AddString(ml,"musiclibrary.host", 706, "127.0.0.1", EDIT_CONTROL_INPUT);
+ AddString(ml,"musiclibrary.port", 730, "3306", EDIT_CONTROL_NUMBER_INPUT);
+ AddString(ml,"musiclibrary.user", 1048, "xbmc", EDIT_CONTROL_INPUT);
+ AddString(ml,"musiclibrary.pass", 733, "xbmc", EDIT_CONTROL_HIDDEN_INPUT);
+ AddString(ml,"musiclibrary.name", 806, "xbmc_music", EDIT_CONTROL_INPUT);
+ AddString(ml, "musiclibrary.test", 805, "", BUTTON_CONTROL_STANDARD);
+ AddSeparator(ml,"musiclibrary.sep3");
AddBool(ml, "musiclibrary.updateonstartup", 22000, false);
AddBool(ml, "musiclibrary.backgroundupdate", 22001, false);
- AddSeparator(ml,"musiclibrary.sep2");
AddString(ml, "musiclibrary.cleanup", 334, "", BUTTON_CONTROL_STANDARD);
AddString(ml, "musiclibrary.export", 20196, "", BUTTON_CONTROL_STANDARD);
AddString(ml, "musiclibrary.import", 20197, "", BUTTON_CONTROL_STANDARD);
@@ -557,9 +571,23 @@ void CGUISettings::Initialize()
AddBool(vdl, "videolibrary.actorthumbs", 20402, true);
AddInt(vdl, "videolibrary.flattentvshows", 20412, 1, 0, 1, 2, SPIN_CONTROL_TEXT);
AddBool(NULL, "videolibrary.flattenmoviesets", 22002, false);
+
+ AddSeparator(vdl, "videolibrary.sep3");
+ map<int,int> videoDatabase;
+ videoDatabase.insert(make_pair(802,0));
+ videoDatabase.insert(make_pair(803,1));
+
+ AddInt(vdl, "videolibrary.type", 801, 1, videoDatabase, SPIN_CONTROL_TEXT);
+
+ AddString(vdl,"videolibrary.host", 706, "127.0.0.1", EDIT_CONTROL_INPUT);
+ AddString(vdl,"videolibrary.port", 730, "3306", EDIT_CONTROL_NUMBER_INPUT);
+ AddString(vdl,"videolibrary.user", 1048, "xbmc", EDIT_CONTROL_INPUT);
+ AddString(vdl,"videolibrary.pass", 733, "xbmc", EDIT_CONTROL_HIDDEN_INPUT);
+ AddString(vdl,"videolibrary.name", 806, "xbmc_video", EDIT_CONTROL_INPUT);
+ AddString(vdl, "videolibrary.test", 805, "", BUTTON_CONTROL_STANDARD);
+ AddSeparator(vdl, "videolibrary.sep4");
AddBool(vdl, "videolibrary.updateonstartup", 22000, false);
AddBool(vdl, "videolibrary.backgroundupdate", 22001, false);
- AddSeparator(vdl, "videolibrary.sep3");
AddString(vdl, "videolibrary.cleanup", 334, "", BUTTON_CONTROL_STANDARD);
AddString(vdl, "videolibrary.export", 647, "", BUTTON_CONTROL_STANDARD);
AddString(vdl, "videolibrary.import", 648, "", BUTTON_CONTROL_STANDARD);
View
49 xbmc/settings/GUIWindowSettingsCategory.cpp
@@ -1036,6 +1036,18 @@ void CGUIWindowSettingsCategory::UpdateSettings()
pControl->SetEnabled(enabled);
}
}
+ else if (strSetting.Equals("videolibrary.host") || strSetting.Equals("videolibrary.port") || strSetting.Equals("videolibrary.test") ||
+ strSetting.Equals("videolibrary.user") || strSetting.Equals("videolibrary.pass") || strSetting.Equals("videolibrary.name"))
+ {
+ CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+ if (pControl) pControl->SetVisible(g_guiSettings.GetInt("videolibrary.type") > 0);
+ }
+ else if (strSetting.Equals("musiclibrary.host") || strSetting.Equals("musiclibrary.port") || strSetting.Equals("musiclibrary.test") ||
+ strSetting.Equals("musiclibrary.user") || strSetting.Equals("musiclibrary.pass") || strSetting.Equals("musiclibrary.name"))
+ {
+ CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+ if (pControl) pControl->SetVisible(g_guiSettings.GetInt("musiclibrary.type") > 0);
+ }
else if (strSetting.Equals("weather.scriptsettings"))
{
AddonPtr addon;
@@ -1124,7 +1136,42 @@ void CGUIWindowSettingsCategory::OnClick(CBaseSettingControl *pSettingControl)
else
return;
}
-
+ else if (strSetting.Equals("videolibrary.test"))
+ {
+ int msgLine = 799;
+ CVideoDatabase videoDatabase;
+ if (!videoDatabase.Open())
+ {
+ msgLine = 800;
+ CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting("videolibrary.type")->GetID());
+ pControl->SetValue(0);
+ }
+ CGUIDialogOK::ShowAndGetInput(805, 20022, msgLine, 20022);
+ }
+ else if (strSetting.Equals("musiclibrary.test"))
+ {
+ int msgLine = 799;
+ CMusicDatabase musicDatabase;
+ if (!musicDatabase.Open())
+ {
+ msgLine = 800;
+ CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting("musiclibrary.type")->GetID());
+ pControl->SetValue(0);
+ }
+ CGUIDialogOK::ShowAndGetInput(805, 20022, msgLine, 20022);
+ }
+ else if (strSetting.Equals("videolibrary.type"))
+ {
+ CVideoDatabase videoDatabase;
+ videoDatabase.Close();
+ videoDatabase.Open();
+ }
+ else if (strSetting.Equals("musiclibrary.type"))
+ {
+ CMusicDatabase musicDatabase;
+ musicDatabase.Close();
+ musicDatabase.Open();
+ }
// if OnClick() returns false, the setting hasn't changed or doesn't
// require immediate update
if (!pSettingControl->OnClick())
View
13 xbmc/settings/Settings.h
@@ -74,6 +74,16 @@
like special://masterprofile/ */
#define PROFILES_FILE "special://masterprofile/profiles.xml"
+struct DatabaseSettings
+{
+ CStdString type;
+ CStdString host;
+ CStdString port;
+ CStdString user;
+ CStdString pass;
+ CStdString name;
+};
+
class CSkinString
{
public:
@@ -127,6 +137,9 @@ class CSettings
int TranslateSkinBool(const CStdString &setting);
bool GetSkinBool(int setting) const;
void SetSkinBool(int setting, bool set);
+
+ DatabaseSettings m_databaseMusic; // music database setup
+ DatabaseSettings m_databaseVideo; // video database setup
/*! \brief Retreive the watched mode for the given content type
\param content Current content type
View
15 xbmc/video/VideoDatabase.cpp
@@ -70,7 +70,20 @@ CVideoDatabase::~CVideoDatabase(void)
//********************************************************************************************************************************
bool CVideoDatabase::Open()
{
- return CDatabase::Open(g_advancedSettings.m_databaseVideo);
+ g_settings.m_databaseVideo.type = (CStdString*)g_guiSettings.GetInt("videolibrary.type") > 0 ? "mysql" : "sqlite3";
+ g_settings.m_databaseVideo.host = g_guiSettings.GetString("videolibrary.host");
+ g_settings.m_databaseVideo.port = g_guiSettings.GetString("videolibrary.port");
+ g_settings.m_databaseVideo.user = g_guiSettings.GetString("videolibrary.user");
+ g_settings.m_databaseVideo.pass = g_guiSettings.GetString("videolibrary.pass");
+ g_settings.m_databaseVideo.name = g_guiSettings.GetString("videolibrary.name");
+
+ if (CDatabase::Open(g_settings.m_databaseVideo))
+ {
+ CommitTransaction();
+ return true;
+ }
+ g_guiSettings.SetInt("videolibrary.type", 0);
+ return false;
}
bool CVideoDatabase::CreateTables()
View
6 xbmc/windows/GUIWindowHome.cpp
@@ -25,7 +25,7 @@
#include "utils/RecentlyAddedJob.h"
#include "interfaces/AnnouncementManager.h"
#include "utils/log.h"
-#include "settings/AdvancedSettings.h"
+#include "settings/Settings.h"
#include "utils/Variant.h"
using namespace ANNOUNCEMENT;
@@ -48,8 +48,8 @@ void CGUIWindowHome::OnInitWindow()
{
// for shared databases (ie mysql) always force an update on return to home
// this is a temporary solution until remote announcements can be delivered
- if ( g_advancedSettings.m_databaseVideo.type.Equals("mysql") ||
- g_advancedSettings.m_databaseMusic.type.Equals("mysql") )
+ if ( g_settings.m_databaseVideo.type.Equals("mysql") ||
+ g_settings.m_databaseMusic.type.Equals("mysql") )
m_updateRA = (Audio | Video | Totals);
AddRecentlyAddedJobs( m_updateRA );
Something went wrong with that request. Please try again.