示例#1
0
 def parsePiconSetList(self, picon_set_list):
     logger.info("...")
     logger.debug("last_picon_set: %s",
                  config.plugins.piconcockpit.last_picon_set.value)
     picon_list = []
     for picon_set in picon_set_list:
         if not picon_set.startswith('<meta'):
             info_list = picon_set.split(';')
             if len(info_list) >= 9:
                 dir_url = os.path.join(
                     config.plugins.piconcockpit.picon_server.value,
                     info_list[0])
                 pic_url = os.path.join(
                     config.plugins.piconcockpit.picon_server.value,
                     info_list[0], info_list[1])
                 date = info_list[2]
                 name = info_list[3]
                 satellite = info_list[4]
                 creator = info_list[5]
                 bit = (info_list[6].replace(' ', '').lower()).replace(
                     'bit', ' bit')
                 size = info_list[7].replace(' ', '').lower()
                 uploader = info_list[8]
                 identifier = str(uuid.uuid4())
                 signature = "%s | %s - %s | %s | %s | %s" % (
                     satellite, creator, name, size, bit, uploader)
                 name = signature + " | %s" % date
                 if config.plugins.piconcockpit.satellite.value in ["all", satellite] and\
                  config.plugins.piconcockpit.creator.value in ["all", creator] and\
                  config.plugins.piconcockpit.size.value in ["all", size] and\
                  config.plugins.piconcockpit.bit.value in ["all", bit]:
                     picon_list.append(
                         (name, dir_url, pic_url, identifier, signature))
     return picon_list
示例#2
0
 def __serviceStarted(self):
     logger.info("self.is_closing: %s", self.is_closing)
     if not self.service_started and not self.is_closing:
         self.service_started = True
         self.setAudioTrack()
         self.setSubtitleState(True)
         self.downloadCuesheet()
         if self.config_plugins_plugin.movie_ignore_first_marks.value:
             self.cut_list = removeFirstMarks(self.cut_list)
         if self.config_plugins_plugin.movie_resume_at_last_pos.value:
             self.resume_point = getCutListLast(self.cut_list)
             if self.resume_point > 0:
                 seconds = ptsToSeconds(self.resume_point)
                 logger.debug("resume_point: %s", seconds)
                 Notifications.AddNotificationWithCallback(
                     self.__serviceStartedCallback,
                     MessageBox,
                     _("Do you want to resume playback at position: %d:%02d:%02d?"
                       ) %
                     (seconds / 3600, seconds % 3600 / 60, seconds % 60),
                     timeout=10,
                     type=MessageBox.TYPE_YESNO,
                     default=False,
                 )
             else:
                 self.__serviceStartedCallback(False)
         else:
             self.__serviceStartedCallback(False)
示例#3
0
    def __init__(self, session):
        logger.info("...")
        Screen.__init__(self, session)
        self.skinName = getSkinName("PiconCockpit")
        ConfigInit.__init__(self, [], [], [], [])

        if self.skinName == getSkinName("NoSupport"):
            actions = {
                "cancel": self.exit,
            }
        else:
            actions = {
                "menu": self.openContextMenu,
                "cancel": self.exit,
                "red": self.exit,
                "green": self.green,
            }

        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions", "MenuActions"],
            actions,
            prio=-1)

        self.last_picon_set = config.plugins.piconcockpit.last_picon_set.value
        self.setTitle(_("PiconCockpit"))
        self["list"] = List()
        self["no_support"] = Label()
        self["preview"] = Pixmap()
        self["key_green"] = Button(_("Download"))
        self["key_red"] = Button(_("Exit"))
        self["key_yellow"] = Button()
        self["key_blue"] = Button()
        self.first_start = self.skinName != getSkinName("NoSupport")
        self.onShow.append(self.onDialogShow)
示例#4
0
 def stdoutPingData(self, data):
     logger.info("...")
     #logger.info("data: %s", data)
     lines = data.splitlines()
     ip = packets = None
     for line in lines:
         line = " ".join(line.split())
         words = line.split(" ")
         if not ip and "PING" in line:
             ip = words[1]
         elif "packets received" in line:
             packets = int(words[3])
         if ip is not None and packets is not None:
             for sharename in iAutoMount.mounts:
                 if iAutoMount.mounts[sharename]["ip"] == ip:
                     if packets == 0:
                         #logger.debug("%s (%s) is offline", sharename, ip)
                         if iAutoMount.mounts[sharename]["active"]:
                             iAutoMount.mounts[sharename]["active"] = False
                             self.shares_changed.append(sharename)
                     else:
                         #logger.debug("%s (%s) is online", sharename, ip)
                         if not iAutoMount.mounts[sharename]["active"]:
                             iAutoMount.mounts[sharename]["active"] = True
                             self.shares_changed.append(sharename)
             ip = packets = None
     for sharename in iAutoMount.mounts:
         logger.debug("sharename: %s, ip: %s, active: %s", sharename,
                      iAutoMount.mounts[sharename]["ip"],
                      iAutoMount.mounts[sharename]["active"])
示例#5
0
 def moveMovies(self):
     logger.info("...")
     selection_list = self.movie_list.getSelectionList()
     if selection_list:
         self.selectDirectory(
             boundFunction(self.selectedTargetDir, FILE_OP_MOVE,
                           selection_list), _("Move file(s)"))
示例#6
0
 def downloadCover(self,
                   cover_url,
                   cover_path,
                   backdrop_url=None,
                   backdrop_path=None):
     logger.info("cover_path: %s, cover_url: %s", cover_path, cover_url)
     logger.info("backdrop_path: %s, backdrop_url: %s", backdrop_path,
                 backdrop_url)
     cover_found = 0
     if cover_url and cover_path:
         cover_dir = os.path.dirname(cover_path)
         if not os.path.exists(cover_dir):
             createDirectory(cover_dir)
         deleteFile(cover_path)
         r_content = self.getContent(cover_url)
         if r_content:
             writeFile(cover_path, r_content)
             cover_found = 1
     if backdrop_url and backdrop_path:
         backdrop_dir = os.path.dirname(backdrop_path)
         if not os.path.exists(backdrop_dir):
             createDirectory(backdrop_dir)
         deleteFile(backdrop_path)
         r_content = self.getContent(backdrop_url)
         if r_content:
             writeFile(backdrop_path, r_content)
     return cover_found
示例#7
0
def initBookmarks():
    logger.info("...")
    bookmarks = []
    for video_dir in config.movielist.videodirs.value:
        bookmarks.append(os.path.normpath(video_dir))
    logger.debug("bookmarks: %s", bookmarks)
    return bookmarks
示例#8
0
def Plugins(**__):
    logger.info("  +++ Version: %s starts...", VERSION)
    return PluginDescriptor(name=_("PiconCockpit"),
                            description=_("Manage Picons"),
                            where=PluginDescriptor.WHERE_PLUGINMENU,
                            icon="PiconCockpit.svg",
                            fnc=startPiconCockpit)
示例#9
0
 def apply(self, shares_changed, callback=None):
     logger.info("shares_changed: %s", shares_changed)
     for sharename in shares_changed:
         self._applyShare(self._mounts[sharename])
     self._reloadSystemd(callback=self._onSharesApplied)
     logger.debug("self._mounts: %s", self._mounts)
     if callback is not None:
         callback(True)
示例#10
0
 def pigWorkaround(self):
     logger.info("...")
     if self.enable_mini_tv:
         self.session.nav.stopService()
         desktop_size = getDesktop(0).size()
         self.instance.resize(
             eSize(*(desktop_size.width(), desktop_size.height())))
         self.session.nav.playService(self.last_service)
示例#11
0
 def openConfigScreen(self):
     logger.info("...")
     picon_set = self["list"].getCurrent()
     if picon_set:
         self.last_picon_set = picon_set[4]
     self.session.openWithCallback(self.openConfigScreenCallback,
                                   ConfigScreen,
                                   config.plugins.piconcockpit)
示例#12
0
 def doStep3(self):
     logger.info("...")
     self.file_delete_list = []
     self.file_ops_list = []
     self.recordings_to_stop = []
     self.movie_list.selectPath(self.recordings[0])
     self.deleteMovies()
     DelayTimer(500, self.doStep4)
示例#13
0
 def readCutList(self, path):
     cut_list = []
     afile = FileManager.getInstance().getFile("recordings", path)
     if afile:
         data = afile[FILE_IDX_CUTS]
         cut_list = unpackCutList(data)
     logger.info("cut_list: %s", cut_list)
     return cut_list
