Changeset 7145


Ignore:
Timestamp:
Apr 12, 2011, 8:57:45 PM (15 years ago)
Author:
madie
Message:

[ipk] update mediathek to v2.8

Location:
ipk/source
Files:
2 edited
2 moved

Legend:

Unmodified
Added
Removed
  • ipk/source/mediacenter_mediathek_2_8/usr/lib/enigma2/python/Plugins/Extensions/MultiMediathek/plugin.py

    r7056 r7145  
    33# Coded by Homey (c) 2011
    44#
    5 # Version: 2.7
     5# Version: 2.8.2
    66# Support: www.i-have-a-dreambox.com
    77#####################################################
     
    3232
    3333from enigma import ePicLoad, eTimer, getDesktop, eConsoleAppContainer, eBackgroundFileEraser, eServiceReference, iServiceInformation, iPlayableService
    34 from os import stat as os_stat, listdir as os_listdir, path as os_path, system as os_system
     34from os import stat as os_stat, listdir as os_listdir, path as os_path, readlink as os_readlink, system as os_system
    3535from time import time
    3636from twisted.web.client import getPage, downloadPage
     
    5858config.plugins.multimediathek.imagecache = ConfigEnableDisable(default=True)
    5959config.plugins.multimediathek.imagescaling = ConfigSelection(default="1", choices = [("0", _("simple")), ("1", _("better"))])
     60config.plugins.multimediathek.imagescaler = ConfigSelection(default="0", choices = [("0", _("decodePic()")), ("1", _("getThumbnail()"))])
    6061config.plugins.multimediathek.showadultcontent = ConfigYesNo(default=False)
    6162config.plugins.multimediathek.showsecretcontent = ConfigYesNo(default=False)
    62 config.plugins.multimediathek.checkforupdate = ConfigYesNo(default=False)
    63 config.plugins.multimediathek.version = NoSave(ConfigText(default="270"))
     63config.plugins.multimediathek.version = NoSave(ConfigText(default="282"))
     64
     65default = config.plugins.multimediathek.storagepath.value + "/mediathek/movies"
     66tmp = config.movielist.videodirs.value
     67if default not in tmp:
     68        tmp.append(default)
     69config.plugins.multimediathek.moviedir = ConfigSelection(default=default, choices=tmp)
    6470
    6571#################################
     
    7076        def __init__(self, toolbox, cmdline, filename, filetitle):
    7177                Job.__init__(self, _("Download Movie"))
     78                self.filename = filename
    7279                self.toolbox = toolbox
    7380                self.retrycount = 0
     
    7885                self.retrycount += 1
    7986                self.restart()
    80        
     87
     88        def cancel(self):
     89                self.abort()
     90                os_system("rm -f %s" % self.filename)
     91               
    8192class downloadTask(Task):
    8293        ERROR_CORRUPT_FILE, ERROR_RTMP_ReadPacket, ERROR_SEGFAULT, ERROR_SERVER, ERROR_UNKNOWN = range(5)
     
    246257                self.textcolor = "#F7F7F7"
    247258                self.bgcolor = "#000000"
    248                 textsize = 20
     259                self.textsize = 20
    249260
    250261                # Create Thumblist
     
    266277                        absY = self.spaceTop + self.spaceY + (posY*(self.spaceY + self.picY))
    267278                        self.positionlist.append((absX, absY))
    268                         skincontent += "<widget source=\"label" + str(x) + "\" render=\"Label\" position=\"" + str(absX+2) + "," + str(absY+self.picY-textsize-10) + "\" size=\"" + str(self.picX - 10) + ","  + str((textsize*2)+10) + "\" halign=\"center\" font=\"Regular;" + str(textsize) + "\" zPosition=\"4\" transparent=\"1\" foregroundColor=\"" + self.textcolor + "\" />"
    269                         skincontent += "<widget name=\"thumb" + str(x) + "\" position=\"" + str(absX)+ "," + str(absY+5) + "\" size=\"" + str(self.picX -10) + "," + str(self.picY - (textsize*2)) + "\" zPosition=\"4\" transparent=\"1\" alphatest=\"on\" />"
     279                        skincontent += "<widget source=\"label" + str(x) + "\" render=\"Label\" position=\"" + str(absX+2) + "," + str(absY+self.picY-self.textsize-10) + "\" size=\"" + str(self.picX - 10) + ","  + str((self.textsize*2)+10) + "\" halign=\"center\" font=\"Regular;" + str(self.textsize) + "\" zPosition=\"4\" transparent=\"1\" foregroundColor=\"" + self.textcolor + "\" />"
     280                        skincontent += "<widget name=\"thumb" + str(x) + "\" position=\"" + str(absX)+ "," + str(absY+5) + "\" size=\"" + str(self.picX -10) + "," + str(self.picY - (self.textsize*2)) + "\" zPosition=\"4\" transparent=\"1\" alphatest=\"on\" />"
    270281
    271282                # Screen, backgroundlabel and MovingPixmap
     
    315326                self.picload = ePicLoad()
    316327                self.picload.PictureData.get().append(self.showThumbPixmap)
    317                 self.picload.setPara((self.picX-10, self.picY-(textsize*2), sc[0], sc[1], config.plugins.multimediathek.imagecache.value, int(config.plugins.multimediathek.imagescaling.value), "#00000000"))
     328                self.picload.setPara((self.picX-10, self.picY-(self.textsize*2), sc[0], sc[1], config.plugins.multimediathek.imagecache.value, int(config.plugins.multimediathek.imagescaling.value), "#00000000"))
    318329
    319330                # Init eBackgroundFileEraser
     
    321332
    322333                # Check if plugin-update is available
    323                 if self.feedtitle == "Startseite" and config.plugins.multimediathek.checkforupdate.value:
     334                if self.feedtitle == "Startseite":
    324335                        self.onLayoutFinish.append(self.checkforupdate)
    325336
     
    339350                # Check if cache folder is on a mountable device and not inside flash-memory
    340351                tmppath = config.plugins.multimediathek.storagepath.value
    341                 while not os_path.ismount(tmppath):
    342                         tmppath = os_path.dirname(tmppath)
    343                         if tmppath == "/":
    344                                 self["pageinfo"].setText(_("Error: Can not create cache-folders inside flash memory. Check your Cache-Folder Settings!"))
    345                                 return False
     352                if tmppath != "/tmp" and tmppath != "/media/ba":
     353                        if os_path.islink(tmppath):
     354                                tmppath = os_readlink(tmppath)
     355                        loopcount = 0
     356                        while not os_path.ismount(tmppath):
     357                                loopcount += 1
     358                                tmppath = os_path.dirname(tmppath)
     359                                if tmppath == "/" or tmppath == "" or loopcount > 50:
     360                                        self["pageinfo"].setText(_("Error: Can not create cache-folders inside flash memory. Check your Cache-Folder Settings!"))
     361                                        return False
    346362
    347363                # Create Cache Folders ...
     
    399415                        getpageurl = unquote(tmpurls[1])
    400416                        self.postpageurl = unquote(tmpurls[0])
    401                         getPage(getpageurl).addCallback(self.ForwardExternalPage).addErrback(self.getxmlfeedError)
     417                        getPage(getpageurl, agent="Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)").addCallback(self.ForwardExternalPage).addErrback(self.getxmlfeedError)
    402418                else:
    403419                        getPage(feedurl).addCallback(self.gotxmlfeed).addErrback(self.getxmlfeedError)
     
    409425        def getxmlfeedError(self, error=""):
    410426                self["pageinfo"].setText("Error downloading XML Feed!\n\n" + str(error))
    411 
     427                print error
     428               
    412429        def gotxmlfeed(self, page=""):
     430                print page
    413431                self["pageinfo"].setText("Parsing XML Feeds ...")
    414432                xml = parseString(page)
     
    502520
    503521        def gotThumbnail(self, data=""):
    504                 self.picload.startDecode(self.thumbfile)
    505 
     522                if config.plugins.multimediathek.imagescaler.value == "0":
     523                        self.picload.startDecode(self.thumbfile)
     524                elif self.picload.getThumbnail(self.thumbfile) == 1:
     525                        if self.thumbcount+1 < len(self.Thumbnaillist):
     526                                self.getThumbnail()
     527               
    506528        def showThumbPixmap(self, picInfo=None):
    507529                ptr = self.picload.getData()
     
    698720                config.mediaplayer.save()
    699721
    700                 self.moviefolder = config.plugins.multimediathek.storagepath.value+"/mediathek/movies"
     722                self.moviefolder = config.plugins.multimediathek.moviedir.value
    701723                self.imagefolder = config.plugins.multimediathek.storagepath.value+"/mediathek/images"
    702724
     
    744766                                getpageurl = unquote(tmpurls[1])
    745767                                self.postpageurl = unquote(tmpurls[0])
    746                                 getPage(getpageurl).addCallback(self.ForwardExternalPage).addErrback(self.error)
     768                                getPage(getpageurl, agent="Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)").addCallback(self.ForwardExternalPage).addErrback(self.error)
    747769                        else:
    748770                                getPage(self.url).addCallback(self.GotMovieInfo).addErrback(self.error)
     
    790812                                getpageurl = tmpurls[1]
    791813                                self.postpageurl = tmpurls[0]
    792                                 getPage(getpageurl).addCallback(self.ForwardExternalMovieList).addErrback(self.error)
     814                                getPage(getpageurl, agent="Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)").addCallback(self.ForwardExternalMovieList).addErrback(self.error)
    793815                        else:
    794816                                getPage(self.movieinfo[1]).addCallback(self.GotMovieList).addErrback(self.error)
     
    860882                                getpageurl = tmpurls[1]
    861883                                self.postpageurl = tmpurls[0]
    862                                 getPage(getpageurl).addCallback(self.ForwardExternalMovieList).addErrback(self.error)
     884                                getPage(getpageurl, agent="Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)").addCallback(self.ForwardExternalMovieList).addErrback(self.error)
    863885                                return
    864886                       
     
    13311353                self.cfglist.append(getConfigListEntry(_("Thumbnail Caching:"), config.plugins.multimediathek.imagecache))
    13321354                self.cfglist.append(getConfigListEntry(_("Thumbnail Scaling Mode:"), config.plugins.multimediathek.imagescaling))
     1355                self.cfglist.append(getConfigListEntry(_("Thumbnail Scaler:"), config.plugins.multimediathek.imagescaler))
    13331356                self.cfglist.append(getConfigListEntry(_("Show Adult Content:"), config.plugins.multimediathek.showadultcontent))
    13341357                #self.cfglist.append(getConfigListEntry(_("Show Secret Content:"), config.plugins.multimediathek.showsecretcontent))
     1358                self.cfglist.append(getConfigListEntry(_("Download Directory:"), config.plugins.multimediathek.moviedir))
    13351359                self.cfglist.append(getConfigListEntry(_("Cache Folder:"), config.plugins.multimediathek.storagepath))
    1336                 self.cfglist.append(getConfigListEntry(_("Check for updates:"), config.plugins.multimediathek.checkforupdate))
    13371360                ConfigListScreen.__init__(self, self.cfglist, session)
    13381361
  • ipk/source/swapmediacenter_mediathek_2_8/var/swap/extensions/MultiMediathek/plugin.py

    r7057 r7145  
    33# Coded by Homey (c) 2011
    44#
    5 # Version: 2.7
     5# Version: 2.8.2
    66# Support: www.i-have-a-dreambox.com
    77#####################################################
     
    3232
    3333from enigma import ePicLoad, eTimer, getDesktop, eConsoleAppContainer, eBackgroundFileEraser, eServiceReference, iServiceInformation, iPlayableService
    34 from os import stat as os_stat, listdir as os_listdir, path as os_path, system as os_system
     34from os import stat as os_stat, listdir as os_listdir, path as os_path, readlink as os_readlink, system as os_system
    3535from time import time
    3636from twisted.web.client import getPage, downloadPage
     
    5858config.plugins.multimediathek.imagecache = ConfigEnableDisable(default=True)
    5959config.plugins.multimediathek.imagescaling = ConfigSelection(default="1", choices = [("0", _("simple")), ("1", _("better"))])
     60config.plugins.multimediathek.imagescaler = ConfigSelection(default="0", choices = [("0", _("decodePic()")), ("1", _("getThumbnail()"))])
    6061config.plugins.multimediathek.showadultcontent = ConfigYesNo(default=False)
    6162config.plugins.multimediathek.showsecretcontent = ConfigYesNo(default=False)
    62 config.plugins.multimediathek.checkforupdate = ConfigYesNo(default=False)
    63 config.plugins.multimediathek.version = NoSave(ConfigText(default="270"))
     63config.plugins.multimediathek.version = NoSave(ConfigText(default="282"))
     64
     65default = config.plugins.multimediathek.storagepath.value + "/mediathek/movies"
     66tmp = config.movielist.videodirs.value
     67if default not in tmp:
     68        tmp.append(default)
     69config.plugins.multimediathek.moviedir = ConfigSelection(default=default, choices=tmp)
    6470
    6571#################################
     
    7076        def __init__(self, toolbox, cmdline, filename, filetitle):
    7177                Job.__init__(self, _("Download Movie"))
     78                self.filename = filename
    7279                self.toolbox = toolbox
    7380                self.retrycount = 0
     
    7885                self.retrycount += 1
    7986                self.restart()
    80        
     87
     88        def cancel(self):
     89                self.abort()
     90                os_system("rm -f %s" % self.filename)
     91               
    8192class downloadTask(Task):
    8293        ERROR_CORRUPT_FILE, ERROR_RTMP_ReadPacket, ERROR_SEGFAULT, ERROR_SERVER, ERROR_UNKNOWN = range(5)
     
    246257                self.textcolor = "#F7F7F7"
    247258                self.bgcolor = "#000000"
    248                 textsize = 20
     259                self.textsize = 20
    249260
    250261                # Create Thumblist
     
    266277                        absY = self.spaceTop + self.spaceY + (posY*(self.spaceY + self.picY))
    267278                        self.positionlist.append((absX, absY))
    268                         skincontent += "<widget source=\"label" + str(x) + "\" render=\"Label\" position=\"" + str(absX+2) + "," + str(absY+self.picY-textsize-10) + "\" size=\"" + str(self.picX - 10) + ","  + str((textsize*2)+10) + "\" halign=\"center\" font=\"Regular;" + str(textsize) + "\" zPosition=\"4\" transparent=\"1\" foregroundColor=\"" + self.textcolor + "\" />"
    269                         skincontent += "<widget name=\"thumb" + str(x) + "\" position=\"" + str(absX)+ "," + str(absY+5) + "\" size=\"" + str(self.picX -10) + "," + str(self.picY - (textsize*2)) + "\" zPosition=\"4\" transparent=\"1\" alphatest=\"on\" />"
     279                        skincontent += "<widget source=\"label" + str(x) + "\" render=\"Label\" position=\"" + str(absX+2) + "," + str(absY+self.picY-self.textsize-10) + "\" size=\"" + str(self.picX - 10) + ","  + str((self.textsize*2)+10) + "\" halign=\"center\" font=\"Regular;" + str(self.textsize) + "\" zPosition=\"4\" transparent=\"1\" foregroundColor=\"" + self.textcolor + "\" />"
     280                        skincontent += "<widget name=\"thumb" + str(x) + "\" position=\"" + str(absX)+ "," + str(absY+5) + "\" size=\"" + str(self.picX -10) + "," + str(self.picY - (self.textsize*2)) + "\" zPosition=\"4\" transparent=\"1\" alphatest=\"on\" />"
    270281
    271282                # Screen, backgroundlabel and MovingPixmap
     
    315326                self.picload = ePicLoad()
    316327                self.picload.PictureData.get().append(self.showThumbPixmap)
    317                 self.picload.setPara((self.picX-10, self.picY-(textsize*2), sc[0], sc[1], config.plugins.multimediathek.imagecache.value, int(config.plugins.multimediathek.imagescaling.value), "#00000000"))
     328                self.picload.setPara((self.picX-10, self.picY-(self.textsize*2), sc[0], sc[1], config.plugins.multimediathek.imagecache.value, int(config.plugins.multimediathek.imagescaling.value), "#00000000"))
    318329
    319330                # Init eBackgroundFileEraser
     
    321332
    322333                # Check if plugin-update is available
    323                 if self.feedtitle == "Startseite" and config.plugins.multimediathek.checkforupdate.value:
     334                if self.feedtitle == "Startseite":
    324335                        self.onLayoutFinish.append(self.checkforupdate)
    325336
     
    339350                # Check if cache folder is on a mountable device and not inside flash-memory
    340351                tmppath = config.plugins.multimediathek.storagepath.value
    341                 while not os_path.ismount(tmppath):
    342                         tmppath = os_path.dirname(tmppath)
    343                         if tmppath == "/":
    344                                 self["pageinfo"].setText(_("Error: Can not create cache-folders inside flash memory. Check your Cache-Folder Settings!"))
    345                                 return False
     352                if tmppath != "/tmp" and tmppath != "/media/ba":
     353                        if os_path.islink(tmppath):
     354                                tmppath = os_readlink(tmppath)
     355                        loopcount = 0
     356                        while not os_path.ismount(tmppath):
     357                                loopcount += 1
     358                                tmppath = os_path.dirname(tmppath)
     359                                if tmppath == "/" or tmppath == "" or loopcount > 50:
     360                                        self["pageinfo"].setText(_("Error: Can not create cache-folders inside flash memory. Check your Cache-Folder Settings!"))
     361                                        return False
    346362
    347363                # Create Cache Folders ...
     
    399415                        getpageurl = unquote(tmpurls[1])
    400416                        self.postpageurl = unquote(tmpurls[0])
    401                         getPage(getpageurl).addCallback(self.ForwardExternalPage).addErrback(self.getxmlfeedError)
     417                        getPage(getpageurl, agent="Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)").addCallback(self.ForwardExternalPage).addErrback(self.getxmlfeedError)
    402418                else:
    403419                        getPage(feedurl).addCallback(self.gotxmlfeed).addErrback(self.getxmlfeedError)
     
    409425        def getxmlfeedError(self, error=""):
    410426                self["pageinfo"].setText("Error downloading XML Feed!\n\n" + str(error))
    411 
     427                print error
     428               
    412429        def gotxmlfeed(self, page=""):
     430                print page
    413431                self["pageinfo"].setText("Parsing XML Feeds ...")
    414432                xml = parseString(page)
     
    502520
    503521        def gotThumbnail(self, data=""):
    504                 self.picload.startDecode(self.thumbfile)
    505 
     522                if config.plugins.multimediathek.imagescaler.value == "0":
     523                        self.picload.startDecode(self.thumbfile)
     524                elif self.picload.getThumbnail(self.thumbfile) == 1:
     525                        if self.thumbcount+1 < len(self.Thumbnaillist):
     526                                self.getThumbnail()
     527               
    506528        def showThumbPixmap(self, picInfo=None):
    507529                ptr = self.picload.getData()
     
    698720                config.mediaplayer.save()
    699721
    700                 self.moviefolder = config.plugins.multimediathek.storagepath.value+"/mediathek/movies"
     722                self.moviefolder = config.plugins.multimediathek.moviedir.value
    701723                self.imagefolder = config.plugins.multimediathek.storagepath.value+"/mediathek/images"
    702724
     
    744766                                getpageurl = unquote(tmpurls[1])
    745767                                self.postpageurl = unquote(tmpurls[0])
    746                                 getPage(getpageurl).addCallback(self.ForwardExternalPage).addErrback(self.error)
     768                                getPage(getpageurl, agent="Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)").addCallback(self.ForwardExternalPage).addErrback(self.error)
    747769                        else:
    748770                                getPage(self.url).addCallback(self.GotMovieInfo).addErrback(self.error)
     
    790812                                getpageurl = tmpurls[1]
    791813                                self.postpageurl = tmpurls[0]
    792                                 getPage(getpageurl).addCallback(self.ForwardExternalMovieList).addErrback(self.error)
     814                                getPage(getpageurl, agent="Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)").addCallback(self.ForwardExternalMovieList).addErrback(self.error)
    793815                        else:
    794816                                getPage(self.movieinfo[1]).addCallback(self.GotMovieList).addErrback(self.error)
     
    860882                                getpageurl = tmpurls[1]
    861883                                self.postpageurl = tmpurls[0]
    862                                 getPage(getpageurl).addCallback(self.ForwardExternalMovieList).addErrback(self.error)
     884                                getPage(getpageurl, agent="Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)").addCallback(self.ForwardExternalMovieList).addErrback(self.error)
    863885                                return
    864886                       
     
    13311353                self.cfglist.append(getConfigListEntry(_("Thumbnail Caching:"), config.plugins.multimediathek.imagecache))
    13321354                self.cfglist.append(getConfigListEntry(_("Thumbnail Scaling Mode:"), config.plugins.multimediathek.imagescaling))
     1355                self.cfglist.append(getConfigListEntry(_("Thumbnail Scaler:"), config.plugins.multimediathek.imagescaler))
    13331356                self.cfglist.append(getConfigListEntry(_("Show Adult Content:"), config.plugins.multimediathek.showadultcontent))
    13341357                #self.cfglist.append(getConfigListEntry(_("Show Secret Content:"), config.plugins.multimediathek.showsecretcontent))
     1358                self.cfglist.append(getConfigListEntry(_("Download Directory:"), config.plugins.multimediathek.moviedir))
    13351359                self.cfglist.append(getConfigListEntry(_("Cache Folder:"), config.plugins.multimediathek.storagepath))
    1336                 self.cfglist.append(getConfigListEntry(_("Check for updates:"), config.plugins.multimediathek.checkforupdate))
    13371360                ConfigListScreen.__init__(self, self.cfglist, session)
    13381361
Note: See TracChangeset for help on using the changeset viewer.