Alter Table (metadata_items)

Hey,
Iam need a additional column in the metadata_items table for my plugin. Iam trying to add these column in the start method of my plugin. But nothing changes.

Heres my code

def Start(): ObjectContainer.title1 = name ObjectContainer.art = R(art) HTTP.CacheTime = CACHE_1HOUR conn = sqlite3.connect(database) change = True for row in conn.execute('PRAGMA table_info(metadata_items)').fetchall(): if row[1] == prefix + 'Link': change = False if change == True: conn.execute('ALTER TABLE metadata_items ADD COLUMN ' + prefix + 'Link' + ' TEXT;') conn.commit() conn.close()

Update: A test with a SQLite editor for alter the table Iam getting a error that says the database is locked. How can I unlocked it without stop the Plex server?

I can’t help you with that, but I can tell you that the whole idea is bad, and could lead to problems with future upgrades.
Also note, that not all platforms support direct access to the database. (Windows and Mac only, AFAIK)

/T

I agree. Modifying the database is a bad idea. You can seriously mess things up. It could also prevent the database from updating if Plex should make a change themselves to that table in the future. Find some other way to store the info you want outside of Plex’s database.

Hmmm, that is bad. Do you have any recommendations for me? I need only to save a Url to a website for a Serie/Movie in my Plex Mediadatabase. From the Websites I parse recommendations for other Series/Movies and these are Entries from my Channel Plugin.

Another Question: Is there any possibility to add the Url inside Plex?

Plex Framework does not allows you to add a hyperlink to the gui, if that’s what you are asking.

Note that it’s purpose was/is to stream with a minimistic interface.

Regarding storage, either use the storage API (data) or Dict

See this post:

forums.plex.tv/discussion/comment/971278/#Comment_971278

/T

Thanks for the infos. now it is clear why it don’t works :wink:

A question about the storage API: is there any documentation or tutorial how I must use it. The “Plex Plug-in Framework Documentation” is not useful enough for me (in example: in which place must the files exists to access it)?

That’s all handled internally by the API, and you do not access the file directly, only through the API.

Data.SaveObject(item, obj) Stores a Python object as a data item with the given name. Parameters • item (str (http://docs.python.org/library/functions.html#str)) – The name of the data item to store. • data (object (http://docs.python.org/library/functions.html#object)) – The Python object to store.

As such, the physical location of the file is irrelevant.

/T