NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public NextPVR Support Windows v
« Previous 1 … 76 77 78 79 80 … 102 Next »
Schedule series recording

 
  • 0 Vote(s) - 0 Average
Schedule series recording
tjuhl
Offline

Junior Member

Denmark
Posts: 25
Threads: 2
Joined: Sep 2020
#21
2020-09-15, 07:35 AM
(2020-09-14, 05:37 PM)mvallevand Wrote: I see the data and for me the quick fix would be to take everything the trailing () and place that in the subtitle and trim it from the title for specific countries  I was originally thinking the "Modern Family" info was time now I see it is "episode # of #"

Martin

Correct. Sub is going to have a look at it. I will see what he comes up with before I start playing with it;-)

Torben
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 53,119
Threads: 957
Joined: May 2006
#22
2020-09-15, 02:06 PM (This post was last modified: 2020-09-15, 03:23 PM by mvallevand.)
If you want this is a python script you could put in PostLoadEPG.bat that will do this for you for know (backup npvr.db3 for testing). You might want to try this to see if that is what you are looking for

Code:
import sqlite3
import re

def regexp(item):
    return reg.search(item) is not None

def regexp1(item):
    return reg.search(item)[0]

conn = sqlite3.connect('npvr.db3')
conn.create_function("ISBRACKET", 1, regexp)
conn.create_function("BRACKETS", 1, regexp1)
reg = re.compile(r' \([\d:]+\)$')
cursor = conn.cursor()
cursor.execute('update epg_event \
    set title = replace (title, BRACKETS(title),""), \
    subtitle = trim(BRACKETS(title)) \
    WHERE ISBRACKET(title)')
conn.commit()

Martin
tjuhl
Offline

Junior Member

Denmark
Posts: 25
Threads: 2
Joined: Sep 2020
#23
2020-09-16, 06:59 AM
(2020-09-15, 02:06 PM)mvallevand Wrote: If you want this is a python script you could put in PostLoadEPG.bat that will do this for you for know (backup npvr.db3 for testing).  You might want to try this to see if that is what you are looking for

Code:
import sqlite3
import re

def regexp(item):
    return reg.search(item) is not None

def regexp1(item):
    return reg.search(item)[0]

conn = sqlite3.connect('npvr.db3')
conn.create_function("ISBRACKET", 1, regexp)
conn.create_function("BRACKETS", 1, regexp1)
reg = re.compile(r' \([\d:]+\)$')
cursor = conn.cursor()
cursor.execute('update epg_event \
    set title = replace (title, BRACKETS(title),""), \
    subtitle = trim(BRACKETS(title)) \
    WHERE ISBRACKET(title)')
conn.commit()

Martin