示例#14
0
 def getPiconSetInfo(self):
     logger.info("...")
     url = os.path.join(config.plugins.piconcockpit.picon_server.value,
                        "picons", picon_info_file)
     download_file = os.path.join(self.picon_dir, picon_info_file)
     logger.debug("url: %s, download_file: %s", url, download_file)
     downloadPage(url, download_file).addCallback(
         self.gotPiconSetInfo).addErrback(self.downloadError, url)
示例#15
0
 def copyMovies(self):
     logger.info("...")
     selection_list = self.movie_list.getSelectionList()
     if selection_list:
         self.selectDirectory(
             boundFunction(self.selectedTargetDir, FILE_OP_COPY,
                           selection_list),
             _("Copy file(s)"),
         )
示例#16
0
 def openPlayer(self, path):
     logger.info("path: %s", path)
     self.pigWorkaround()
     self.session.open(
         CockpitPlayer,
         getService(path,
                    self.movie_list.getFile(path)[FILE_IDX_NAME]),
         config.plugins.moviecockpit,
     )
示例#17
0
 def getPosition(self):
     position = 0
     seek = self.getSeek()
     if seek and self.service_started:
         pos = seek.getPlayPosition()
         if not pos[0] and pos[1] > 0:
             position = pos[1]
     logger.info("position: %ss (%s)", ptsToSeconds(position), position)
     return position
示例#18
0
def readFile(path):
    data = ""
    try:
        f = open(path, "r")
        data = f.read()
        f.close()
    except Exception as e:
        logger.info("path: %s, exception: %s", path, e)
    return data
示例#19
0
 def exit(self):
     logger.info("...")
     picon_set = self["list"].getCurrent()
     if picon_set:
         logger.debug("last_picon_set: %s", picon_set[4])
         config.plugins.piconcockpit.last_picon_set.value = picon_set[4]
         config.plugins.piconcockpit.last_picon_set.save()
         configfile.save()
         os.popen("rm /tmp/*.png")
     self.close()
示例#20
0
 def getSeekLength(self):
     length = 0
     seek = self.getSeek()
     if seek is not None:
         seek_len = seek.getLength()
         logger.debug("seek.getLength(): %s", seek_len)
         if not seek_len[0]:
             length = seek_len[1]
     logger.info("length: %ss (%s)", ptsToSeconds(length), length)
     return length
示例#21
0
 def doEofInternal(self, playing):
     logger.info("playing: %s, self.execing: %s", playing, self.execing)
     if self.execing:
         if isRecording(self.service.getPath()):
             self.session.nav.playService(self.service)
             self.doSeekRelative(secondsToPts(-1))
         else:
             self.is_closing = True
         if self.leave_on_eof:
             self.leavePlayer()
示例#22
0
 def getDirSelectionList(self, adir):
     logger.info("adir: %s", adir)
     file_list = FileManager.getInstance().getFileList([adir])
     for afile in file_list:
         self.selection_list.append(afile[FILE_IDX_PATH])
     dir_list = FileManager.getInstance().getDirList([adir])
     for adirfile in dir_list:
         if adirfile[FILE_IDX_FILENAME] != "..":
             self.getDirSelection(adirfile[FILE_IDX_PATH])
     logger.debug("selection_list: %s", self.selection_list)
示例#23
0
    def setSubtitleState(self, enabled):
        logger.info("enabled: %s", enabled)
        try:
            if not self.config_plugins_plugin.autosubs.value or not enabled:
                return

            subs = self.getCurrentServiceSubtitle() if isinstance(
                self, InfoBarSubtitleSupport) else None
            n = (subs.getNumberOfSubtitleTracks() if subs else 0)
            if n == 0:
                return

            self.sub_format_dict = {}
            self.gstsub_format_dict = {}
            for index, (short, _text, rank) in sorted(SUB_FORMATS.items(),
                                                      key=lambda x: x[1][2]):
                if rank > 0:
                    self.sub_format_dict[index] = short
            for index, (short, _text, rank) in sorted(GST_SUB_FORMATS.items(),
                                                      key=lambda x: x[1][2]):
                if rank > 0:
                    self.gstsub_format_dict[index] = short
            lt = []
            alist = []
            for index in range(n):
                info = subs.getSubtitleTrackInfo(index)
                languages = info.getLanguage().split('/')
                logger.debug("lang %s", languages)
                iType = info.getType()
                logger.debug("type %s", iType)
                if iType == iSubtitleType_ENUMS.GST:
                    iType = info.getGstSubtype()
# 				codec = self.gstsub_format_dict[iType] if iType in self.gstsub_format_dict else '?'
# 			else:
# 				codec = self.sub_format_dict[iType] if iType in self.sub_format_dict else '?'
# 			logger.debug("codec %s", codec)
                lt.append((index, (iType == 1 and "DVB" or iType == 2 and "TTX"
                                   or "???"), languages))
            if lt:
                logger.debug("%s", str(lt))
                for e in lt:
                    alist.append(
                        (e[0], e[1], e[2][0] in langC and langC[e[2][0]][0]
                         or e[2][0]))
                    if alist:
                        logger.debug("%s", str(alist))
                        for sublang in [
                                self.config_plugins_plugin.sublang1.value,
                                self.config_plugins_plugin.sublang2.value,
                                self.config_plugins_plugin.sublang3.value
                        ]:
                            if self.trySubEnable(alist, sublang):
                                break
        except Exception as e:
            logger.error("exception: %s", e)
示例#24
0
 def getLength(self):
     length = 0
     if self.service.type == SID_DVB:
         length = self.__length
         if self.recording_start_time and self.event_start_time > self.recording_start_time:
             length += self.event_start_time - self.recording_start_time
         length = secondsToPts(length)
     else:
         length = self.getSeekLength()
     logger.info("length: %ss (%s)", ptsToSeconds(length), length)
     return length
示例#25
0
 def stopRecordings(self):
     logger.info("...")
     self.file_ops_list = []
     self.file_delete_list = []
     self.recordings_to_stop = []
     selection_list = self.movie_list.getSelectionList()
     for path in selection_list:
         if isRecording(path):
             self.recordings_to_stop.append(path)
     if self.recordings_to_stop:
         self.stopRecordingsQuery()
示例#26
0
 def listBouquetServices(self):
     logger.info("...")
     bouquets = getTVBouquets()
     bouquets += getRadioBouquets()
     logger.debug("bouquets: %s", bouquets)
     services = []
     for bouquet in bouquets:
         if "Last Scanned" not in bouquet[1]:
             services += getServiceList(bouquet[0])
     logger.debug("services: %s", services)
     return services
示例#27
0
 def firstStart(self):
     logger.info("...")
     self.first_start = False
     self.picon_dir = config.usage.configselection_piconspath.value
     if os.path.exists(self.picon_dir):
         self.getPiconSetInfo()
     else:
         self.createList(False)
         self.session.open(
             MessageBox,
             _("Picon directory does not exist") + ": " + self.picon_dir,
             MessageBox.TYPE_ERROR)
示例#28
0
 def leavePlayer(self):
     logger.info("...")
     self.session.nav.stopService()
     self.setSubtitleState(False)
     path = self.service.getPath()
     if self.service.type == SID_DVB:
         self.reloadCutList(path)
     else:
         self.updateCutList(path,
                            play=self.getPosition(),
                            length=self.getLength())
     self.close()
示例#29
0
 def downloadPicons(self, _result=None, picon_set=None):
     logger.info("...")
     if config.plugins.piconcockpit.all_picons.value:
         picons = readFile(os.path.join(self.picon_dir,
                                        picon_list_file)).splitlines()
     else:
         picons = self.getUserBouquetPicons()
     logger.debug("picons: %s", picons)
     if picons:
         if config.plugins.piconcockpit.delete_before_download:
             os.popen("rm " + os.path.join(self.picon_dir, "*.png"))
         self.session.open(PiconDownloadProgress, picon_set[1], picons,
                           self.picon_dir)
示例#30
0
 def showCover(self, pixmap, path, default_path):
     logger.info("path: %s", path)
     if path and not os.path.exists(path):
         path = None
         if config.plugins.moviecockpit.cover_fallback.value:
             if default_path and os.path.exists(default_path):
                 path = default_path
     logger.info("path %s", path)
     if path:
         pixmap.instance.setPixmap(LoadPixmap(path))
         pixmap.instance.show()
     else:
         pixmap.instance.hide()