Script to fix SXXEPXX XML to EMBY

One of the users wrote a script for me that fixes the season and episodes when usng Channels DVR XML in EMBY ...

#!/usr/bin/env python3
import requests 

URL = ""

tve_xml = requests.get(URL)

xmlOutput = "C:/temp/xmltv_ns.xml"

with open(xmlOutput,"w", encoding="utf8") as fileOut:
    for line in tve_xml.text.splitlines():
        if '<episode-num system="onscreen">' in line:
            season_episode = line.replace('<episode-num system="onscreen">','').replace('</episode-num>','')
            if "S" in season_episode:
                season = ((season_episode.split('S'))[1].split('E'))[0]
                episode = ((season_episode.split('S'))[1].split('E'))[1]
                fileOut.write('    <episode-num system="xmltv_ns">' + str(int(season)-1) + '.' + str(int(episode)-1) + '.</episode-num>\n')

This appears to have been added to XML ... Thanks Developers ...

<episode-num system="xmltv_ns">24.55.</episode-num>
1 Like