def buildMovieListEntry(self, serviceref, info, begin, data):
        width = self.l.getItemSize().width()
        iconSize = self.iconsWidth
        space = self.spaceIconeText
        r = self.spaceRight
        pathName = serviceref.getPath()
        res = [None]

        if serviceref.flags & eServiceReference.mustDescent:
            # Directory
            # Name is full path name
            valign_center = 0
            if self.list_type == MovieList.LISTTYPE_MINIMAL:
                valign_center = RT_VALIGN_CENTER
            x = iconSize + space
            tn = self.treeDescription
            if info is None:
                # Special case: "parent"
                txt = ".."
            else:
                p = os.path.split(pathName)
                if not p[1]:
                    # if path ends in '/', p is blank.
                    p = os.path.split(p[0])
                txt = p[1]
                if txt == ".Trash":
                    res.append(
                        MultiContentEntryPixmapAlphaTest(
                            pos=(0, self.trashShift),
                            size=(iconSize, self.iconTrash.size().height()),
                            png=self.iconTrash))
                    res.append(
                        MultiContentEntryText(
                            pos=(x, 0),
                            size=(width - x - tn - r, self.itemHeight),
                            font=0,
                            flags=RT_HALIGN_LEFT | valign_center,
                            text=_("Deleted items")))
                    res.append(
                        MultiContentEntryText(pos=(width - tn - r, 0),
                                              size=(tn, self.itemHeight),
                                              font=1,
                                              flags=RT_HALIGN_RIGHT
                                              | valign_center,
                                              text=_("Trash can")))
                    return res
            res.append(
                MultiContentEntryPixmapAlphaTest(pos=(0, self.dirShift),
                                                 size=(iconSize, iconSize),
                                                 png=self.iconFolder))
            res.append(
                MultiContentEntryText(pos=(x, 0),
                                      size=(width - x - tn - r,
                                            self.itemHeight),
                                      font=0,
                                      flags=RT_HALIGN_LEFT | valign_center,
                                      text=txt))
            res.append(
                MultiContentEntryText(pos=(width - tn - r, 0),
                                      size=(tn, self.itemHeight),
                                      font=1,
                                      flags=RT_HALIGN_RIGHT | valign_center,
                                      text=_("Directory")))
            return res
        if (data == -1) or (data is None):
            data = MovieListData()
            cur_idx = self.l.getCurrentSelectionIndex()
            x = self.list[cur_idx]  # x = ref,info,begin,...
            if config.usage.load_length_of_movies_in_moviellist.value:
                data.len = x[1].getLength(x[0])  #recalc the movie length...
            else:
                data.len = 0  #dont recalc movielist to speedup loading the list
            self.list[cur_idx] = (
                x[0], x[1], x[2], data
            )  #update entry in list... so next time we don't need to recalc
            data.txt = info.getName(serviceref)
            if config.movielist.hide_extensions.value:
                fileName, fileExtension = os.path.splitext(data.txt)
                if fileExtension in KNOWN_EXTENSIONS:
                    data.txt = fileName
            data.icon = None
            data.part = None
            if os.path.split(pathName)[1] in self.runningTimers:
                if self.playInBackground and serviceref == self.playInBackground:
                    data.icon = self.iconMoviePlayRec
                else:
                    data.icon = self.iconMovieRec
            elif self.playInBackground and serviceref == self.playInBackground:
                data.icon = self.iconMoviePlay
            else:
                switch = config.usage.show_icons_in_movielist.value
                data.part = moviePlayState(pathName + '.cuts', serviceref,
                                           data.len)
                if switch == 'i':
                    if data.part is None:
                        if config.usage.movielist_unseen.value:
                            data.icon = self.iconUnwatched
                    else:
                        data.icon = self.iconPart[data.part // 25]
                elif switch == 'p' or switch == 's':
                    if data.part is None:
                        if config.usage.movielist_unseen.value:
                            data.part = 0
                        data.partcol = 0x808080
                    else:
                        data.partcol = 0xf0f0f0
            service = ServiceReference(
                info.getInfoString(serviceref,
                                   iServiceInformation.sServiceref))
            if service is None:
                data.serviceName = None
            else:
                data.serviceName = service.getServiceName()
            data.description = info.getInfoString(
                serviceref, iServiceInformation.sDescription)

        len = data.len
        if len > 0:
            len = "%d:%02d" % (len / 60, len % 60)
        else:
            len = ""

        if data.icon is not None:
            if self.list_type in (MovieList.LISTTYPE_COMPACT_DESCRIPTION,
                                  MovieList.LISTTYPE_COMPACT):
                pos = (0, self.partIconeShiftCompact)
            elif self.list_type == MovieList.LISTTYPE_ORIGINAL:
                pos = (0, self.partIconeShiftOriginal)
            else:
                pos = (0, self.partIconeShiftMinimal)
            res.append(
                MultiContentEntryPixmapAlphaTest(
                    pos=pos,
                    size=(iconSize, data.icon.size().height()),
                    png=data.icon))
        switch = config.usage.show_icons_in_movielist.value
        if switch in ('p', 's'):
            if switch == 'p':
                iconSize = self.pbarLargeWidth
            if data.part is not None:
                res.append(
                    MultiContentEntryProgress(pos=(0, self.pbarShift),
                                              size=(iconSize, self.pbarHeight),
                                              percent=data.part,
                                              borderWidth=2,
                                              foreColor=data.partcol,
                                              foreColorSelected=None,
                                              backColor=None,
                                              backColorSelected=None))
        elif switch == 'i':
            pass
        else:
            iconSize = 0

        begin_string = ""
        if begin > 0:
            if config.movielist.use_fuzzy_dates.value:
                begin_string = ', '.join(FuzzyTime(begin, inPast=True))
            else:
                begin_string = strftime(
                    "%s, %s" % (config.usage.date.daylong.value,
                                config.usage.time.short.value),
                    localtime(begin))

        ih = self.itemHeight
        if self.list_type == MovieList.LISTTYPE_ORIGINAL:
            fc, sc = self.columnsOriginal[0], self.columnsOriginal[1]
            ih1 = (ih * 2) / 5  # 75 -> 30
            ih2 = (ih * 2) / 3  # 75 -> 50
            res.append(
                MultiContentEntryText(pos=(iconSize + space, 0),
                                      size=(width - fc - r, ih1),
                                      font=0,
                                      flags=RT_HALIGN_LEFT,
                                      text=data.txt))
            if self.tags:
                res.append(
                    MultiContentEntryText(pos=(width - fc - r, 0),
                                          size=(fc, ih1),
                                          font=2,
                                          flags=RT_HALIGN_RIGHT,
                                          text=info.getInfoString(
                                              serviceref,
                                              iServiceInformation.sTags)))
                if data.serviceName:
                    res.append(
                        MultiContentEntryText(pos=(sc - r, ih2),
                                              size=(sc, ih2 - ih1),
                                              font=1,
                                              flags=RT_HALIGN_LEFT,
                                              text=data.serviceName))
            else:
                if data.serviceName:
                    res.append(
                        MultiContentEntryText(pos=(width - fc - r, 0),
                                              size=(fc, ih1),
                                              font=2,
                                              flags=RT_HALIGN_RIGHT,
                                              text=data.serviceName))
            res.append(
                MultiContentEntryText(pos=(0, ih1),
                                      size=(width - r, ih2 - ih1),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=data.description))
            res.append(
                MultiContentEntryText(pos=(0, ih2),
                                      size=(sc - r, ih - ih2),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=begin_string))
            if len:
                res.append(
                    MultiContentEntryText(pos=(width - sc - r, ih2),
                                          size=(sc, ih - ih2),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=len))
        elif self.list_type == MovieList.LISTTYPE_COMPACT_DESCRIPTION:
            ih1 = ((ih * 8) + 14) / 15  # 37 -> 20, round up
            if len:
                lenSize = 58 * ih / 37
            else:
                lenSize = 0
            fc, sc, tc = self.columnsCompactDescription[
                0], self.columnsCompactDescription[
                    1], self.columnsCompactDescription[2]
            res.append(
                MultiContentEntryText(pos=(iconSize + space, 0),
                                      size=(width - sc - r, ih1),
                                      font=0,
                                      flags=RT_HALIGN_LEFT,
                                      text=data.txt))
            res.append(
                MultiContentEntryText(pos=(0, ih1),
                                      size=(width - tc - lenSize - r,
                                            ih - ih1),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=data.description))
            res.append(
                MultiContentEntryText(pos=(width - fc - r, 6),
                                      size=(fc, ih1),
                                      font=1,
                                      flags=RT_HALIGN_RIGHT,
                                      text=begin_string))
            if data.serviceName:
                res.append(
                    MultiContentEntryText(pos=(width - tc - lenSize - r, ih1),
                                          size=(tc, ih - ih1),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=data.serviceName))
            if lenSize:
                res.append(
                    MultiContentEntryText(pos=(width - lenSize - r, ih1),
                                          size=(lenSize, ih - ih1),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=len))
        elif self.list_type == MovieList.LISTTYPE_COMPACT:
            col = self.compactColumn
            ih1 = ((ih * 8) + 14) / 15  # 37 -> 20, round up
            if len:
                lenSize = 2 * ih
            else:
                lenSize = 0
            res.append(
                MultiContentEntryText(pos=(iconSize + space, 0),
                                      size=(width - lenSize - iconSize -
                                            space - r, ih1),
                                      font=0,
                                      flags=RT_HALIGN_LEFT,
                                      text=data.txt))
            if self.tags:
                res.append(
                    MultiContentEntryText(pos=(width - col - r, ih1),
                                          size=(col, ih - ih1),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=info.getInfoString(
                                              serviceref,
                                              iServiceInformation.sTags)))
                if data.serviceName:
                    res.append(
                        MultiContentEntryText(pos=(col, ih1),
                                              size=(col, ih - ih1),
                                              font=1,
                                              flags=RT_HALIGN_LEFT,
                                              text=data.serviceName))
            else:
                if data.serviceName:
                    res.append(
                        MultiContentEntryText(pos=(width - col - r, ih1),
                                              size=(col, ih - ih1),
                                              font=1,
                                              flags=RT_HALIGN_RIGHT,
                                              text=data.serviceName))
            res.append(
                MultiContentEntryText(pos=(0, ih1),
                                      size=(col, ih - ih1),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=begin_string))
            if lenSize:
                res.append(
                    MultiContentEntryText(pos=(width - lenSize - r, 0),
                                          size=(lenSize, ih1),
                                          font=0,
                                          flags=RT_HALIGN_RIGHT,
                                          text=len))
        else:
            if (self.descr_state == MovieList.SHOW_DESCRIPTION) or not len:
                dateSize = ih * 145 / 25  # 25 -> 145
                res.append(
                    MultiContentEntryText(
                        pos=(iconSize + space, 0),
                        size=(width - iconSize - space - dateSize - r, ih),
                        font=0,
                        flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER,
                        text=data.txt))
                res.append(
                    MultiContentEntryText(pos=(width - dateSize - r, 2),
                                          size=(dateSize, ih),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT
                                          | RT_VALIGN_CENTER,
                                          text=begin_string))
            else:
                lenSize = ih * 3  # 25 -> 75
                res.append(
                    MultiContentEntryText(pos=(iconSize + space, 0),
                                          size=(width - lenSize - iconSize -
                                                space - r, ih),
                                          font=0,
                                          flags=RT_HALIGN_LEFT,
                                          text=data.txt))
                res.append(
                    MultiContentEntryText(pos=(width - lenSize - r, 0),
                                          size=(lenSize, ih),
                                          font=0,
                                          flags=RT_HALIGN_RIGHT,
                                          text=len))
        return res
Example #2
0
    def buildMovieListEntry(self, serviceref, info, begin, data):
        width = self.l.getItemSize().width()
        pathName = serviceref.getPath()
        res = [None]

        if serviceref.flags & eServiceReference.mustDescent:
            # Directory
            iconSize = 22
            # Name is full path name
            if info is None:
                # Special case: "parent"
                txt = ".."
            else:
                p = os.path.split(pathName)
                if not p[1]:
                    # if path ends in '/', p is blank.
                    p = os.path.split(p[0])
                txt = p[1]
                if txt == ".Trash":
                    res.append(
                        MultiContentEntryPixmapAlphaTest(pos=(0, 1),
                                                         size=(iconSize, 24),
                                                         png=self.iconTrash))
                    res.append(
                        MultiContentEntryText(pos=(iconSize + 2, 0),
                                              size=(width - 166,
                                                    self.itemHeight),
                                              font=0,
                                              flags=RT_HALIGN_LEFT,
                                              text=_("Deleted items")))
                    res.append(
                        MultiContentEntryText(pos=(width - 145, 4),
                                              size=(145, self.itemHeight),
                                              font=1,
                                              flags=RT_HALIGN_RIGHT,
                                              text=_("Trash can")))
                    return res
            res.append(
                MultiContentEntryPixmapAlphaTest(pos=(0, 1),
                                                 size=(iconSize, iconSize),
                                                 png=self.iconFolder))
            res.append(
                MultiContentEntryText(pos=(iconSize + 2, 0),
                                      size=(width - 166, self.itemHeight),
                                      font=0,
                                      flags=RT_HALIGN_LEFT,
                                      text=txt))
            res.append(
                MultiContentEntryText(pos=(width - 145, 4),
                                      size=(145, self.itemHeight),
                                      font=1,
                                      flags=RT_HALIGN_RIGHT,
                                      text=_("Directory")))
            return res
        if (data == -1) or (data is None):
            data = MovieListData()
            cur_idx = self.l.getCurrentSelectionIndex()
            x = self.list[cur_idx]  # x = ref,info,begin,...
            if config.usage.load_length_of_movies_in_moviellist.value:
                data.len = x[1].getLength(x[0])  #recalc the movie length...
            else:
                data.len = 0  #dont recalc movielist to speedup loading the list
            self.list[cur_idx] = (
                x[0], x[1], x[2], data
            )  #update entry in list... so next time we don't need to recalc
            data.txt = info.getName(serviceref)
            if config.movielist.hide_extensions.value:
                fileName, fileExtension = os.path.splitext(data.txt)
                if fileExtension in KNOWN_EXTENSIONS:
                    data.txt = fileName
            data.icon = None
            data.part = None
            if os.path.split(pathName)[1] in self.runningTimers:
                if self.playInBackground and serviceref == self.playInBackground:
                    data.icon = self.iconMoviePlayRec
                else:
                    data.icon = self.iconMovieRec
            elif self.playInBackground and serviceref == self.playInBackground:
                data.icon = self.iconMoviePlay
            else:
                switch = config.usage.show_icons_in_movielist.value
                data.part = moviePlayState(pathName + '.cuts', serviceref,
                                           data.len)
                if switch == 'i':
                    if data.part is None:
                        if config.usage.movielist_unseen.value:
                            data.icon = self.iconUnwatched
                    else:
                        data.icon = self.iconPart[data.part // 25]
                elif switch == 'p' or switch == 's':
                    if data.part is None:
                        if config.usage.movielist_unseen.value:
                            data.part = 0
                        data.partcol = 0x808080
                    else:
                        data.partcol = 0xf0f0f0
            service = ServiceReference(
                info.getInfoString(serviceref,
                                   iServiceInformation.sServiceref))
            if service is None:
                data.serviceName = None
            else:
                data.serviceName = service.getServiceName()
            data.description = info.getInfoString(
                serviceref, iServiceInformation.sDescription)

        len = data.len
        if len > 0:
            len = "%d:%02d" % (len / 60, len % 60)
        else:
            len = ""

        if data.icon is not None:
            iconSize = 22
            if self.list_type in (MovieList.LISTTYPE_COMPACT_DESCRIPTION,
                                  MovieList.LISTTYPE_COMPACT):
                pos = (0, 0)
            else:
                pos = (0, 1)
            res.append(
                MultiContentEntryPixmapAlphaTest(pos=pos,
                                                 size=(iconSize, 20),
                                                 png=data.icon))
        switch = config.usage.show_icons_in_movielist.value
        if switch == 'p' or switch == 's':
            if switch == 'p':
                iconSize = 48
            else:
                iconSize = 22
            if data.part is not None:
                res.append(
                    MultiContentEntryProgress(pos=(0, 5),
                                              size=(iconSize - 2, 16),
                                              percent=data.part,
                                              borderWidth=2,
                                              foreColor=data.partcol,
                                              foreColorSelected=None,
                                              backColor=None,
                                              backColorSelected=None))
        elif switch == 'i':
            iconSize = 22
        else:
            iconSize = 0

        begin_string = ""
        if begin > 0:
            begin_string = ', '.join(FuzzyTime(begin, inPast=True))

        ih = self.itemHeight
        if self.list_type == MovieList.LISTTYPE_ORIGINAL:
            ih1 = (ih * 2) / 5  # 75 -> 30
            ih2 = (ih * 2) / 3  # 75 -> 50
            res.append(
                MultiContentEntryText(pos=(iconSize, 0),
                                      size=(width - 182, ih1),
                                      font=0,
                                      flags=RT_HALIGN_LEFT,
                                      text=data.txt))
            if self.tags:
                res.append(
                    MultiContentEntryText(pos=(width - 180, 0),
                                          size=(180, ih1),
                                          font=2,
                                          flags=RT_HALIGN_RIGHT,
                                          text=info.getInfoString(
                                              serviceref,
                                              iServiceInformation.sTags)))
                if data.serviceName:
                    res.append(
                        MultiContentEntryText(pos=(200, ih2),
                                              size=(200, ih2 - ih1),
                                              font=1,
                                              flags=RT_HALIGN_LEFT,
                                              text=data.serviceName))
            else:
                if data.serviceName:
                    res.append(
                        MultiContentEntryText(pos=(width - 180, 0),
                                              size=(180, ih1),
                                              font=2,
                                              flags=RT_HALIGN_RIGHT,
                                              text=data.serviceName))
            res.append(
                MultiContentEntryText(pos=(0, ih1),
                                      size=(width, ih2 - ih1),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=data.description))
            res.append(
                MultiContentEntryText(pos=(0, ih2),
                                      size=(200, ih - ih2),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=begin_string))
            if len:
                res.append(
                    MultiContentEntryText(pos=(width - 200, ih2),
                                          size=(198, ih - ih2),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=len))
        elif self.list_type == MovieList.LISTTYPE_COMPACT_DESCRIPTION:
            ih1 = ((ih * 8) + 14) / 15  # 37 -> 20, round up
            if len:
                lenSize = 58 * ih / 37
            else:
                lenSize = 0
            res.append(
                MultiContentEntryText(pos=(iconSize, 0),
                                      size=(width - 140, ih1),
                                      font=0,
                                      flags=RT_HALIGN_LEFT,
                                      text=data.txt))
            res.append(
                MultiContentEntryText(pos=(0, ih1),
                                      size=(width - 154 - lenSize, ih - ih1),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=data.description))
            res.append(
                MultiContentEntryText(pos=(width - 120, 6),
                                      size=(120, ih1),
                                      font=1,
                                      flags=RT_HALIGN_RIGHT,
                                      text=begin_string))
            if data.serviceName:
                res.append(
                    MultiContentEntryText(pos=(width - 154 - lenSize, ih1),
                                          size=(154, ih - ih1),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=data.serviceName))
            if lenSize:
                res.append(
                    MultiContentEntryText(pos=(width - lenSize, ih1),
                                          size=(lenSize, ih - ih1),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=len))
        elif self.list_type == MovieList.LISTTYPE_COMPACT:
            ih1 = ((ih * 8) + 14) / 15  # 37 -> 20, round up
            if len:
                lenSize = 2 * ih
            else:
                lenSize = 0
            res.append(
                MultiContentEntryText(pos=(iconSize, 0),
                                      size=(width - lenSize - iconSize, ih1),
                                      font=0,
                                      flags=RT_HALIGN_LEFT,
                                      text=data.txt))
            if self.tags:
                res.append(
                    MultiContentEntryText(pos=(width - 200, ih1),
                                          size=(200, ih - ih1),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=info.getInfoString(
                                              serviceref,
                                              iServiceInformation.sTags)))
                if data.serviceName:
                    res.append(
                        MultiContentEntryText(pos=(200, ih1),
                                              size=(200, ih - ih1),
                                              font=1,
                                              flags=RT_HALIGN_LEFT,
                                              text=data.serviceName))
            else:
                if data.serviceName:
                    res.append(
                        MultiContentEntryText(pos=(width - 200, ih1),
                                              size=(200, ih - ih1),
                                              font=1,
                                              flags=RT_HALIGN_RIGHT,
                                              text=data.serviceName))
            res.append(
                MultiContentEntryText(pos=(0, ih1),
                                      size=(200, ih - ih1),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=begin_string))
            if lenSize:
                res.append(
                    MultiContentEntryText(pos=(width - lenSize, 0),
                                          size=(lenSize, ih1),
                                          font=0,
                                          flags=RT_HALIGN_RIGHT,
                                          text=len))
        else:
            if (self.descr_state == MovieList.SHOW_DESCRIPTION) or not len:
                dateSize = ih * 145 / 25  # 25 -> 145
                res.append(
                    MultiContentEntryText(pos=(iconSize, 0),
                                          size=(width - iconSize - dateSize,
                                                ih),
                                          font=0,
                                          flags=RT_HALIGN_LEFT,
                                          text=data.txt))
                res.append(
                    MultiContentEntryText(pos=(width - dateSize, 4),
                                          size=(dateSize, ih),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=begin_string))
            else:
                lenSize = ih * 3  # 25 -> 75
                res.append(
                    MultiContentEntryText(pos=(iconSize, 0),
                                          size=(width - lenSize - iconSize,
                                                ih),
                                          font=0,
                                          flags=RT_HALIGN_LEFT,
                                          text=data.txt))
                res.append(
                    MultiContentEntryText(pos=(width - lenSize, 0),
                                          size=(lenSize, ih),
                                          font=0,
                                          flags=RT_HALIGN_RIGHT,
                                          text=len))
        return res
Example #3
0
    def buildMovieListEntry(self, serviceref, info, begin, data):
        switch = config.usage.show_icons_in_movielist.value
        ext = config.movielist.useextlist.value
        width = self.l.getItemSize().width()
        pathName = serviceref.getPath()
        res = [None]

        if ext != '0':
            ih = self.itemHeight // 2
        else:
            ih = self.itemHeight

        if skin.getSkinFactor() == 1.5:
            listBeginX = 3
            listEndX = 3
            listMarginX = 12
            pathIconSize = 29
            dataIconSize = 25
            progressIconSize = 25
            progressBarSize = 72
            textPosY = 2
        else:
            listBeginX = 2
            listEndX = 2
            listMarginX = 8
            pathIconSize = 25
            dataIconSize = 21
            progressIconSize = 21
            progressBarSize = 48
            textPosY = 1

        textPosX = listBeginX + dataIconSize + listMarginX

        if serviceref.flags & eServiceReference.mustDescent:
            # Directory
            iconSize = pathIconSize
            iconPosX = listBeginX - 1
            iconPosY = ih / 2 - iconSize / 2
            if iconPosY < iconPosX:
                iconPosY = iconPosX
            # Name is full path name
            if info is None:
                # Special case: "parent"
                txt = ".."
            else:
                p = os.path.split(pathName)
                if not p[1]:
                    # if path ends in '/', p is blank.
                    p = os.path.split(p[0])
                txt = p[1]
                if txt == ".Trash":
                    dateSize = getTextBoundarySize(self.instance,
                                                   self.dateFont,
                                                   self.l.getItemSize(),
                                                   _("Trashcan")).width()
                    res.append(
                        MultiContentEntryPixmapAlphaBlend(pos=(iconPosX,
                                                               iconPosY),
                                                          size=(iconSize,
                                                                iconSize),
                                                          png=self.iconTrash))
                    res.append(
                        MultiContentEntryText(
                            pos=(textPosX, 0),
                            size=(width - textPosX - dateSize - listMarginX -
                                  listEndX, ih),
                            font=0,
                            flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER,
                            text=_("Deleted items")))
                    res.append(
                        MultiContentEntryText(
                            pos=(width - dateSize - listEndX, textPosY),
                            size=(dateSize, self.itemHeight),
                            font=1,
                            flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER,
                            text=_("Trashcan")))
                    return res
            dateSize = getTextBoundarySize(self.instance, self.dateFont,
                                           self.l.getItemSize(),
                                           _("Directory")).width()
            res.append(
                MultiContentEntryPixmapAlphaBlend(pos=(iconPosX, iconPosY),
                                                  size=(iconSize, iconSize),
                                                  png=self.iconFolder))
            res.append(
                MultiContentEntryText(pos=(textPosX, 0),
                                      size=(width - textPosX - dateSize -
                                            listMarginX - listEndX, ih),
                                      font=0,
                                      flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER,
                                      text=txt))
            res.append(
                MultiContentEntryText(pos=(width - dateSize - listEndX,
                                           textPosY),
                                      size=(dateSize, self.itemHeight),
                                      font=1,
                                      flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER,
                                      text=_("Directory")))
            return res
        if (data == -1) or (data is None):
            data = MovieListData()
            cur_idx = self.l.getCurrentSelectionIndex()
            x = self.list[cur_idx]  # x = ref,info,begin,...
            data.len = 0  #dont recalc movielist to speedup loading the list
            self.list[cur_idx] = (
                x[0], x[1], x[2], data
            )  #update entry in list... so next time we don't need to recalc
            data.txt = info.getName(serviceref)
            if config.movielist.hide_extensions.value:
                fileName, fileExtension = os.path.splitext(data.txt)
                if fileExtension in KNOWN_EXTENSIONS:
                    data.txt = fileName
            data.icon = None
            data.part = None
            if os.path.split(pathName)[1] in self.runningTimers:
                if switch == 'i':
                    if (self.playInBackground or self.playInForeground
                        ) and serviceref == (self.playInBackground
                                             or self.playInForeground):
                        data.icon = self.iconMoviePlayRec
                    else:
                        data.icon = self.iconMovieRec
                elif switch == 'p' or switch == 's':
                    data.part = 100
                    if (self.playInBackground or self.playInForeground
                        ) and serviceref == (self.playInBackground
                                             or self.playInForeground):
                        data.partcol = 0xffc71d
                    else:
                        data.partcol = 0xff001d
            elif (self.playInBackground
                  or self.playInForeground) and serviceref == (
                      self.playInBackground or self.playInForeground):
                data.icon = self.iconMoviePlay
            else:
                data.part = moviePlayState(pathName + '.cuts', serviceref,
                                           data.len)
                if switch == 'i':
                    if data.part is not None and data.part > 0:
                        data.icon = self.iconPart[data.part // 25]
                    else:
                        if config.usage.movielist_unseen.value:
                            data.icon = self.iconUnwatched
                elif switch == 'p' or switch == 's':
                    if data.part is not None and data.part > 0:
                        data.partcol = 0xffc71d
                    else:
                        if config.usage.movielist_unseen.value:
                            data.part = 100
                            data.partcol = 0x206333
        len = data.len
        if len > 0:
            len = "%d:%02d" % (len // 60, len % 60)
        else:
            len = ""

        iconSize = 0

        if switch == 'i':
            iconSize = dataIconSize
            iconPosX = listBeginX
            iconPosY = ih // 2 - iconSize // 2
            if iconPosY < iconPosX:
                iconPosY = iconPosX
            res.append(
                MultiContentEntryPixmapAlphaBlend(pos=(iconPosX, iconPosY),
                                                  size=(iconSize, iconSize),
                                                  png=data.icon))
        elif switch == 'p':
            if data.part is not None and data.part > 0:
                iconSize = progressBarSize
                iconPosX = listBeginX
                iconPosY = ih // 2 - iconSize // 8
                if iconPosY < iconPosX:
                    iconPosY = iconPosX
                res.append(
                    MultiContentEntryProgress(pos=(iconPosX, iconPosY),
                                              size=(iconSize, iconSize // 4),
                                              percent=data.part,
                                              borderWidth=2,
                                              foreColor=data.partcol,
                                              foreColorSelected=None,
                                              backColor=None,
                                              backColorSelected=None))
            else:
                iconSize = dataIconSize
                iconPosX = listBeginX
                iconPosY = ih // 2 - iconSize // 2
                if iconPosY < iconPosX:
                    iconPosY = iconPosX
                res.append(
                    MultiContentEntryPixmapAlphaBlend(pos=(iconPosX, iconPosY),
                                                      size=(iconSize,
                                                            iconSize),
                                                      png=data.icon))
        elif switch == 's':
            iconSize = progressIconSize
            iconPosX = listBeginX
            iconPosY = ih // 2 - iconSize // 2
            if iconPosY < iconPosX:
                iconPosY = iconPosX
            if data.part is not None and data.part > 0:
                res.append(
                    MultiContentEntryProgress(pos=(iconPosX, iconPosY),
                                              size=(iconSize, iconSize),
                                              percent=data.part,
                                              borderWidth=2,
                                              foreColor=data.partcol,
                                              foreColorSelected=None,
                                              backColor=None,
                                              backColorSelected=None))
            else:
                res.append(
                    MultiContentEntryPixmapAlphaBlend(pos=(iconPosX, iconPosY),
                                                      size=(iconSize,
                                                            iconSize),
                                                      png=data.icon))

        begin_string = ""
        if begin > 0:
            begin_string = ', '.join(FuzzyTime(begin, inPast=True))
        dateSize = serviceSize = getTextBoundarySize(self.instance,
                                                     self.dateFont,
                                                     self.l.getItemSize(),
                                                     begin_string).width()

        if iconSize:
            textPosX = listBeginX + iconSize + listMarginX
        else:
            textPosX = listBeginX

        if ext != '0':
            getrec = info.getName(serviceref)
            fileName, fileExtension = os.path.splitext(getrec)
            desc = None
            picon = None
            service = None
            try:
                serviceHandler = eServiceCenter.getInstance()
                info = serviceHandler.info(serviceref)
                desc = info.getInfoString(
                    serviceref,
                    iServiceInformation.sDescription)  # get description
                ref = info.getInfoString(
                    serviceref,
                    iServiceInformation.sServiceref)  # get reference
                service = ServiceReference(
                    ref).getServiceName()  # get service name
                serviceSize = getTextBoundarySize(self.instance, self.dateFont,
                                                  self.l.getItemSize(),
                                                  service).width()
            except Exception as e:
                print(('[MovieList] load extended infos get failed: ', e))
            if ext == '2':
                try:
                    picon = getPiconName(ref)
                    picon = loadPNG(picon)
                except Exception as e:
                    print(('[MovieList] load picon get failed: ', e))

            if fileExtension in RECORD_EXTENSIONS:
                if ext == '1':
                    res.append(
                        MultiContentEntryText(
                            pos=(textPosX, 0),
                            size=(width - textPosX - serviceSize -
                                  listMarginX - listEndX, ih),
                            font=0,
                            flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER,
                            text=data.txt))
                    res.append(
                        MultiContentEntryText(
                            pos=(width - serviceSize - listEndX, textPosY),
                            size=(serviceSize, ih),
                            font=1,
                            flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER,
                            text=service))
                if ext == '2':
                    piconSize = ih * 1.667
                    res.append(
                        MultiContentEntryText(
                            pos=(textPosX, 0),
                            size=(width - textPosX - dateSize - listMarginX -
                                  listEndX, ih),
                            font=0,
                            flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER,
                            text=data.txt))
                    res.append(
                        MultiContentEntryPixmapAlphaBlend(
                            pos=(width - piconSize - listEndX, listEndX),
                            size=(piconSize, ih),
                            png=picon,
                            flags=BT_SCALE | BT_KEEP_ASPECT_RATIO))
                res.append(
                    MultiContentEntryText(pos=(listBeginX, ih + textPosY),
                                          size=(width - listBeginX - dateSize -
                                                listMarginX - listEndX, ih),
                                          font=1,
                                          flags=RT_HALIGN_LEFT,
                                          text=desc))
                res.append(
                    MultiContentEntryText(pos=(width - dateSize - listEndX,
                                               ih + textPosY),
                                          size=(dateSize, ih),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=begin_string))
                return res
            else:
                res.append(
                    MultiContentEntryText(pos=(textPosX, 0),
                                          size=(width - textPosX - dateSize -
                                                listMarginX - listEndX, ih),
                                          font=0,
                                          flags=RT_HALIGN_LEFT
                                          | RT_VALIGN_CENTER,
                                          text=data.txt))
                res.append(
                    MultiContentEntryText(pos=(width - dateSize - listEndX,
                                               ih),
                                          size=(dateSize, ih),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=begin_string))
                return res
        else:
            res.append(
                MultiContentEntryText(pos=(textPosX, 0),
                                      size=(width - textPosX - dateSize -
                                            listMarginX - listEndX, ih),
                                      font=0,
                                      flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER,
                                      text=data.txt))
            res.append(
                MultiContentEntryText(pos=(width - dateSize - listEndX,
                                           textPosY),
                                      size=(dateSize, ih),
                                      font=1,
                                      flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER,
                                      text=begin_string))
            return res
Example #4
0
    def buildMovieListEntry(self, serviceref, info, begin, data):
        switch = config.usage.show_icons_in_movielist.value
        width = self.l.getItemSize().width()
        dateWidth = self.dateWidth
        if not config.movielist.use_fuzzy_dates.value:
            dateWidth += 30
        iconSize = self.iconsWidth
        space = self.spaceIconeText
        r = self.spaceRight
        pathName = serviceref.getPath()
        res = [None]

        if serviceref.flags & eServiceReference.mustDescent:
            # Directory
            # Name is full path name
            if info is None:
                # Special case: "parent"
                txt = ".."
            else:
                p = os.path.split(pathName)
                if not p[1]:
                    # if path ends in '/', p is blank.
                    p = os.path.split(p[0])
                txt = p[1]
            if txt == ".Trash":
                res.append(
                    MultiContentEntryPixmapAlphaBlend(
                        pos=(0, self.trashShift),
                        size=(iconSize, self.iconTrash.size().height()),
                        png=self.iconTrash))
                res.append(
                    MultiContentEntryText(pos=(iconSize + space, 0),
                                          size=(width - 166, self.itemHeight),
                                          font=0,
                                          flags=RT_HALIGN_LEFT
                                          | RT_VALIGN_CENTER,
                                          text=_("Deleted items")))
                res.append(
                    MultiContentEntryText(pos=(width - 145 - r, 0),
                                          size=(145, self.itemHeight),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT
                                          | RT_VALIGN_CENTER,
                                          text=_("Trash can")))
                return res
            res.append(
                MultiContentEntryPixmapAlphaBlend(pos=(0, self.dirShift),
                                                  size=(iconSize, iconSize),
                                                  png=self.iconFolder))
            res.append(
                MultiContentEntryText(pos=(iconSize + space, 0),
                                      size=(width - 166, self.itemHeight),
                                      font=0,
                                      flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER,
                                      text=txt))
            res.append(
                MultiContentEntryText(pos=(width - 145 - r, 0),
                                      size=(145, self.itemHeight),
                                      font=1,
                                      flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER,
                                      text=_("Directory")))
            return res
        if data == -1 or data is None:
            data = MovieListData()
            cur_idx = self.l.getCurrentSelectionIndex()
            x = self.list[cur_idx]  # x = ref,info,begin,...
            data.len = 0  #dont recalc movielist to speedup loading the list
            self.list[cur_idx] = (
                x[0], x[1], x[2], data
            )  #update entry in list... so next time we don't need to recalc
            data.txt = info.getName(serviceref)
            if config.movielist.hide_extensions.value:
                fileName, fileExtension = os.path.splitext(data.txt)
                if fileExtension in KNOWN_EXTENSIONS:
                    data.txt = fileName
            data.icon = None
            data.part = None
            if os.path.split(pathName)[1] in self.runningTimers:
                if switch == 'i':
                    if (self.playInBackground or self.playInForeground
                        ) and serviceref == (self.playInBackground
                                             or self.playInForeground):
                        data.icon = self.iconMoviePlayRec
                    else:
                        data.icon = self.iconMovieRec
                elif switch in ('p', 's'):
                    data.part = 100
                    if (self.playInBackground or self.playInForeground
                        ) and serviceref == (self.playInBackground
                                             or self.playInForeground):
                        data.partcol = self.pbarColourSeen
                    else:
                        data.partcol = self.pbarColourRec
            elif (self.playInBackground
                  or self.playInForeground) and serviceref == (
                      self.playInBackground or self.playInForeground):
                data.icon = self.iconMoviePlay
            else:
                data.part = moviePlayState(pathName + '.cuts', serviceref,
                                           data.len)
                if switch == 'i':
                    if data.part is not None and data.part > 0:
                        data.icon = self.iconPart[data.part // 25]
                    else:
                        if config.usage.movielist_unseen.value:
                            data.icon = self.iconUnwatched
                elif switch in ('p', 's'):
                    if data.part is not None and data.part > 0:
                        data.partcol = self.pbarColourSeen
                    else:
                        if config.usage.movielist_unseen.value:
                            data.part = 100
                            data.partcol = self.pbarColour
        len = data.len
        if len > 0:
            len = "%d:%02d" % (len / 60, len % 60)
        else:
            len = ""

        if data:
            pos = (0, self.partIconeShift)
            if switch == 'i' and hasattr(data,
                                         'icon') and data.icon is not None:
                res.append(
                    MultiContentEntryPixmapAlphaBlend(
                        pos=pos,
                        size=(iconSize, data.icon.size().height()),
                        png=data.icon))
            elif switch in ('p', 's'):
                if switch == 'p':
                    iconSize = self.pbarLargeWidth
                if hasattr(data, 'part') and data.part > 0:
                    res.append(
                        MultiContentEntryProgress(pos=(0, self.pbarShift),
                                                  size=(iconSize,
                                                        self.pbarHeight),
                                                  percent=data.part,
                                                  borderWidth=2,
                                                  foreColor=data.partcol,
                                                  foreColorSelected=None,
                                                  backColor=None,
                                                  backColorSelected=None))
                elif hasattr(data, 'icon') and data.icon is not None:
                    res.append(
                        MultiContentEntryPixmapAlphaBlend(
                            pos=(0, self.pbarShift),
                            size=(iconSize, self.pbarHeight),
                            png=data.icon))

        begin_string = ""
        if begin > 0:
            if config.movielist.use_fuzzy_dates.value:
                begin_string = ', '.join(FuzzyTime(begin, inPast=True))
            else:
                begin_string = strftime(
                    "%s, %s" % (config.usage.date.daylong.value,
                                config.usage.time.short.value),
                    localtime(begin))

        ih = self.itemHeight
        res.append(
            MultiContentEntryText(pos=(iconSize + space, 0),
                                  size=(width - iconSize - space - dateWidth -
                                        r, ih),
                                  font=0,
                                  flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER,
                                  text=data.txt))
        res.append(
            MultiContentEntryText(pos=(width - dateWidth - r, 2),
                                  size=(dateWidth, ih),
                                  font=1,
                                  flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER,
                                  text=begin_string))
        return res
Example #5
0
    def buildMovieListEntry(self, serviceref, info, begin, data):
        switch = config.usage.show_icons_in_movielist.getValue()
        width = self.l.getItemSize().width()
        pathName = serviceref.getPath()
        res = [None]

        if serviceref.flags & eServiceReference.mustDescent:
            # Directory
            iconSize = 22
            # Name is full path name
            if info is None:
                # Special case: "parent"
                txt = ".."
            else:
                p = os.path.split(pathName)
                if not p[1]:
                    # if path ends in '/', p is blank.
                    p = os.path.split(p[0])
                txt = p[1]
                if txt == ".Trash":
                    res.append(
                        MultiContentEntryPixmapAlphaTest(pos=(0, 2),
                                                         size=(iconSize, 24),
                                                         png=self.iconTrash))
                    res.append(
                        MultiContentEntryText(pos=(iconSize + 2, 0),
                                              size=(width - 166,
                                                    self.itemHeight),
                                              font=0,
                                              flags=RT_HALIGN_LEFT,
                                              text=_("Deleted items")))
                    res.append(
                        MultiContentEntryText(pos=(width - 145, 0),
                                              size=(145, self.itemHeight),
                                              font=1,
                                              flags=RT_HALIGN_RIGHT
                                              | RT_VALIGN_CENTER,
                                              text=_("Trashcan")))
                    return res
            res.append(
                MultiContentEntryPixmapAlphaTest(pos=(0, 2),
                                                 size=(iconSize, iconSize),
                                                 png=self.iconFolder))
            res.append(
                MultiContentEntryText(pos=(iconSize + 2, 0),
                                      size=(width - 166, self.itemHeight),
                                      font=0,
                                      flags=RT_HALIGN_LEFT,
                                      text=txt))
            res.append(
                MultiContentEntryText(pos=(width - 145, 0),
                                      size=(145, self.itemHeight),
                                      font=1,
                                      flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER,
                                      text=_("Directory")))
            return res
        if (data == -1) or (data is None):
            data = MovieListData()
            cur_idx = self.l.getCurrentSelectionIndex()
            x = self.list[cur_idx]  # x = ref,info,begin,...
            data.len = 0  #dont recalc movielist to speedup loading the list
            self.list[cur_idx] = (
                x[0], x[1], x[2], data
            )  #update entry in list... so next time we don't need to recalc
            data.txt = info.getName(serviceref)
            if config.movielist.hide_extensions.getValue():
                fileName, fileExtension = os.path.splitext(data.txt)
                if fileExtension in KNOWN_EXTENSIONS:
                    data.txt = fileName
            data.icon = None
            data.part = None
            if os.path.split(pathName)[1] in self.runningTimers:
                if switch == 'i':
                    if (self.playInBackground or self.playInForeground
                        ) and serviceref == (self.playInBackground
                                             or self.playInForeground):
                        data.icon = self.iconMoviePlayRec
                    else:
                        data.icon = self.iconMovieRec
                elif switch == 'p' or switch == 's':
                    data.part = 100
                    if (self.playInBackground or self.playInForeground
                        ) and serviceref == (self.playInBackground
                                             or self.playInForeground):
                        data.partcol = 0xffc71d
                    else:
                        data.partcol = 0xff001d
            elif (self.playInBackground
                  or self.playInForeground) and serviceref == (
                      self.playInBackground or self.playInForeground):
                data.icon = self.iconMoviePlay
            else:
                data.part = moviePlayState(pathName + '.cuts', serviceref,
                                           data.len)
                if switch == 'i':
                    if data.part is not None and data.part > 0:
                        data.icon = self.iconPart[data.part // 25]
                    else:
                        if config.usage.movielist_unseen.getValue():
                            data.icon = self.iconUnwatched
                elif switch == 'p' or switch == 's':
                    if data.part is not None and data.part > 0:
                        data.partcol = 0xffc71d
                    else:
                        if config.usage.movielist_unseen.getValue():
                            data.part = 100
                            data.partcol = 0x206333
        len = data.len
        if len > 0:
            len = "%d:%02d" % (len / 60, len % 60)
        else:
            len = ""

        iconSize = 0
        if switch == 'i':
            iconSize = 22
            res.append(
                MultiContentEntryPixmapAlphaTest(pos=(0, 1),
                                                 size=(iconSize, 20),
                                                 png=data.icon))
        elif switch == 'p':
            iconSize = 48
            if data.part is not None and data.part > 0:
                res.append(
                    MultiContentEntryProgress(pos=(0, 5),
                                              size=(iconSize - 2, 16),
                                              percent=data.part,
                                              borderWidth=2,
                                              foreColor=data.partcol,
                                              foreColorSelected=None,
                                              backColor=None,
                                              backColorSelected=None))
            else:
                res.append(
                    MultiContentEntryPixmapAlphaTest(pos=(0, 1),
                                                     size=(iconSize, 20),
                                                     png=data.icon))
        elif switch == 's':
            iconSize = 22
            if data.part is not None and data.part > 0:
                res.append(
                    MultiContentEntryProgress(pos=(0, 5),
                                              size=(iconSize - 2, 16),
                                              percent=data.part,
                                              borderWidth=2,
                                              foreColor=data.partcol,
                                              foreColorSelected=None,
                                              backColor=None,
                                              backColorSelected=None))
            else:
                res.append(
                    MultiContentEntryPixmapAlphaTest(pos=(0, 1),
                                                     size=(iconSize, 20),
                                                     png=data.icon))

        begin_string = ""
        if begin > 0:
            begin_string = ' '.join(FuzzyTime(begin, inPast=True))

        ih = self.itemHeight
        lenSize = ih * 3  # 25 -> 75
        dateSize = ih * 145 / 25  # 25 -> 145
        res.append(
            MultiContentEntryText(pos=(iconSize, 0),
                                  size=(width - iconSize - dateSize, ih),
                                  font=0,
                                  flags=RT_HALIGN_LEFT,
                                  text=data.txt))
        res.append(
            MultiContentEntryText(pos=(width - dateSize, 0),
                                  size=(dateSize, ih),
                                  font=1,
                                  flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER,
                                  text=begin_string))
        return res
Example #6
0
    def buildListEntry(self, job):
        res = [None]
        try:
            width = self.l.getItemSize().width()

            full = job.getSizeTotal()
            copied = job.getSizeCopied()
            if full == 0:
                full = 1
            if copied == 0:
                copied = 1
            elapsed_time = job.getElapsedTime()
            progress = copied * 100 / full
            b_per_sec = elapsed_time != 0 and copied / elapsed_time or 0
            mode = job.getMode() and _("Move") or _("Copy")
            name_info = _("Name:")
            if job.isCancelled():
                mode = _("Cancelled")
            if job.isFinished():
                mode = _("Finished")
                movie_name = ""
                name_info = ""
            else:
                movie_name = job.getMovieName()
            error = job.getError()
            if error:
                mode = _("Error")
                movie_name = str(error)
                name_info = _("Error:")
            #etime = time.strftime("%H:%M:%S", time.gmtime(elapsed_time))
            main_info = "%s  %d/%d (%s)  %d%%" % (mode, job.getMovieIndex(),
                                                  job.getMovieCount(),
                                                  realSize(full), progress)
            #file_info = "(%d/%d)" % (job.getFileIndex(), job.getFileCount())
            #speed_info = _("Total files") + file_info + " " + _("Average") + " " + realSize(b_per_sec, 3) + "/" + _("Seconds")

            src_p = job.getSourcePath()
            dst_p = job.getDestinationPath()
            from_info = os.path.basename(src_p) + " (%s)" % (src_p)
            to_info = os.path.basename(dst_p) + " (%s)" % (dst_p)
            remaining_bytes = full - copied
            remaining_seconds = b_per_sec != 0 and remaining_bytes / b_per_sec or -1
            remaining_elements = "%d (%s)" % (job.getFileCount() -
                                              job.getFileIndex(),
                                              realSize(remaining_bytes, 1))
            if job.isFinished():
                remaining_time = mode
            elif remaining_seconds == -1:
                remaining_time = _("Calculating...")
            elif remaining_seconds > 60 * 60:
                remaining_time = time.strftime("%H:%M:%S",
                                               time.gmtime(remaining_seconds))
            elif remaining_seconds > 120:
                remaining_time = _("Around %d minutes") % (remaining_seconds /
                                                           60)
            elif remaining_seconds > 60:
                remaining_time = _("Around %d minute") % (remaining_seconds /
                                                          60)
            else:
                remaining_time = "%d %s" % (remaining_seconds, _("Seconds"))
            speed = realSize(b_per_sec, 3) + "/" + _("Second")

            res.append(
                MultiContentEntryProgress(pos=(5, 2),
                                          size=(width - 10, 5),
                                          percent=progress,
                                          borderWidth=1))

            info_width = 180
            res.append(
                MultiContentEntryText(pos=(5, 9),
                                      size=(width, 26),
                                      font=0,
                                      flags=RT_HALIGN_LEFT,
                                      text=_("Status:")))
            res.append(
                MultiContentEntryText(pos=(5, 32),
                                      size=(info_width, 22),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=name_info))
            res.append(
                MultiContentEntryText(pos=(5, 52),
                                      size=(info_width, 20),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=_("From:")))
            res.append(
                MultiContentEntryText(pos=(5, 72),
                                      size=(info_width, 20),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=_("To:")))
            if not job.isFinished():
                res.append(
                    MultiContentEntryText(pos=(5, 92),
                                          size=(info_width, 20),
                                          font=1,
                                          flags=RT_HALIGN_LEFT,
                                          text=_("Remaining time:")))
            res.append(
                MultiContentEntryText(pos=(5, 112),
                                      size=(info_width, 20),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=_("Remaining elements:")))
            res.append(
                MultiContentEntryText(pos=(5, 132),
                                      size=(info_width, 20),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=_("Speed:")))

            res.append(
                MultiContentEntryText(pos=(info_width, 9),
                                      size=(width, 26),
                                      font=0,
                                      flags=RT_HALIGN_LEFT,
                                      text=main_info))
            res.append(
                MultiContentEntryText(pos=(info_width, 32),
                                      size=(width, 22),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=movie_name))
            res.append(
                MultiContentEntryText(pos=(info_width, 52),
                                      size=(width, 20),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=from_info))
            res.append(
                MultiContentEntryText(pos=(info_width, 72),
                                      size=(width, 20),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=to_info))
            if not job.isFinished():
                res.append(
                    MultiContentEntryText(pos=(info_width, 92),
                                          size=(width, 20),
                                          font=1,
                                          flags=RT_HALIGN_LEFT,
                                          text=remaining_time))
            res.append(
                MultiContentEntryText(pos=(info_width, 112),
                                      size=(width, 20),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=remaining_elements))
            res.append(
                MultiContentEntryText(pos=(info_width, 132),
                                      size=(width, 20),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=speed))

            res.append(
                MultiContentEntryText(pos=(width - 200, 9),
                                      size=(195, 26),
                                      font=0,
                                      flags=RT_HALIGN_RIGHT,
                                      text=realSize(copied)))
            #res.append(MultiContentEntryText(pos=(width - 150, 32), size=(145, 22), font=1, flags=RT_HALIGN_RIGHT, text=etime))
        except Exception as e:
            print(str(e))
        return res
Example #7
0
    def buildMovieListEntry(self, serviceref, info, begin, len):

        width = self.l.getItemSize().width()

        is_dvd = None
        filepath = os.path.realpath(serviceref.getPath())
        possible_path = ("VIDEO_TS", "video_ts", "VIDEO_TS.IFO",
                         "video_ts.ifo")
        for mypath in possible_path:
            if os.path.exists(os.path.join(filepath, mypath)):
                is_dvd = True
                break

        if self.show_dir:
            if serviceref.flags & eServiceReference.mustDescent:
                res = [None]
                if self.show_icon:
                    if os.path.islink(serviceref.getPath().rstrip('/')):
                        png = self.symlink_icon
                    else:
                        png = self.folder_icon

                    x, y, w, h = skin.parameters.get("MovieListDirIcon",
                                                     (0, 2, 20, 20))
                    res.append(
                        (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, x,
                         y, w, h, png))
                    x, y, w, h = skin.parameters.get("MovieListDirectoryIcon",
                                                     (25, 0, width - 40, 30))
                    res.append(
                        MultiContentEntryText(pos=(x, y),
                                              size=(w, h),
                                              font=0,
                                              flags=RT_HALIGN_LEFT,
                                              text=serviceref.getName()))

                else:
                    x, y, w, h = skin.parameters.get(
                        "MovieListDirectoryNoIcon", (0, 0, width - 182, 30))
                    res.append(
                        MultiContentEntryText(pos=(x, y),
                                              size=(w, h),
                                              font=0,
                                              flags=RT_HALIGN_LEFT,
                                              text=serviceref.getName()))
                return res
        else:
            if serviceref.flags & eServiceReference.mustDescent:
                return None

        is_music = False
        if self.show_icon:
            filetype = serviceref.toString().split('.')
            filetype = filetype[-1].lower()
            if filetype == "iso":
                png = self.movie_dvd_icon
            elif filetype in MEDIAFILES_MOVIE:
                png = self.movie_new_icon
            elif filetype in MEDIAFILES_MUSIC:
                png = self.music_icon
                is_music = True
            elif is_dvd == True:
                png = self.movie_dvd_icon
            else:
                png = None

        moviename = os.path.realpath(serviceref.getPath())
        if info is not None:
            if len <= 0:  #recalc len when not already done
                cur_idx = self.l.getCurrentSelectionIndex()
                x = self.list[cur_idx]
                if config.usage.load_length_of_movies_in_moviellist.value:
                    len = x[1].getLength(x[0])  #recalc the movie length...
                    if len < 0:
                        len = self.getMovieLen(moviename)
                else:
                    len = 0  #dont recalc movielist to speedup loading the list
                self.list[cur_idx] = (
                    x[0], x[1], x[2], len
                )  #update entry in list... so next time we don't need to recalc

        if len > 0:
            clean_len = len
            if self.duration_in_min:
                len = "%d min" % (len / 60)
            else:
                len = "%d:%02d" % (len / 60, len % 60)
        else:
            len = ""
            clean_len = ""

        if self.show_progress != "progress_off":
            last_end_point = self.getProgress(moviename, clean_len)
            progress_string = str(last_end_point) + "% "
        else:
            last_end_point = 0

        if self.show_last_stop_time and clean_len != "":
            if self.show_progress == "progress_off":
                last_end_point = self.getProgress(moviename, clean_len)
            last_end = (last_end_point * clean_len) / 100
            if self.duration_in_min:
                len = "%d / %d min" % (last_end / 60, clean_len / 60)
            else:
                len = "%d:%02d / %d:%02d" % (last_end / 60, last_end % 60,
                                             clean_len / 60, clean_len % 60)

        if self.show_file_size and not (serviceref.flags
                                        & eServiceReference.mustDescent):
            f = os.path.realpath(serviceref.getPath())
            try:
                stat = os.stat(f)
            except OSError:
                stat = None
            f_size = "--"
            if stat:
                f_size = bytes2human(stat.st_size, 1)

        # check if we are executing a timer (code from TimerEntry.py TimerList.py)
        is_recording = False
        if NavigationInstance.instance.getRecordings():
            for timer in NavigationInstance.instance.RecordTimer.timer_list:
                if timer.state == TimerEntry.StateRunning:
                    if timer.justplay:
                        pass
                    else:
                        timerfile = os.path.realpath(timer.Filename + ".ts")
                        if timerfile == moviename:
                            is_recording = True

        res = [None]

        is_selected = False
        if serviceref in self.selected_entries:
            is_selected = True
        # set icons depending of current playstate
        if self.show_icon:
            if is_recording == True:
                png = self.movie_rec_icon
            elif last_end_point > self.progress_seen:
                png = self.movie_seen_icon
            elif last_end_point > 1:
                png = self.movie_start_icon
            if is_selected:
                png = self.movie_selected
        color = None
        if self.colorized:
            if is_recording == True:
                color = self.RecordingColor
            elif last_end_point > self.progress_seen:
                color = self.FinishedColor
            elif last_end_point > 1:
                color = self.WatchingColor
            else:
                color = self.UnwatchedColor

        if is_selected:
            color = self.SelectedColor

        if info is not None:
            txt = info.getName(serviceref)
            name, ext = os.path.splitext(txt)
            ext = ext.lstrip('.')
            if ext in MEDIAFILES_MOVIE or ext in MEDIAFILES_MUSIC:
                txt = name.replace("_", " ")
            service = ServiceReference(
                info.getInfoString(serviceref,
                                   iServiceInformation.sServiceref))
            description = info.getInfoString(serviceref,
                                             iServiceInformation.sDescription)
            tags = info.getInfoString(serviceref, iServiceInformation.sTags)

        begin_string = ""
        if begin > 0:
            if is_recording == True:
                begin_string = _("recording...")
                if self.only_day:
                    begin_string = _("REC")
            else:
                if self.list_type != MovieList.LISTTYPE_MINIMALVTI:
                    t = FuzzyTime(begin)
                    begin_string = t[0] + ", " + t[1]
                else:
                    d = datetime.fromtimestamp(begin)
                    if self.only_day:
                        begin_string = d.strftime("%d.%m.%y")
                    else:
                        begin_string = d.strftime("%d.%m.%y-%H:%M")

        if last_end_point == None:
            last_end_point = 0

        # begin offset calculation for icons and progress
        offset = 0
        if self.show_icon:
            offset = skin.parameters.get("MovieListIconXOffset", (25, ))[0]

        extra_y_offset = 0
        if self.list_type == MovieList.LISTTYPE_MINIMALVTI:
            extra_y_offset = skin.parameters.get(
                "MovieListProgressBarXtraYOffsetVTIStyle", (2, ))[0]

        if (self.show_progress == "progress_percent"
                or self.show_progress == "progress_bar") and is_music == False:
            if self.show_progress == "progress_bar":
                x, y, w, h = skin.parameters.get(
                    "MovieListProgress", (0, extra_y_offset + 7, 60, 10))
                b = skin.parameters.get("MovieListProgressBorder", (2, ))[0]
                res.append(
                    MultiContentEntryProgress(pos=(offset + x, y),
                                              size=(w, h),
                                              percent=last_end_point,
                                              borderWidth=b,
                                              foreColor=color))
            elif self.show_progress == "progress_percent":
                x, y, w, h = skin.parameters.get("MovieListProgressPercent",
                                                 (0, 0, 60, 23))
                res.append(
                    MultiContentEntryText(pos=(offset + x, y),
                                          size=(w, h),
                                          font=0,
                                          flags=RT_HALIGN_LEFT,
                                          text=progress_string,
                                          color=color))
            offset += w + 4

        if self.show_icon:
            x, y, w, h = skin.parameters.get("MovieListIcon", (0, 3, 20, 20))
            res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, x, y,
                        w, h, png))

        duration_size = 0
        if self.show_duration:
            x, y, z = skin.parameters.get("MovieListDurationSize",
                                          (90, 150, 130))
            duration_size = x
            if self.show_last_stop_time:
                duration_size = y
                if self.duration_in_min:
                    duration_size = z
        if self.list_type == MovieList.LISTTYPE_ORIGINAL:
            x, y, w, h = skin.parameters.get("MovieListOriginalTitle",
                                             (0, 0, width - 182, 30))
            res.append(
                MultiContentEntryText(pos=(offset + x, y),
                                      size=(w - offset, h),
                                      font=0,
                                      flags=RT_HALIGN_LEFT,
                                      color=color,
                                      text=txt))
            if self.tags:
                x, y, w, h = skin.parameters.get("MovieListOriginalTags",
                                                 (width - 180, 0, 180, 30))
                res.append(
                    MultiContentEntryText(pos=(x, y),
                                          size=(w, h),
                                          font=2,
                                          flags=RT_HALIGN_RIGHT,
                                          text=tags))
                if service is not None:
                    x, y, w, h = skin.parameters.get(
                        "MovieListOriginalServiceTags", (200, 50, 200, 30))
                    res.append(
                        MultiContentEntryText(pos=(x, y),
                                              size=(w, h),
                                              font=1,
                                              flags=RT_HALIGN_LEFT,
                                              text=service.getServiceName()))
            else:
                if service is not None:
                    x, y, w, h = skin.parameters.get(
                        "MovieListOriginalServiceTags",
                        (width - 180, 0, 180, 30))
                    res.append(
                        MultiContentEntryText(pos=(x, y),
                                              size=(w, h),
                                              font=2,
                                              flags=RT_HALIGN_RIGHT,
                                              text=service.getServiceName()))
            x, y, w, h = skin.parameters.get("MovieListOriginalDescription",
                                             (0, 30, width, 20))
            res.append(
                MultiContentEntryText(pos=(x, y),
                                      size=(w, h),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=description))
            x, y, w, h = skin.parameters.get("MovieListOriginalBegin",
                                             (0, 50, 200, 20))
            res.append(
                MultiContentEntryText(pos=(x, y),
                                      size=(w, h),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=begin_string))
            x, y, w, h = skin.parameters.get("MovieListOriginalLength",
                                             (width + 2, 50, 0, 20))
            res.append(
                MultiContentEntryText(pos=(x - duration_size, y),
                                      size=(duration_size + w, h),
                                      font=1,
                                      flags=RT_HALIGN_RIGHT,
                                      text=len))
        elif self.list_type == MovieList.LISTTYPE_COMPACT_DESCRIPTION:
            x, y, w, h = skin.parameters.get("MovieListCompactDescTitle",
                                             (0, 0, width - 122, 23))
            res.append(
                MultiContentEntryText(pos=(offset + x, y),
                                      size=(w - offset - duration_size, h),
                                      font=0,
                                      flags=RT_HALIGN_LEFT,
                                      color=color,
                                      text=txt))
            x, y, w, h = skin.parameters.get("MovieListCompactDescDescription",
                                             (0, 25, width - 212, 17))
            res.append(
                MultiContentEntryText(pos=(x, y),
                                      size=(w, h),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=description))
            x, y, w, h = skin.parameters.get("MovieListCompactDescBegin",
                                             (width - 120, 6, 120, 20))
            res.append(
                MultiContentEntryText(pos=(x, y),
                                      size=(w, h),
                                      font=1,
                                      flags=RT_HALIGN_RIGHT,
                                      text=begin_string))
            if service is not None:
                x, y, w, h = skin.parameters.get("MovieListCompactDescService",
                                                 (width - 212, 25, 154, 17))
                res.append(
                    MultiContentEntryText(pos=(x, y),
                                          size=(w, h),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=service.getServiceName()))
                x, y, w, h = skin.parameters.get("MovieListCompactDescLength",
                                                 (width, 25, 0, 20))
            res.append(
                MultiContentEntryText(pos=(x - duration_size, y),
                                      size=(duration_size + w, h),
                                      font=1,
                                      flags=RT_HALIGN_RIGHT,
                                      text=len))
        elif self.list_type == MovieList.LISTTYPE_COMPACT:
            x, y, w, h = skin.parameters.get("MovieListCompactTitle",
                                             (0, 0, width - 77, 23))
            res.append(
                MultiContentEntryText(pos=(offset + x, y),
                                      size=(w - offset - duration_size, h),
                                      font=0,
                                      flags=RT_HALIGN_LEFT,
                                      color=color,
                                      text=txt))
            if self.tags:
                x, y, w, h = skin.parameters.get("MovieListCompactTags",
                                                 (width - 200, 25, 200, 17))
                res.append(
                    MultiContentEntryText(pos=(x, y),
                                          size=(w, h),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=tags))
                if service is not None:
                    x, y, w, h = skin.parameters.get(
                        "MovieListCompactServiceTags", (200, 25, 200, 17))
                    res.append(
                        MultiContentEntryText(pos=(x, y),
                                              size=(w, h),
                                              font=1,
                                              flags=RT_HALIGN_LEFT,
                                              text=service.getServiceName()))
            else:
                if service is not None:
                    x, y, w, h = skin.parameters.get(
                        "MovieListCompactService", (width - 200, 25, 200, 17))
                    res.append(
                        MultiContentEntryText(pos=(x, y),
                                              size=(w, h),
                                              font=1,
                                              flags=RT_HALIGN_RIGHT,
                                              text=service.getServiceName()))
            x, y, w, h = skin.parameters.get("MovieListCompactBegin",
                                             (0, 25, 200, 17))
            res.append(
                MultiContentEntryText(pos=(x, y),
                                      size=(w, h),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=begin_string))
            x, y, w, h = skin.parameters.get("MovieListCompactLength",
                                             (width, 0, 0, 22))
            res.append(
                MultiContentEntryText(pos=(x - duration_size, y),
                                      size=(duration_size + w, h),
                                      font=0,
                                      flags=RT_HALIGN_RIGHT,
                                      text=len))
        elif self.list_type == MovieList.LISTTYPE_MINIMALVTI:
            x, y, z = skin.parameters.get("MovieListChannelSize", (110, 50, 0))
            channel_size = x
            if self.show_picon:
                channel_size = y
            if not self.show_channel_info:
                channel_size = z
            x, y = skin.parameters.get("MovieListNameXtraSize", (0, 60))
            xtra_size = x
            if width > 850 and not self.show_picon:
                xtra_size = y
            x, y = skin.parameters.get("MovieListFileSize", (0, 100))
            file_size = x
            if self.show_file_size:
                file_size = y
            x, y, z = skin.parameters.get("MovieListBeginStringSize",
                                          (160, 110, 0))
            begin_string_size = x
            if self.only_day:
                begin_string_size = y
            if not self.show_recording_date:
                begin_string_size = z
            if self.descr_state == MovieList.SHOW_DESCRIPTION and description != "":
                txt = txt + " - " + description
            x, y, w, h = skin.parameters.get("MovieListMinimalVTITitle",
                                             (0, 0, width - 25, 30))
            res.append(
                MultiContentEntryText(
                    pos=(offset + x, y),
                    size=(w - begin_string_size - duration_size - offset -
                          channel_size - xtra_size - file_size, h),
                    font=0,
                    flags=RT_HALIGN_LEFT,
                    color=color,
                    text=txt))
            if self.show_recording_date:
                x, y, w, h = skin.parameters.get("MovieListMinimalVTIBegin",
                                                 (width - 5, 0, 0, 30))
                res.append(
                    MultiContentEntryText(
                        pos=(x - duration_size - begin_string_size - file_size,
                             y),
                        size=(w + begin_string_size, h),
                        font=1,
                        flags=RT_HALIGN_RIGHT,
                        text=begin_string))
            if self.show_duration:
                x, y, w, h = skin.parameters.get("MovieListMinimalVTILength",
                                                 (width, 0, 0, 30))
                res.append(
                    MultiContentEntryText(pos=(x - duration_size - file_size,
                                               y),
                                          size=(w + duration_size, h),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=len))
            if self.show_file_size:
                x, y, w, h = skin.parameters.get("MovieListMinimalVTISize",
                                                 (width, 0, 0, 30))
                res.append(
                    MultiContentEntryText(pos=(x - file_size, y),
                                          size=(w + file_size, h),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=f_size))
            if self.show_channel_info and service:
                if self.show_picon:
                    picon = findPicon(service.ref.toString())
                    if fileExists(picon):
                        x, y, w, h = skin.parameters.get(
                            "MovieListMinimalVTIPicon",
                            (width - 40, 0, 50, 30))
                        res.append(
                            MultiContentEntryPixmapAlphaTest(
                                pos=(x - duration_size - begin_string_size -
                                     xtra_size - file_size, y),
                                size=(w, h),
                                png=LoadPixmap(picon),
                                options=BT_SCALE | BT_FIXRATIO))
                else:
                    x, y, w, h = skin.parameters.get(
                        "MovieListMinimalVTIService", (width - 105, 0, 0, 30))
                    res.append(
                        MultiContentEntryText(
                            pos=(x - duration_size - begin_string_size -
                                 xtra_size - file_size, y),
                            size=(channel_size + xtra_size + w, h),
                            font=1,
                            flags=RT_HALIGN_LEFT,
                            text=service.getServiceName()))
        else:
            assert (self.list_type == MovieList.LISTTYPE_MINIMAL)
            if self.descr_state == MovieList.SHOW_DESCRIPTION:
                x, y, w, h = skin.parameters.get("MovieListMinimalTitleDesc",
                                                 (0, 0, width - 146, 23))
                res.append(
                    MultiContentEntryText(pos=(offset + x, y),
                                          size=(w - offset, h),
                                          font=0,
                                          flags=RT_HALIGN_LEFT,
                                          color=color,
                                          text=txt))
                x, y, w, h = skin.parameters.get("MovieListMinimalBegin",
                                                 (width - 145, 4, 145, 20))
                res.append(
                    MultiContentEntryText(pos=(x, y),
                                          size=(w, h),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=begin_string))
            else:
                x, y, w, h = skin.parameters.get("MovieListMinimalTitle",
                                                 (0, 0, width - 77, 23))
                res.append(
                    MultiContentEntryText(pos=(offset + x, y),
                                          size=(w - offset, h),
                                          font=0,
                                          flags=RT_HALIGN_LEFT,
                                          color=color,
                                          text=txt))
                x, y, w, h = skin.parameters.get("MovieListMinimalLength",
                                                 (width - 75, 0, 75, 20))
                res.append(
                    MultiContentEntryText(pos=(x, y),
                                          size=(w, h),
                                          font=0,
                                          flags=RT_HALIGN_RIGHT,
                                          text=len))

        return res
Example #8
0
	def buildMovieListEntry(self, serviceref, info, begin, data):
		switch = config.usage.show_icons_in_movielist.value
		width = self.l.getItemSize().width()
		dateWidth = self.dateWidth
		if config.usage.time.wide.value:
			dateWidth = int(dateWidth * 1.15)
		if not config.movielist.use_fuzzy_dates.value:
			dateWidth += 35
		showLen = self.showCol(config.movielist.showlengths, self.COL_LENGTH)
		lenWidth = self.lenWidth if showLen else 0
		showSize = self.showCol(config.movielist.showsizes, self.COL_SIZE)
		sizeWidth = self.sizeWidth if showSize else 0
		markSize = self.markWidth
		iconSize = self.iconsWidth
		space = self.spaceIconeText
		r = self.spaceRight
		ih = self.itemHeight
		pathName = serviceref.getPath()
		res = [None]

		res.append(MultiContentEntryPixmapAlphaBlend(pos=(self.listPos - markSize - space, self.markShift), size=(markSize, self.iconMarked[0].size().height()), png=self.iconMarked[self.getCurrent() in self.markList]))
		iconPos = self.listPos
		textPos = iconPos + iconSize + space

		if serviceref.flags & eServiceReference.mustDescent:
			# Directory
			# Name is full path name
			if info is None:
				# Special case: "parent"
				txt = ".."
			else:
				txt = os.path.basename(os.path.normpath(pathName))
			if txt == ".Trash":
				res.append(MultiContentEntryPixmapAlphaBlend(pos=(iconPos, self.trashShift), size=(iconSize, self.iconTrash.size().height()), png=self.iconTrash))
				res.append(MultiContentEntryText(pos=(textPos, 0), size=(width - textPos - dateWidth - r, ih), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text = _("Trash")))
				res.append(MultiContentEntryText(pos=(width - dateWidth - r, 0), size=(dateWidth, ih), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=_("Trash")))
				return res
			res.append(MultiContentEntryPixmapAlphaBlend(pos=(iconPos, self.dirShift), size=(iconSize, iconSize), png=self.iconFolder))
			res.append(MultiContentEntryText(pos=(textPos, 0), size=(width - textPos - dateWidth - r, ih), font=0, flags = RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=txt))
			res.append(MultiContentEntryText(pos=(width - dateWidth - r, 0), size=(dateWidth, ih), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=_("Directory")))
			return res
		if data == -1 or data is None:
			data = MovieListData()
			cur_idx = self.l.getCurrentSelectionIndex()
			x = self.list[cur_idx]  # x = ref,info,begin,...
			data.len = info.getLength(serviceref)
			if showSize:
				data.size = info.getFileSize(serviceref)
			self.list[cur_idx] = (x[0], x[1], x[2], data)  # update entry in list... so next time we don't need to recalc
			data.txt = info.getName(serviceref)
			if config.movielist.hide_extensions.value:
				fileName, fileExtension = os.path.splitext(data.txt)
				if fileExtension in KNOWN_EXTENSIONS:
					data.txt = fileName
			data.icon = None
			data.part = None
			if os.path.basename(pathName) in self.runningTimers:
				if switch == 'i':
					if (self.playInBackground or self.playInForeground) and serviceref == (self.playInBackground or self.playInForeground):
						data.icon = self.iconMoviePlayRec
					else:
						data.icon = self.iconMovieRec
				elif switch in ('p', 's'):
					data.part = 100
					if (self.playInBackground or self.playInForeground) and serviceref == (self.playInBackground or self.playInForeground):
						data.partcol = self.pbarColourSeen
						data.partcolsel = self.pbarColourSeenSel
					else:
						data.partcol = self.pbarColourRec
						data.partcolsel = self.pbarColourRecSel
			elif (self.playInBackground or self.playInForeground) and serviceref == (self.playInBackground or self.playInForeground):
				data.icon = self.iconMoviePlay
			else:
				data.part = moviePlayState(pathName + '.cuts', serviceref, data.len * 90000)
				if switch == 'i':
					if data.part is not None and data.part >= 0:
						data.icon = self.iconPart[data.part // 25]
					else:
						if config.usage.movielist_unseen.value:
							data.icon = self.iconUnwatched
				elif switch in ('p', 's'):
					if data.part is not None and data.part > 0:
						data.partcol = self.pbarColourSeen
						data.partcolsel = self.pbarColourSeenSel
					else:
						if config.usage.movielist_unseen.value:
							data.part = 100
							data.partcol = self.pbarColour
							data.partcolsel = self.pbarColourSel
		if showLen:
			len = data.len
			len = "%d:%02d" % (len / 60, len % 60) if len > 0 else ""
		if showSize:
			size = _("%s %sB") % UnitScaler()(data.size) if data.size > 0 else ""

		if data:
			if switch == 'i' and hasattr(data, 'icon') and data.icon is not None:
				if self.partIconeShift is None:
					partIconeShift = max(0, int((ih - data.icon.size().height()) / 2))
				else:
					partIconeShift = self.partIconeShift
				pos = (iconPos, partIconeShift)
				res.append(MultiContentEntryPixmapAlphaBlend(pos=pos, size=(iconSize, data.icon.size().height()), png=data.icon))
			elif switch in ('p', 's'):
				if switch == 'p':
					iconSize = self.pbarLargeWidth
					textPos = iconPos + iconSize + space
				if hasattr(data, 'part') and data.part > 0:
					res.append(MultiContentEntryProgress(pos=(iconPos, self.pbarShift), size=(iconSize, self.pbarHeight), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=data.partcolsel, backColor=None, backColorSelected=None))
				elif hasattr(data, 'icon') and data.icon is not None:
					res.append(MultiContentEntryPixmapAlphaBlend(pos=(iconPos, self.pbarShift), size=(iconSize, self.pbarHeight), png=data.icon))

		begin_string = ""
		if begin > 0:
			if config.movielist.use_fuzzy_dates.value:
				begin_string = ' '.join(FuzzyTime(begin, inPast = True))
			else:
				begin_string = strftime("%s %s" % (config.usage.date.daylong.value, config.usage.time.short.value), localtime(begin))

		textItems = []
		xPos = width

		if showSize:
			xPos -= sizeWidth + r
			textItems.insert(0, MultiContentEntryText(pos=(xPos, 0), size=(sizeWidth, ih), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=size))
		if showLen:
			xPos -= lenWidth + r
			textItems.insert(0, MultiContentEntryText(pos=(xPos, 0), size=(lenWidth, ih), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=len))
		xPos -= dateWidth + r
		textItems.insert(0, MultiContentEntryText(pos=(xPos, 0), size=(dateWidth, ih), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=begin_string))
		textItems.insert(0, MultiContentEntryText(pos=(textPos, 0), size=(xPos - textPos, ih), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=data.txt))

		res += textItems
		return res
Example #9
0
def vZapHistoryBrowserListEntry(serviceName, eventName, durationTime, bar,
                                png):
    res = [serviceName]
    lasflags = RT_HALIGN_LEFT
    if config.plugins.vZapHistory.alignment.value == 'center':
        lasflags = RT_HALIGN_CENTER
    elif config.plugins.vZapHistory.alignment.value == 'right':
        lasflags = RT_HALIGN_RIGHT
    namecolor = int(config.plugins.vZapHistory.namecolor.value, 16)
    namecolor_sel = int(config.plugins.vZapHistory.namecolor_sel.value, 16)
    eventcolor = int(config.plugins.vZapHistory.eventcolor.value, 16)
    eventcolor_sel = int(config.plugins.vZapHistory.eventcolor_sel.value, 16)
    duratcolor = int(config.plugins.vZapHistory.duratcolor.value, 16)
    duratcolor_sel = int(config.plugins.vZapHistory.duratcolor_sel.value, 16)
    barcolor = int(config.plugins.vZapHistory.barcolor.value, 16)
    barcolor_sel = int(config.plugins.vZapHistory.barcolor_sel.value, 16)
    if config.plugins.vZapHistory.viewMode.value == 'picons':
        res.append(
            MultiContentEntryPixmapAlphaBlend(pos=(5, 5),
                                              size=(100, 60),
                                              flags=BT_SCALE,
                                              png=png))
        res.append(
            MultiContentEntryText(pos=(110, 3),
                                  size=(535, 25),
                                  font=0,
                                  flags=lasflags,
                                  text=serviceName,
                                  color=namecolor,
                                  color_sel=namecolor_sel))
        res.append(
            MultiContentEntryText(pos=(110, 28),
                                  size=(535, 40),
                                  font=1,
                                  flags=lasflags | RT_VALIGN_CENTER | RT_WRAP,
                                  text=eventName,
                                  color=eventcolor,
                                  color_sel=eventcolor_sel))
        res.append(
            MultiContentEntryText(pos=(660, 16),
                                  size=(165, 25),
                                  font=2,
                                  flags=lasflags,
                                  text=durationTime,
                                  color=duratcolor,
                                  color_sel=duratcolor_sel))
        if bar != 0:
            res.append(
                MultiContentEntryProgress(pos=(660, 45),
                                          size=(165, 10),
                                          percent=bar,
                                          borderWidth=1,
                                          foreColor=barcolor,
                                          foreColorSelected=barcolor_sel))
    elif config.plugins.vZapHistory.viewMode.value == 'menu':
        res.append(
            MultiContentEntryText(pos=(5, 3),
                                  size=(640, 25),
                                  font=0,
                                  flags=lasflags,
                                  text=serviceName,
                                  color=namecolor,
                                  color_sel=namecolor_sel))
        res.append(
            MultiContentEntryText(pos=(5, 28),
                                  size=(640, 40),
                                  font=1,
                                  flags=lasflags | RT_WRAP,
                                  text=eventName,
                                  color=eventcolor,
                                  color_sel=eventcolor_sel))
        res.append(
            MultiContentEntryText(pos=(660, 6),
                                  size=(165, 25),
                                  font=2,
                                  flags=lasflags,
                                  text=durationTime,
                                  color=duratcolor,
                                  color_sel=duratcolor_sel))
        if bar != 0:
            res.append(
                MultiContentEntryProgress(pos=(660, 30),
                                          size=(165, 10),
                                          percent=bar,
                                          borderWidth=1,
                                          foreColor=barcolor,
                                          foreColorSelected=barcolor_sel))
    return res
Example #10
0
    def buildMovieListEntry(self, serviceref, info, begin, data):
        switch = config.usage.show_icons_in_movielist.value
        ext = config.movielist.useextlist.value
        width = self.l.getItemSize().width()
        pathName = serviceref.getPath()
        res = [None]
        if serviceref.flags & eServiceReference.mustDescent:
            if self.screenwidth and self.screenwidth == 1920:
                iconSize = 37
            else:
                iconSize = 22
            if info is None:
                txt = '..'
            else:
                p = os.path.split(pathName)
                if not p[1]:
                    p = os.path.split(p[0])
                txt = p[1]
                if txt == '.Trash':
                    if self.screenwidth and self.screenwidth == 1920:
                        res.append(
                            MultiContentEntryPixmapAlphaBlend(
                                pos=(3, 5),
                                size=(iconSize, 37),
                                png=self.iconTrash))
                        res.append(
                            MultiContentEntryText(pos=(60, 5),
                                                  size=(width - 166,
                                                        self.itemHeight),
                                                  font=0,
                                                  flags=RT_HALIGN_LEFT,
                                                  text=_('Deleted items')))
                        res.append(
                            MultiContentEntryText(pos=(width - 145, 0),
                                                  size=(145, self.itemHeight),
                                                  font=1,
                                                  flags=RT_HALIGN_RIGHT
                                                  | RT_VALIGN_CENTER,
                                                  text=_('Trashcan')))
                        return res
                    else:
                        res.append(
                            MultiContentEntryPixmapAlphaBlend(
                                pos=(0, 2),
                                size=(iconSize, 24),
                                png=self.iconTrash))
                        res.append(
                            MultiContentEntryText(pos=(iconSize + 10, 0),
                                                  size=(width - 166,
                                                        self.itemHeight),
                                                  font=0,
                                                  flags=RT_HALIGN_LEFT,
                                                  text=_('Deleted items')))
                        res.append(
                            MultiContentEntryText(pos=(width - 150, 0),
                                                  size=(145, self.itemHeight),
                                                  font=1,
                                                  flags=RT_HALIGN_RIGHT
                                                  | RT_VALIGN_CENTER,
                                                  text=_('Trashcan')))
                        return res
            if self.screenwidth and self.screenwidth == 1920:
                res.append(
                    MultiContentEntryPixmapAlphaBlend(pos=(3, 5),
                                                      size=(iconSize,
                                                            iconSize),
                                                      png=self.iconFolder))
                res.append(
                    MultiContentEntryText(pos=(60, 5),
                                          size=(width - 166, self.itemHeight),
                                          font=0,
                                          flags=RT_HALIGN_LEFT,
                                          text=txt))
                res.append(
                    MultiContentEntryText(pos=(width - 145, 0),
                                          size=(145, self.itemHeight),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT
                                          | RT_VALIGN_CENTER,
                                          text=_('Directory')))
                return res
            else:
                res.append(
                    MultiContentEntryPixmapAlphaBlend(pos=(0, 2),
                                                      size=(iconSize,
                                                            iconSize),
                                                      png=self.iconFolder))
                res.append(
                    MultiContentEntryText(pos=(iconSize + 10, 0),
                                          size=(width - 166, self.itemHeight),
                                          font=0,
                                          flags=RT_HALIGN_LEFT,
                                          text=txt))
                res.append(
                    MultiContentEntryText(pos=(width - 150, 0),
                                          size=(145, self.itemHeight),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT
                                          | RT_VALIGN_CENTER,
                                          text=_('Directory')))
                return res
        if data == -1 or data is None:
            data = MovieListData()
            cur_idx = self.l.getCurrentSelectionIndex()
            x = self.list[cur_idx]
            data.len = 0
            self.list[cur_idx] = (x[0], x[1], x[2], data)
            data.txt = info.getName(serviceref)
            if config.movielist.hide_extensions.value:
                fileName, fileExtension = os.path.splitext(data.txt)
                if fileExtension in KNOWN_EXTENSIONS:
                    data.txt = fileName
            data.icon = None
            data.part = None
            if os.path.split(pathName)[1] in self.runningTimers:
                if switch == 'i':
                    if (self.playInBackground or self.playInForeground
                        ) and serviceref == (self.playInBackground
                                             or self.playInForeground):
                        data.icon = self.iconMoviePlayRec
                    else:
                        data.icon = self.iconMovieRec
                elif switch == 'p' or switch == 's':
                    data.part = 100
                    if (self.playInBackground or self.playInForeground
                        ) and serviceref == (self.playInBackground
                                             or self.playInForeground):
                        data.partcol = 16762653
                    else:
                        data.partcol = 16711709
            elif (self.playInBackground
                  or self.playInForeground) and serviceref == (
                      self.playInBackground or self.playInForeground):
                data.icon = self.iconMoviePlay
            else:
                data.part = moviePlayState(pathName + '.cuts', serviceref,
                                           data.len)
                if switch == 'i':
                    if data.part is not None and data.part > 0:
                        data.icon = self.iconPart[data.part // 25]
                    elif config.usage.movielist_unseen.value:
                        data.icon = self.iconUnwatched
                elif switch == 'p' or switch == 's':
                    if data.part is not None and data.part > 0:
                        data.partcol = 16762653
                    elif config.usage.movielist_unseen.value:
                        data.part = 100
                        data.partcol = 2122547
        len = data.len
        if len > 0:
            len = '%d:%02d' % (len / 60, len % 60)
        else:
            len = ''
        iconSize = 0
        if switch == 'i':
            if self.screenwidth and self.screenwidth == 1920:
                iconSize = 42
                res.append(
                    MultiContentEntryPixmapAlphaBlend(pos=(2, 3),
                                                      size=(iconSize,
                                                            iconSize),
                                                      png=data.icon))
            else:
                iconSize = 22
                res.append(
                    MultiContentEntryPixmapAlphaBlend(pos=(0, 1),
                                                      size=(iconSize, 20),
                                                      png=data.icon))
        elif switch == 'p':
            if self.screenwidth and self.screenwidth == 1920:
                iconSize = 42
            else:
                iconSize = 48
            if data.part is not None and data.part > 0:
                if self.screenwidth and self.screenwidth == 1920:
                    res.append(
                        MultiContentEntryProgress(pos=(0, 10),
                                                  size=(iconSize + 5, 16),
                                                  percent=data.part,
                                                  borderWidth=2,
                                                  foreColor=data.partcol,
                                                  foreColorSelected=None,
                                                  backColor=None,
                                                  backColorSelected=None))
                else:
                    res.append(
                        MultiContentEntryProgress(pos=(0, 5),
                                                  size=(iconSize - 2, 16),
                                                  percent=data.part,
                                                  borderWidth=2,
                                                  foreColor=data.partcol,
                                                  foreColorSelected=None,
                                                  backColor=None,
                                                  backColorSelected=None))
            elif self.screenwidth and self.screenwidth == 1920:
                res.append(
                    MultiContentEntryPixmapAlphaBlend(pos=(0, 1),
                                                      size=(iconSize,
                                                            iconSize),
                                                      png=data.icon))
            else:
                res.append(
                    MultiContentEntryPixmapAlphaBlend(pos=(0, 1),
                                                      size=(iconSize, 20),
                                                      png=data.icon))
        elif switch == 's':
            if self.screenwidth and self.screenwidth == 1920:
                iconSize = 42
            else:
                iconSize = 22
            if data.part is not None and data.part > 0:
                if self.screenwidth and self.screenwidth == 1920:
                    res.append(
                        MultiContentEntryProgress(pos=(0, 10),
                                                  size=(iconSize + 5, 16),
                                                  percent=data.part,
                                                  borderWidth=2,
                                                  foreColor=data.partcol,
                                                  foreColorSelected=None,
                                                  backColor=None,
                                                  backColorSelected=None))
                else:
                    res.append(
                        MultiContentEntryProgress(pos=(0, 5),
                                                  size=(iconSize - 2, 16),
                                                  percent=data.part,
                                                  borderWidth=2,
                                                  foreColor=data.partcol,
                                                  foreColorSelected=None,
                                                  backColor=None,
                                                  backColorSelected=None))
            elif self.screenwidth and self.screenwidth == 1920:
                res.append(
                    MultiContentEntryPixmapAlphaBlend(pos=(0, 1),
                                                      size=(iconSize,
                                                            iconSize),
                                                      png=data.icon))
            else:
                res.append(
                    MultiContentEntryPixmapAlphaBlend(pos=(0, 1),
                                                      size=(iconSize, 20),
                                                      png=data.icon))
        begin_string = ''
        if begin > 0:
            begin_string = ', '.join(FuzzyTime(begin, inPast=True))
        if ext != '0':
            ih = self.itemHeight / 2
        else:
            ih = self.itemHeight
        lenSize = ih * 3
        dateSize = ih * 145 / 25
        if ext != '0':
            getrec = info.getName(serviceref)
            fileName, fileExtension = os.path.splitext(getrec)
            desc = None
            picon = None
            service = None
            try:
                serviceHandler = eServiceCenter.getInstance()
                info = serviceHandler.info(serviceref)
                desc = info.getInfoString(serviceref,
                                          iServiceInformation.sDescription)
                ref = info.getInfoString(serviceref,
                                         iServiceInformation.sServiceref)
                service = ServiceReference(ref).getServiceName()
            except Exception as e:
                print('[MovieList] load extended infos get failed: ', e)

            if ext == '2':
                try:
                    picon = getPiconName(ref)
                    picon = loadPNG(picon)
                except Exception as e:
                    print('[MovieList] load picon get failed: ', e)

            if fileExtension in RECORD_EXTENSIONS:
                if self.screenwidth and self.screenwidth == 1920:
                    if ext == '1':
                        res.append(
                            MultiContentEntryText(
                                pos=(iconSize + 20, 5),
                                size=(width - iconSize - dateSize -
                                      dateSize / 2 - 15, ih),
                                font=0,
                                flags=RT_HALIGN_LEFT,
                                text=data.txt))
                        res.append(
                            MultiContentEntryText(
                                pos=(width - dateSize - dateSize / 2 - 5, 1),
                                size=(dateSize + dateSize / 2, ih),
                                font=1,
                                flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER,
                                text=service))
                    if ext == '2':
                        piconSize = ih * 2
                        res.append(
                            MultiContentEntryText(pos=(iconSize + 20, 5),
                                                  size=(width - iconSize -
                                                        dateSize - 15, ih + 2),
                                                  font=0,
                                                  flags=RT_HALIGN_LEFT,
                                                  text=data.txt))
                        res.append(
                            MultiContentEntryPixmapAlphaTest(
                                pos=(width - 48 - 5, 1),
                                size=(piconSize, ih - 2),
                                png=picon,
                                flags=BT_SCALE | BT_KEEP_ASPECT_RATIO))
                    res.append(
                        MultiContentEntryText(pos=(iconSize + 20, ih),
                                              size=(width - iconSize -
                                                    dateSize - 15, ih),
                                              font=1,
                                              flags=RT_HALIGN_LEFT,
                                              text=desc))
                    res.append(
                        MultiContentEntryText(pos=(width - dateSize, 0),
                                              size=(dateSize, ih),
                                              font=1,
                                              flags=RT_HALIGN_RIGHT,
                                              text=begin_string))
                    return res
                else:
                    if ext == '1':
                        res.append(
                            MultiContentEntryText(
                                pos=(iconSize + 8, 0),
                                size=(width - iconSize - dateSize -
                                      dateSize / 2 - 15, ih),
                                font=0,
                                flags=RT_HALIGN_LEFT,
                                text=data.txt))
                        res.append(
                            MultiContentEntryText(
                                pos=(width - dateSize - dateSize / 2 - 5, 1),
                                size=(dateSize + dateSize / 2, ih),
                                font=1,
                                flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER,
                                text=service))
                    if ext == '2':
                        piconSize = ih * 2
                        res.append(
                            MultiContentEntryText(pos=(iconSize + 8, 0),
                                                  size=(width - iconSize -
                                                        dateSize - 15, ih + 2),
                                                  font=0,
                                                  flags=RT_HALIGN_LEFT,
                                                  text=data.txt))
                        res.append(
                            MultiContentEntryPixmapAlphaTest(
                                pos=(width - 48 - 5, 1),
                                size=(piconSize, ih - 2),
                                png=picon,
                                flags=BT_SCALE | BT_KEEP_ASPECT_RATIO))
                    res.append(
                        MultiContentEntryText(pos=(iconSize + 8, ih),
                                              size=(width - iconSize -
                                                    dateSize - 15, ih),
                                              font=1,
                                              flags=RT_HALIGN_LEFT,
                                              text=desc))
                    res.append(
                        MultiContentEntryText(pos=(width - dateSize - 5, ih),
                                              size=(dateSize, ih),
                                              font=1,
                                              flags=RT_HALIGN_RIGHT
                                              | RT_VALIGN_CENTER,
                                              text=begin_string))
                    return res
            elif self.screenwidth and self.screenwidth == 1920:
                res.append(
                    MultiContentEntryText(pos=(iconSize + 20, 5),
                                          size=(width - iconSize - dateSize -
                                                15, ih),
                                          font=0,
                                          flags=RT_HALIGN_LEFT,
                                          text=data.txt))
                res.append(
                    MultiContentEntryText(pos=(width - dateSize, ih),
                                          size=(dateSize, ih),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=begin_string))
                return res
            else:
                res.append(
                    MultiContentEntryText(pos=(iconSize + 8, 0),
                                          size=(width - iconSize - dateSize -
                                                15, ih),
                                          font=0,
                                          flags=RT_HALIGN_LEFT,
                                          text=data.txt))
                res.append(
                    MultiContentEntryText(pos=(width - dateSize - 5, ih),
                                          size=(dateSize, ih),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT
                                          | RT_VALIGN_CENTER,
                                          text=begin_string))
                return res

        else:
            if self.screenwidth and self.screenwidth == 1920:
                res.append(
                    MultiContentEntryText(pos=(iconSize + 20, 5),
                                          size=(width - iconSize - dateSize -
                                                15, ih),
                                          font=0,
                                          flags=RT_HALIGN_LEFT,
                                          text=data.txt))
                res.append(
                    MultiContentEntryText(pos=(width - dateSize, 0),
                                          size=(dateSize, ih),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=begin_string))
                return res
            res.append(
                MultiContentEntryText(pos=(iconSize + 8, 0),
                                      size=(width - iconSize - dateSize - 15,
                                            ih),
                                      font=0,
                                      flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER,
                                      text=data.txt))
            res.append(
                MultiContentEntryText(pos=(width - dateSize - 5, 0),
                                      size=(dateSize, ih),
                                      font=1,
                                      flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER,
                                      text=begin_string))
            return res
        return
Example #11
0
	def buildMovieListEntry(self, serviceref, info, begin, data):
		switch = config.usage.show_icons_in_movielist.value
		ext = config.movielist.useextlist.value
		width = self.l.getItemSize().width()
		pathName = serviceref.getPath()
		res = [ None ]

		if serviceref.flags & eServiceReference.mustDescent:
			if self.screenwidth and self.screenwidth == 1920:
				# Directory
				iconSize = 37
			else:
				iconSize = 22
			# Name is full path name
			if info is None:
				# Special case: "parent"
				txt = ".."
			else:
				p = os.path.split(pathName)
				if not p[1]:
					# if path ends in '/', p is blank.
					p = os.path.split(p[0])
				txt = p[1]
				if txt == ".Trash":
					if self.screenwidth and self.screenwidth == 1920:
						res.append(MultiContentEntryPixmapAlphaBlend(pos=(3,5), size=(iconSize,37), png=self.iconTrash))
						res.append(MultiContentEntryText(pos=(40+20, 5), size=(width-166, self.itemHeight), font = 0, flags = RT_HALIGN_LEFT, text = _("Deleted items")))
						res.append(MultiContentEntryText(pos=(width-145, 0), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT|RT_VALIGN_CENTER, text=_("Trashcan")))
						return res
					else:
						res.append(MultiContentEntryPixmapAlphaBlend(pos=(0,2), size=(iconSize,24), png=self.iconTrash))
						res.append(MultiContentEntryText(pos=(iconSize+10, 0), size=(width-166, self.itemHeight), font = 0, flags = RT_HALIGN_LEFT, text = _("Deleted items")))
						res.append(MultiContentEntryText(pos=(width-150, 0), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT|RT_VALIGN_CENTER, text=_("Trashcan")))
						return res
			if self.screenwidth and self.screenwidth == 1920:
				res.append(MultiContentEntryPixmapAlphaBlend(pos=(3,5), size=(iconSize,iconSize), png=self.iconFolder))
				res.append(MultiContentEntryText(pos=(40+20, 5), size=(width-166, self.itemHeight), font = 0, flags = RT_HALIGN_LEFT, text = txt))
				res.append(MultiContentEntryText(pos=(width-145, 0), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT|RT_VALIGN_CENTER, text=_("Directory")))
				return res
			else:
				res.append(MultiContentEntryPixmapAlphaBlend(pos=(0,2), size=(iconSize,iconSize), png=self.iconFolder))
				res.append(MultiContentEntryText(pos=(iconSize+10, 0), size=(width-166, self.itemHeight), font = 0, flags = RT_HALIGN_LEFT, text = txt))
				res.append(MultiContentEntryText(pos=(width-150, 0), size=(145, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT|RT_VALIGN_CENTER, text=_("Directory")))
				return res
		if (data == -1) or (data is None):
			data = MovieListData()
			cur_idx = self.l.getCurrentSelectionIndex()
			x = self.list[cur_idx] # x = ref,info,begin,...
			data.len = 0 #dont recalc movielist to speedup loading the list
			self.list[cur_idx] = (x[0], x[1], x[2], data) #update entry in list... so next time we don't need to recalc
			data.txt = info.getName(serviceref)
			if config.movielist.hide_extensions.value:
				fileName, fileExtension = os.path.splitext(data.txt)
				if fileExtension in KNOWN_EXTENSIONS:
					data.txt = fileName
			data.icon = None
			data.part = None
			if os.path.split(pathName)[1] in self.runningTimers:
				if switch == 'i':
					if (self.playInBackground or self.playInForeground) and serviceref == (self.playInBackground or self.playInForeground):
						data.icon = self.iconMoviePlayRec
					else:
						data.icon = self.iconMovieRec
				elif switch == 'p' or switch == 's':
					data.part = 100
					if (self.playInBackground or self.playInForeground) and serviceref == (self.playInBackground or self.playInForeground):
						data.partcol = 0xffc71d
					else:
						data.partcol = 0xff001d
			elif (self.playInBackground or self.playInForeground) and serviceref == (self.playInBackground or self.playInForeground):
				data.icon = self.iconMoviePlay
			else:
				data.part = moviePlayState(pathName + '.cuts', serviceref, data.len)
				if switch == 'i':
					if data.part is not None and data.part > 0:
						data.icon = self.iconPart[data.part // 25]
					else:
						if config.usage.movielist_unseen.value:
							data.icon = self.iconUnwatched
				elif switch == 'p' or switch == 's':
					if data.part is not None and data.part > 0:
						data.partcol = 0xffc71d
					else:
						if config.usage.movielist_unseen.value:
							data.part = 100
							data.partcol = 0x206333
		len = data.len
		if len > 0:
			len = "%d:%02d" % (len / 60, len % 60)
		else:
			len = ""

		iconSize = 0
		if switch == 'i':
			if self.screenwidth and self.screenwidth == 1920:
				iconSize = 42
				res.append(MultiContentEntryPixmapAlphaBlend(pos=(2,3), size=(iconSize,iconSize), png=data.icon))
			else:
				iconSize = 22
				res.append(MultiContentEntryPixmapAlphaBlend(pos=(0,1), size=(iconSize,20), png=data.icon))
		elif switch == 'p':
			if self.screenwidth and self.screenwidth == 1920:
				iconSize = 42
			else:
				iconSize = 48
			if data.part is not None and data.part > 0:
				if self.screenwidth and self.screenwidth == 1920:
					res.append(MultiContentEntryProgress(pos=(0,10), size=(iconSize+5,16), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None))
				else:
					res.append(MultiContentEntryProgress(pos=(0,5), size=(iconSize-2,16), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None))
			else:
				if self.screenwidth and self.screenwidth == 1920:
					res.append(MultiContentEntryPixmapAlphaBlend(pos=(0,1), size=(iconSize,iconSize), png=data.icon))
				else:
					res.append(MultiContentEntryPixmapAlphaBlend(pos=(0,1), size=(iconSize,20), png=data.icon))
		elif switch == 's':
			if self.screenwidth and self.screenwidth == 1920:
				iconSize = 42
			else:
				iconSize = 22
			if data.part is not None and data.part > 0:
				if self.screenwidth and self.screenwidth == 1920:
					res.append(MultiContentEntryProgress(pos=(0,10), size=(iconSize+5,16), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None))
				else:
					res.append(MultiContentEntryProgress(pos=(0,5), size=(iconSize-2,16), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None))
			else:
				if self.screenwidth and self.screenwidth == 1920:
					res.append(MultiContentEntryPixmapAlphaBlend(pos=(0,1), size=(iconSize,iconSize), png=data.icon))
				else:
					res.append(MultiContentEntryPixmapAlphaBlend(pos=(0,1), size=(iconSize,20), png=data.icon))

		begin_string = ""
		if begin > 0:
			begin_string = ', '.join(FuzzyTime(begin, inPast = True))

		if ext != '0':
			ih = self.itemHeight / 2
		else:
			ih = self.itemHeight
		lenSize = ih * 3 # 25 -> 75
		dateSize = ih * 145 / 25   # 25 -> 145
		if ext != '0':
			getrec = info.getName(serviceref)
			fileName, fileExtension = os.path.splitext(getrec)
			desc = None
			picon = None
			service = None
			try:
				serviceHandler = eServiceCenter.getInstance()
				info = serviceHandler.info(serviceref)
				desc = info.getInfoString(serviceref, iServiceInformation.sDescription)		# get description
				ref = info.getInfoString(serviceref, iServiceInformation.sServiceref)		# get reference
				service = ServiceReference(ref).getServiceName()				# get service name
			except Exception, e:
				print('[MovieList] load extended infos get failed: ', e)
			if ext == '2':
				try:
					picon = getPiconName(ref)
					picon = loadPNG(picon)
				except Exception, e:
					print('[MovieList] load picon get failed: ', e)