That worked perfectly! All titles are cleaned up and the (#:total#) are moved to subtitles portion.
Thanks Martin!!!

Torben
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 53,119
Threads: 957
Joined: May 2006
#24
2020-09-16, 01:17 PM
Nothing is perfect depending on your python skills

1. You could extract the season episode from a lot of descriptions with this regex.
Code:
Sæson.+(\d{1,2}).+Afsnit.+(\d{1,3})

2. Because these values with the () at the end seem to be unique I would check with sub but I would consider setting the unique_id to the original title for these rows to avoid duplicates

3. If the subtitle is #:# I would parse it further to zero pad the first number so that 10 shows after 2

Martin
tjuhl
Offline

Junior Member

Denmark
Posts: 25
Threads: 2
Joined: Sep 2020
#25
2020-09-16, 05:37 PM
(2020-09-16, 01:17 PM)mvallevand Wrote: Nothing is perfect depending on your python skills

1. You could extract the season episode from a lot of descriptions with this regex.
Code:
Sæson.+(\d{1,2}).+Afsnit.+(\d{1,3})

2. Because these values with the () at the end seem to be unique I would check with sub but I would consider setting the unique_id to the original title for these rows to avoid duplicates

3. If the subtitle is #:# I would parse it further to zero pad the first number so that 10 shows after 2

Martin

There is definately room for improvement. Those changes would not be so bad to add. At least now it will record as it used to be. Now we can live with it. The rest is just as you say seeking perfection. I am not sure that the season & episodes are that simple. I have seen several ways this has been implemented. I might need to get a bit creative there. 

Torben
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 53,119
Threads: 957
Joined: May 2006
#26
2020-09-16, 06:32 PM (This post was last modified: 2020-09-16, 06:32 PM by mvallevand.)
Here to get your creative blood stirring

Code:
import sqlite3
import re

def regexp(item):
    return reg.search(item) is not None

def regexp1(item):
    return reg.search(item)[0]

def regexp2(item):
    retval = ""
    m = reg1.search(item)
    if m:
        retval = m.groups()[0]
    return  retval

def regexp3(item):
    retval = ""
    m = reg1.search(item)
    if m:
        retval = m.groups()[1]
    return  retval

conn = sqlite3.connect('npvr.db3')
conn.create_function("ISBRACKET", 1, regexp)
conn.create_function("BRACKETS", 1, regexp1)
conn.create_function("SEASON", 1, regexp2)
conn.create_function("EPISODE", 1, regexp3)

reg = re.compile(r' \([\d:]+\)$')
reg1 = re.compile(r'Sæson.+?(\d{1,2}).+?Afsnit.+?(\d{1,3})')
cursor = conn.cursor()
cursor.execute('update epg_event \
    set title = replace (title, BRACKETS(title),""), \
    subtitle = trim(BRACKETS(title)) \
    WHERE ISBRACKET(title)')
conn.commit()

cursor.execute('update epg_event \
    set season = SEASON(description), \
    episode = EPISODE(description)')
conn.commit()
tjuhl
Offline

Junior Member

Denmark
Posts: 25
Threads: 2
Joined: Sep 2020
#27
2020-09-16, 08:44 PM
(2020-09-16, 06:32 PM)mvallevand Wrote: Here to get your creative blood stirring

Code:
import sqlite3
import re

def regexp(item):
    return reg.search(item) is not None

def regexp1(item):
    return reg.search(item)[0]

def regexp2(item):
    retval = ""
    m = reg1.search(item)
    if m:
        retval = m.groups()[0]
    return  retval

def regexp3(item):
    retval = ""
    m = reg1.search(item)
    if m:
        retval = m.groups()[1]
    return  retval

conn = sqlite3.connect('npvr.db3')
conn.create_function("ISBRACKET", 1, regexp)
conn.create_function("BRACKETS", 1, regexp1)
conn.create_function("SEASON", 1, regexp2)
conn.create_function("EPISODE", 1, regexp3)

reg = re.compile(r' \([\d:]+\)$')
reg1 = re.compile(r'Sæson.+?(\d{1,2}).+?Afsnit.+?(\d{1,3})')
cursor = conn.cursor()
cursor.execute('update epg_event \
    set title = replace (title, BRACKETS(title),""), \
    subtitle = trim(BRACKETS(title)) \
    WHERE ISBRACKET(title)')
conn.commit()

cursor.execute('update epg_event \
    set season = SEASON(description), \
    episode = EPISODE(description)')
conn.commit()

Big Grin  I was just about to update the thread with the changes I made. You beat me to it!! 

I did another change:

Code:
def getpaddedbracket(item):
    return '(' + reg.search(item)[1].zfill(2) + ':' + reg.search(item)[2].zfill(2) + ')'

...

conn.create_function("PADDEDBRACKETS", 1, getpaddedbracket)

and finally set the subtitle to:

Code:
    subtitle = trim(PADDEDBRACKETS(title)) \

Now I got the zero padded episode#:Total # of episodes, like you mentioned. 

This is actually quite fun!!!

Cheers,

Torben
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 53,119
Threads: 957
Joined: May 2006
#28
2020-09-16, 09:10 PM (This post was last modified: 2020-09-16, 09:11 PM by mvallevand.)
Yes it is fun, or I would have just said use Schedules Direct. Its' good to show the power of python, regex, and sqlite too.

I wouldn't bother padding the right side (here it can be over 100) or the left side if it the same size as the right unless you specifically like zeroes ie 05:09

Martin
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (3): « Previous 1 2 3


Possibly Related Threads…
Thread Author Replies Views Last Post
  Recording Glitches - Debug Advice? andrewj 7 302 2025-06-23, 08:19 PM
Last Post: mvallevand
  Advanced Recording Scheduling question Bobins 7 282 2025-06-17, 12:56 AM
Last Post: mvallevand
  "Recording interrupted" problem started happening sharkbite 8 640 2025-06-02, 08:08 AM
Last Post: sharkbite
  Series Recordings - Bug? MalcolmInman 32 1,350 2025-05-31, 01:52 AM
Last Post: mvallevand
  Failed: Recording interrupted jzk 3 470 2025-04-18, 09:06 PM
Last Post: mvallevand
  Unable to delete recording. File may be in use. seattlefog 24 1,235 2025-04-13, 01:08 AM
Last Post: sub
  Directory not deleted after recording deleted Bobins 13 1,066 2025-03-08, 05:30 PM
Last Post: sub
  Recording IPTV lemmy999 8 798 2025-03-02, 06:13 PM
Last Post: lemmy999
  Temporarily Suspend Recording andrewj 1 293 2025-02-25, 12:44 PM
Last Post: mvallevand
  Series recording doesn't have cancel series markn62 9 2,528 2025-02-22, 09:24 PM
Last Post: jcole998

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode