Opened 12 years ago

Closed 12 years ago

#3313 closed patch (fixed)

Add the ability for imdbpy to get the episode title format from the database

Reported by: anonymous Owned by: Anduin Withers
Priority: minor Milestone: unknown
Component: mythvideo Version: head
Severity: medium Keywords:
Cc: mythtv@… Ticket locked: no

Description

This patch extends the functionality from #3123

Instead of having to hard code your chosen episode title format into the script every time you update it, it will fetch the value from the settings table (if it exists).

The setting value is VideoEpisodeTitleFormat? wich you will need to manually insert into the database to use this functionality.

The default behaviour isn't changed.

I've just copied the database related functions from find_meta.py so they are now duplicated. I'm sure it could be consolidated somehow.

Cheers!

Attachments (5)

episode_title_db.diff (3.2 KB) - added by hads 12 years ago.
mythtv.py (1.9 KB) - added by hads 12 years ago.
mythtv.2.py (10.2 KB) - added by hads 12 years ago.
mythtv.3.py (10.6 KB) - added by hads 12 years ago.
mythvideo_mythtv.diff (10.9 KB) - added by hads 12 years ago.

Download all attachments as: .zip

Change History (12)

Changed 12 years ago by hads

Attachment: episode_title_db.diff added

comment:1 Changed 12 years ago by anonymous

Summary: Add the ability to get the episode title format from the databaseAdd the ability for imdbpy to get the episode title format from the database

comment:2 Changed 12 years ago by Pekka Jääskeläinen <pekka.jaaskelainen@…>

The DB functions should not be copied, but maybe put them to imdbpy.py the first place and make find_meta.py use them from there. Or mayben even start a new python utility file for storing these generally useful Python MythTV functions which all Python scripts can then use.

Changed 12 years ago by hads

Attachment: mythtv.py added

comment:3 Changed 12 years ago by hads

I just added a file (mythtv.py) which is just those two copied database functions put into a class.

I also extended the init to search for the mysql.txt config file in the standard mythtv places.

comment:4 Changed 12 years ago by hads

I'm in the process of updating imdb.py and find_meta.py to use mythtv.py and I have a couple of questions I'd appreciate input on;

Firstly, thinking about future expansion, does it make sense to use separate classes for MythTV and MythVideo? etc.? I think maybe it would be does.

Secondly, does anyone have an opinion on depending on sqlalchemy? It's not a major concern for the moment given that there only a couple of functions using SQL but I can see it becoming more and more convenient as the mythtv.py file expands.

I've been using sqlalchemy quite a bit lately and really appreciate it's flexibility but don't want to create an extra dependency which others may think unnecessary.

Thoughts?

Changed 12 years ago by hads

Attachment: mythtv.2.py added

comment:5 Changed 12 years ago by hads

I just added an updated attachment (mythtv.2.py) in which I've created an actual connection to the mythbackend along with some other stuff that is useful for me here.

It should provide the functionality needed to support find_meta.py

Changed 12 years ago by hads

Attachment: mythtv.3.py added

Changed 12 years ago by hads

Attachment: mythvideo_mythtv.diff added

comment:6 Changed 12 years ago by hads

I've attached a diff (mythvideo_mythtv.diff) which makes find_meta.py and imdbpy.py use the MythTV and MythVideo? classes. It also incorporates the change from the first diff to pull the episode title format form the settings table.

I've also added a new version of mythtv.py (mythtv.3.py) which is pretty much the same, just adds a new function.

I was talking with visit0r on IRC about the classnames in mythtv.py. He suggested that possibly the class should be called MythBackend? and MythDB rather than a single MythTV class. Thought are welcome.

comment:7 Changed 12 years ago by Anduin Withers

Resolution: fixed
Status: newclosed

(In [13429]) Closes #3313

Add a secret VideoEpisodeTitleFormat? DB setting to be used by imdbpy.py (to save your episode/title format).

Introduce MythTV.py, which may eventually grow to a larger MythTV Python module.

Note: See TracTickets for help on using tickets.