mediathekview/plugin.video.mediathekview

MariaDB database not created

Yosamite99 opened this issue · 6 comments

Hi all,

recently figured out the there is a new version of the plugin. After installing it on one of my LE RPIs I recognized that it's not working with an external MariaDB anymore. While a local SQLlite is working as expected the external connection is only creating the schema but nothing else.

Server: 10.6.7-MariaDB-2ubuntu1.1 - Ubuntu 22.04
Plugin version: 1.09

Furthermore the mvupdate(3) script isn't working as well, with the old 0.6.6 database it's complaining about a UTF8 coding error and a new 1.09 database isn't created.
According to a quick search on the Internet switching to the mariadb connector sounds as a viable option
https://stackoverflow.com/questions/73244027/character-set-utf8-unsupported-in-python-mysql-connector

Best, Yosamite99

Hi Yosamite99,

I have an old Ubuntu 18 left for testing with py2 but after some time i got the mvupdate working on mariadb 10.
I needed top play a bit around with the mysql-connetor - the latest version 8.0.31 did not work for my installation.
Please have a look at the logs by adding "-v -v -v" starting options.

On your ugrade issue.
The upgrade from 0.6 to 1.x is not support. The simple solution is to drop the DB and have it rebuild.

In regards to the sql connetor. It absolutely your choice to use any version. The restrictions/recommendation in the old 0.6.6 manual was removed quite some time ago.

Well, the old version and setup including MariaDB already was working on the DB server till end of August this year. The reason why it stopped is unclear to me but my guess would be

  • UTF8 issue based on newer mysql connector >= 8.0.30

This could also hamper the setup of a new DB.

I used the code from StoreMySQLsetup.py to create the tables and index but it didn't get filled. If you have time you may try to replace the mysql connector by the mariadb connector or make both usable (some hints are in the link I provided).
Looking on that the majority of users are likely on mariadb (supported by all major distributions) instead of mysql this could be an easy fix without jeopardizing the existing user base significantly.

What's your thoughts?

Best, Yosamite99

As described I had to downgrade the connector as well due to py2 issue in the connector.
The connector is not part of the application but the OS you are using. It is installed by the user and up to the user to upgrade / downgrade / maintain. There is nothing which could be done on MV side.

I saw some code in the .py files where the Python mysql (connector) libraries are included. That's why I think it's part of the plugin solution. I have now both connectors installed but this doesn't help at all.
Here an example of error message when mvupdate(3) is started:

./update_mediathekview
/usr/share/plugin.video.mediathekview /etc/cron.hourly
Traceback (most recent call last):
File "/usr/share/plugin.video.mediathekview/resources/lib/storeMySqlSetup.py", line 75, in setupDatabase
rs = self.conn.execute("SHOW DATABASES LIKE '{}'".format(self.settings.getDatabaseSchema()))
File "/usr/share/plugin.video.mediathekview/resources/lib/storeMySql.py", line 78, in execute
return super(StoreMySQL, self).execute(aStmt, aParams)
File "/usr/share/plugin.video.mediathekview/resources/lib/storeQuery.py", line 66, in execute
cursor = self.getConnection().cursor()
File "/usr/share/plugin.video.mediathekview/resources/lib/storeMySql.py", line 57, in getConnection
self.conn = mysql.connector.connect(**connectargs)
File "/usr/local/lib/python3.10/dist-packages/mysql/connector/pooling.py", line 287, in connect
return MySQLConnection(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/mysql/connector/connection.py", line 137, in init
self.connect(**kwargs)
File "/usr/local/lib/python3.10/dist-packages/mysql/connector/abstracts.py", line 1108, in connect
self._open_connection()
File "/usr/local/lib/python3.10/dist-packages/mysql/connector/connection.py", line 544, in _open_connection
self.set_converter_class(self._converter_class)
File "/usr/local/lib/python3.10/dist-packages/mysql/connector/abstracts.py", line 1284, in set_converter_class
self.converter = convclass(charset_name, self._use_unicode)
File "/usr/local/lib/python3.10/dist-packages/mysql/connector/conversion.py", line 136, in init
MySQLConverterBase.init(self, charset, use_unicode, str_fallback)
File "/usr/local/lib/python3.10/dist-packages/mysql/connector/conversion.py", line 59, in init
self.set_charset(charset)
File "/usr/local/lib/python3.10/dist-packages/mysql/connector/conversion.py", line 73, in set_charset
self.charset_id = CharacterSet.get_charset_info(self.charset)[0]
File "/usr/local/lib/python3.10/dist-packages/mysql/connector/constants.py", line 775, in get_charset_info
info = cls.get_default_collation(charset)
File "/usr/local/lib/python3.10/dist-packages/mysql/connector/constants.py", line 746, in get_default_collation
raise ProgrammingError(f"Character set '{charset}' unsupported")
mysql.connector.errors.ProgrammingError: Character set 'utf8' unsupported

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/share/plugin.video.mediathekview/mvupdate3", line 19, in
APP.run()
File "/usr/share/plugin.video.mediathekview/resources/lib/mvupdate.py", line 206, in run
updateop = self.updater.doUpdate()
File "/usr/share/plugin.video.mediathekview/resources/lib/updater.py", line 91, in doUpdate
StoreMySQLSetup(self.database).setupDatabase()
File "/usr/share/plugin.video.mediathekview/resources/lib/storeMySqlSetup.py", line 82, in setupDatabase
cursor = self.conn.getConnection().cursor()
File "/usr/share/plugin.video.mediathekview/resources/lib/storeMySql.py", line 57, in getConnection
self.conn = mysql.connector.connect(**connectargs)
File "/usr/local/lib/python3.10/dist-packages/mysql/connector/pooling.py", line 287, in connect
return MySQLConnection(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/mysql/connector/connection.py", line 137, in init
self.connect(**kwargs)
File "/usr/local/lib/python3.10/dist-packages/mysql/connector/abstracts.py", line 1108, in connect
self._open_connection()
File "/usr/local/lib/python3.10/dist-packages/mysql/connector/connection.py", line 544, in _open_connection
self.set_converter_class(self._converter_class)
File "/usr/local/lib/python3.10/dist-packages/mysql/connector/abstracts.py", line 1284, in set_converter_class
self.converter = convclass(charset_name, self._use_unicode)
File "/usr/local/lib/python3.10/dist-packages/mysql/connector/conversion.py", line 136, in init
MySQLConverterBase.init(self, charset, use_unicode, str_fallback)
File "/usr/local/lib/python3.10/dist-packages/mysql/connector/conversion.py", line 59, in init
self.set_charset(charset)
File "/usr/local/lib/python3.10/dist-packages/mysql/connector/conversion.py", line 73, in set_charset
self.charset_id = CharacterSet.get_charset_info(self.charset)[0]
File "/usr/local/lib/python3.10/dist-packages/mysql/connector/constants.py", line 775, in get_charset_info
info = cls.get_default_collation(charset)
File "/usr/local/lib/python3.10/dist-packages/mysql/connector/constants.py", line 746, in get_default_collation
raise ProgrammingError(f"Character set '{charset}' unsupported")
mysql.connector.errors.ProgrammingError: Character set 'utf8' unsupported

This should solve your problem - at least it was working for me.
pip3 install mysql-connector-python==8.0.5
Give it a try and increase until you find the proper version for your need.

Dear codingPF,

thank you for the hint but this isn't working for me as well. Up to version .29 I'm getting this:

Traceback (most recent call last):
File "/usr/share/plugin.video.mediathekview/mvupdate3", line 19, in
APP.run()
File "/usr/share/plugin.video.mediathekview/resources/lib/mvupdate.py", line 206, in run
updateop = self.updater.doUpdate()
File "/usr/share/plugin.video.mediathekview/resources/lib/updater.py", line 91, in doUpdate
StoreMySQLSetup(self.database).setupDatabase()
File "/usr/share/plugin.video.mediathekview/resources/lib/storeMySqlSetup.py", line 92, in setupDatabase
for result in cursor.execute(self._setupScript, multi=True):
File "/etc/cron.hourly/venv/lib/python3.10/site-packages/mysql/connector/cursor.py", line 501, in _execute_iter
result = next(query_iter)
File "/etc/cron.hourly/venv/lib/python3.10/site-packages/mysql/connector/connection.py", line 969, in cmd_query_iter
yield self._handle_result(self._send_cmd(ServerCmd.QUERY, query))
File "/etc/cron.hourly/venv/lib/python3.10/site-packages/mysql/connector/connection.py", line 732, in _handle_result
raise errors.get_exception(packet)
mysql.connector.errors.DatabaseError: 1728 (HY000): Cannot load from mysql.proc. The table is probably corrupted

Starting with version .30 the utf8 error is showing up. None of the connectors .5 up to .31 was allowing the proper installation of the database. No columns etc. got ever created.

It's a pity but without a DB sitting on a performant system the tool isn't helping that much anymore. Sqlite isn't a viable option on an SD card in a Pi.

Please don't get me wrong, I'm not blaming in any sense. I'm using a VDR for more than 10 years and using Pi's with Kodi on all my TV's but it seems I have to switch to Fire-TV to have a seamless streaming experience.

All the best, Yosamite99