Example #1
0
def generatefiles(idd, name):
    url = "https://www.dmax.de/api/show-detail/" + str(idd)
    debug("generatefiles :" + url)
    content = geturl(url)
    try:
        struktur = json.loads(content)
    except:
        return
    mediapath = addon.getSetting("mediapath")
    ppath = mediapath + name.replace(" ", "_").replace(":", "_")
    debug(ppath)
    if os.path.isdir(ppath):
        shutil.rmtree(ppath)
    os.mkdir(ppath)
    serie = struktur["show"]["name"]
    subelement = struktur["videos"]["episode"]
    for number, videos in subelement.iteritems():
        for video in videos:
            idd = video["id"]
            debug("IDD VIDEO :" + str(idd))
            title = video["title"]
            title = title.replace("{S}", "S").replace(".{E}", "E")
            desc = video["description"]
            duration = video["videoDuration"]
            duration = duration / 1000
            image = video["image"]["src"]
            airdate = video["airDate"]
            season = video["season"]
            episode = video["episode"]
            namef = goldfinch.validFileName(title)
            #debug(namef)
            filename = os.path.join(ppath, namef + ".strm")
            #debug(filename)
            file = open(filename, "wt")
            file.write("plugin://plugin.video.L0RE.dmax/?mode=playvideo&url=" +
                       str(idd))
            file.close()
            nfostring = """
          <tvshow>
            <title>%s</title>
            <season>%s</season>
            <episode>%s</episode>
            <showtitle>%s</showtitle>
            <plot>%s</plot>
            <runtime>%s</runtime>
            <thumb aspect="" type="" season="">%s</thumb>            
            <aired>%s</aired>            
          </tvshow>"""
            nfostring = nfostring % (
                title.encode("utf-8"), str(season).encode("utf-8"),
                str(episode), serie.encode("utf-8"), desc.encode("utf-8"),
                str(duration), image.encode("utf-8"), airdate.encode("utf-8"))
            nfofile = os.path.join(ppath, namef + ".nfo")
            file = xbmcvfs.File(nfofile, "w")
            file.write(nfostring)
            file.close()
    xbmcplugin.endOfDirectory(addon_handle,
                              succeeded=True,
                              updateListing=False,
                              cacheToDisc=True)
Example #2
0
    def name(self, value):
        """Name property of an file and derives basename and extension \
                properties from this name

        """
        self._name = validFileName(value, initCap=False).decode('utf8')
        _file_name = self._name
        if _file_name.rfind(os.path.sep) >= 0:
            _file_name = _file_name[(_file_name.rindex(os.path.sep) + 1):]
        if _file_name.rfind('.') >= 0:
            self._base_name = _file_name[0:_file_name.rindex('.')]
            self._ext = _file_name[(_file_name.rindex('.') + 1):]
        else:
            self._base_name = _file_name
            self._ext = None
Example #3
0
def generatefiles(idd, name):
    url = "https://www.dmax.de/api/show-detail/" + str(idd)
    debug("generatefiles :" + url)
    content = geturl(url)
    try:
        struktur = json.loads(content)
    except:
        return
    mediapath = addon.getSetting("mediapath")
    ppath = mediapath + name.replace(" ", "_").replace(":", "_")
    debug(ppath)
    if os.path.isdir(ppath):
        shutil.rmtree(ppath)
    os.mkdir(ppath)
    subelement = struktur["videos"]["episode"]
    for number, videos in subelement.iteritems():
        for video in videos:
            idd = video["id"]
            debug("IDD VIDEO :" + str(idd))
            title = video["title"]
            title = title.replace("{S}", "S").replace(".{E}", "E")
            desc = video["description"]
            duration = video["videoDuration"]
            duration = duration / 1000
            image = video["image"]["src"]
            airdate = video["airDate"]
            namef = goldfinch.validFileName(title)
            #debug(namef)
            filename = os.path.join(ppath, namef + ".strm")
            #debug(filename)
            file = open(filename, "wt")
            file.write("plugin://plugin.video.L0RE.dmax/?mode=playvideo&url=" +
                       str(idd))
            file.close()
    xbmcplugin.endOfDirectory(addon_handle,
                              succeeded=True,
                              updateListing=False,
                              cacheToDisc=True)
Example #4
0
    def name(self, value):
        """Name property of a directory

        """
        self._name = validFileName(value, initCap=False).decode('utf8')
Example #5
0
 def name(self, value):
     self._name = validFileName(value, initCap=False).decode('utf8')
Example #6
0
def convert_names(x):
    '''helper function to create valid player names for files later'''
    x = str(x)
    x = validFileName(x)
    return x
Example #7
0
 def fset(self, value):
     self._name = validFileName(value, initCap=False).decode() if type(
         validFileName(value, initCap=False)) != str else validFileName(
             value, initCap=False)
     self._base_name = value[0:value.rindex('.')]
     self._ext = value[(value.rindex('.') + 1):]