Exemple #1
0
 def seek_back(self):
     if not self.seekable:
         show_info_message(self.session, _("Its not possible to seek in this video"), 3)
     elif self.download is not None and self.download.running:
         show_info_message(self.session, _("Its not possible to use trick seek in downloading video "), 3)
     else:
         self._seek_back()
Exemple #2
0
 def updateAddonGUI(self):
     image = None
     title = author = version = description = ""
     item = self.getSelectedItem()
     if item is not None:
         title = item.name and toString(item.name) or ""
         imagePath = item.image and toString(item.image) or ""
         if imagePath:
             try:
                 image = LoadPixmap(path=imagePath, cached=False)
             except Exception as e:
                 print '[ArchivCZSKContent] error when loading image', e
         try:  # addon
             author = item.author and toString(item.author) or ""
             version = item.version and toString(item.version) or ""
             description = item.description and toString(item.description) or ""
         except AttributeError:  # category
             pass
     self["title"].setText(title.strip())
     if author:
         self["author"].setText(_("Author: ") + author.strip())
     else:
         self["author"].setText("")
     if version:
         self["version"].setText(_("Version: ") + version.strip())
     else:
         self["version"].setText("")
     self["about"].setText(description.strip())
     self["image"].instance.setPixmap(image)
Exemple #3
0
    def _init_menu(self, item):
        provider = self.content_provider
        if 'play' in provider.capabilities:
            item.add_context_menu_item(_("Play"),
                                                        action=self.play_item,
                                                        params={'item':item,
                                                        'mode':'play'})

        if 'play_and_download' in provider.capabilities:
            item.add_context_menu_item(_("Play and Download"),
                                       action=self.play_item,
                                       params={'item':item,
                                                      'mode':'play_and_download'})

        if 'play_and_download_gst' in provider.capabilities:
            item.add_context_menu_item(_("Play and download (Gstreamer)"),
                                       action=self.play_item,
                                       params={'item':item,
                                                      'mode':'play_and_download_gst'})

        if 'download' in provider.capabilities:
            item.add_context_menu_item(_("Download"),
                                       action=self.download_item,
                                       params={'item':item,
                                                      'mode':'auto'})
Exemple #4
0
    def __init__(self, session, addon, lst_items):
        self.addon = addon
        contentHandler = VideoAddonContentHandler(session, self, addon.provider)
        BaseContentScreen.__init__(self, session, contentHandler, lst_items)

        # include DownloadList
        DownloadList.__init__(self)

        # include TipList
        TipBar.__init__(self, [self.CSFD_TIP, self.CONTEXT_TIP, self.INFO_TIP], startOnShown=True)

        self["key_red"] = Label("")
        self["key_green"] = Label(_("Downloads"))
        self["key_yellow"] = Label(_("Shortcuts"))
        self["key_blue"] = Label(_("Settings"))
        self["actions"] = ActionMap(["archivCZSKActions"],
            {
                "ok": self.ok,
                "up": self.up,
                "down": self.down,
                "cancel": self.cancel,
                "green" : self.openAddonDownloads,
                "blue": self.openAddonSettings,
                "yellow": self.openAddonShortcuts,
                "info": self.openInfo,
                "menu": self.menu,
                "csfd": self.openCSFD
            }, -2)

        #self.onUpdateGUI.append(self.updateFullTitle)
        self.onLayoutFinish.append(self.setWindowTitle)
Exemple #5
0
	def _askSaveDownloadCB(self):
		def saveDownload(callback=None):
			if not callback:
				from Plugins.Extensions.archivCZSK.engine.downloader import DownloadManager
				DownloadManager.getInstance().removeDownload(self.download)

		downloadedSucc = self.download.downloaded
		downloadedErr = not self.download.downloaded and not self.download.running
		downloading = not self.download.downloaded and self.download.running
		if downloadedSucc:
			self.session.openWithCallback(saveDownload,
										  MessageBox,
										  _("Do you want to save") + ' ' + self.download.name.encode('utf-8', 'ignore') + ' ' + _("to disk?"),
										  type=MessageBox.TYPE_YESNO)
		elif downloadedErr:
			self.session.openWithCallback(saveDownload,
										  MessageBox,
										  _("Do you want to save") + " " + _('not succesfully finished download') + " " + self.download.name.encode('utf-8', 'ignore') + ' ' + _("to disk?"),
										  type=MessageBox.TYPE_YESNO)
		elif downloading:
			self.session.openWithCallback(saveDownload,
										  MessageBox,
										  _("Do you want to continue downloading") + ' ' + self.download.name.encode('utf-8', 'ignore') + ' ' + _("to disk?"),
										  type=MessageBox.TYPE_YESNO)
		self.download.playMode = False
Exemple #6
0
    def updateStatus(self):
        download = self._download
        status = download.status

        status.update(self.timer_interval / 1000)

        speed = status.speed
        speedKB = util.BtoKB(speed)

        if speedKB <= 1000 and speedKB > 0:
            self['speed'].setText(("%d KB/s" % speedKB))
        elif speedKB > 1000:
            self['speed'].setText(("%.2f MB/s" % util.BtoMB(speed)))
        else:
            self['speed'].setText(("%d KB/s" % 0))


        currentLength = status.currentLength
        totalLength = status.totalLength

        size = "%s (%2.f MB %s)" % (_("unknown"), util.BtoMB(currentLength), _("downloaded"))
        if totalLength > 0:
            size = "%2.f MB (%2.f MB %s)" % (util.BtoMB(totalLength), util.BtoMB(currentLength), _("downloaded"))
        self["size"].setText(size)

        if not download.running:
            self.stopTimer()
Exemple #7
0
 def __init__(self, session, configEntry):
     initDir = configEntry.getValue()
     if initDir is not None and not initDir.endswith('/'):
         initDir = initDir + '/'
     Screen.__init__(self, session)
     #inhibitDirs = ["/bin", "/boot", "/dev", "/etc", "/lib", "/proc", "/sbin", "/sys", "/usr", "/var"]
     #inhibitMounts = []
     self.configEntry = configEntry
     
     self["filelist"] = FileList(initDir, showDirectories=True, showFiles=False)
     self["target"] = Label()
     self["actions"] = ActionMap(["WizardActions", "DirectionActions", "ColorActions", "EPGSelectActions"],
     {
         "back": self.cancel,
         "left": self.left,
         "right": self.right,
         "up": self.up,
         "down": self.down,
         "ok": self.ok,
         "green": self.green,
         "red": self.cancel
         
     }, -1)
     self["key_red"] = StaticText(_("Cancel"))
     self["key_green"] = StaticText(_("Save"))
     self.onShown.append(self.setWindowTitle)
Exemple #8
0
	def buildEntry(self, name, res, width):
		if res is None:
			return PanelColorListEntry(name, _("UNKNOWN"), 0xffff00, width)
		elif res:
			return PanelColorListEntry(name, _("OK"), 0x00ff00, width)
		else:
			return PanelColorListEntry(name, _("FAIL"), 0xff0000, width)
Exemple #9
0
def PanelListDownloadListEntry(pdownload):
    res = [(pdownload.name)]
    finishText = _('Finished:  ')
    if pdownload.finish_time is not None:
        finishText = _('Finished:  ') + time.strftime("%b %d %Y %H:%M:%S", time.localtime(pdownload.finish_time))

    sizeKB = util.BtoKB(pdownload.size)
    if sizeKB <= 1024 and sizeKB >= 0:
        size = ("%d KB        " % sizeKB)
    elif sizeKB <= 1024 * 1024:
        size = ("%d MB        " % util.BtoMB(pdownload.size))
    else:
        size = ("%.2f GB        " % util.BtoGB(pdownload.size))

    sizeText = _('Size:  ') + size
    stateText = pdownload.textState

    res.append(MultiContentEntryPixmapAlphaTest(pos=(5, 5), size=(35, 25), png=loadPNG(pdownload.thumb)))
    res.append(MultiContentEntryText(pos=(60, 5), size=(760, 30), font=0, flags=RT_HALIGN_LEFT, text=toUTF8(pdownload.name)))
    res.append(MultiContentEntryText(pos=(0, 38), size=(900, 18), font=2, flags=RT_VALIGN_TOP | RT_HALIGN_RIGHT, text=sizeText, color=0xE6A800))

    if pdownload.state == 'success_finished':
        res.append(MultiContentEntryText(pos=(0, 38), size=(900, 18), font=2, flags=RT_VALIGN_TOP | RT_HALIGN_LEFT, text=finishText, color=0xE6A800))
        res.append(MultiContentEntryText(pos=(0, 38), size=(900, 18), font=2, flags=RT_VALIGN_TOP | RT_HALIGN_CENTER, text=stateText, color=0x00FF00))
    elif pdownload.state == 'error_finished':
        res.append(MultiContentEntryText(pos=(0, 38), size=(900, 18), font=2, flags=RT_VALIGN_TOP | RT_HALIGN_LEFT, text=finishText, color=0xE6A800))
        res.append(MultiContentEntryText(pos=(0, 38), size=(900, 18), font=2, flags=RT_VALIGN_TOP | RT_HALIGN_CENTER, text=stateText, color=0xff0000))
    elif pdownload.state == 'downloading':
        res.append(MultiContentEntryText(pos=(0, 38), size=(900, 18), font=2, flags=RT_VALIGN_TOP | RT_HALIGN_CENTER, text=stateText, color=0xE6A800))
    return res
Exemple #10
0
    def __init__(self, session, categories=[]):
        BaseArchivCZSKScreen.__init__(self, session)
        ConfigListScreen.__init__(self, [], session=session, on_change=self.changedEntry)
        self.onChangedEntry = [ ]

        self.categories = categories
        self.selected_category = 0
        self.config_list_entries = []
        self.category_widgets = []
        self.category_widgets_y = 100

        self.initializeCategories()
        self.initializeSkin()

        self["key_yellow"] = Label(_("Changelog"))
        self["key_green"] = Label(_("Save"))
        self["key_red"] = Label(_("Cancel"))
        self["key_blue"] = Label(_("Next"))

        self["actions"] = ActionMap(["SetupActions", "ColorActions"],
            {
                "cancel": self.keyCancel,
                "green": self.keySave,
                "ok": self.keyOk,
                "red": self.keyCancel,
                "blue": self.nextCategory,
                "yellow": self.changelog
            }, -2)
Exemple #11
0
    def __init__(self, session):
        BaseArchivCZSKMenuListScreen.__init__(self, session)
        DownloadListScreen.instance = self
        self["key_red"] = Button(_("Cancel"))
        self["key_green"] = Button(_("Play"))
        self["key_yellow"] = Button(_("Remove"))
        self["key_blue"] = Button("")

        from Plugins.Extensions.archivCZSK.engine.player.player import Player
        self.player = Player(session, self.workingFinished)

        self.lst_items = []
        self.title = "ArchivyCZSK" + " - " + _("Recent downloads")
        self.onClose.append(self.__onClose)

        self["actions"] = NumberActionMap(["archivCZSKActions"],
            {
                "ok": self.ok,
                "cancel": self.cancel,
                "red": self.askCancelDownload,
                "green": self.askPlayDownload,
                "yellow": self.askRemoveDownload,
                "up": self.up,
                "down": self.down,
            }, -2)

        self.lst_items = DownloadManager.getInstance().download_lst
        self.onShown.append(self.setWindowTitle)
Exemple #12
0
	def updateProtocolList(self,width):
		menuList = []
		menuList.append(self.buildEntry(_("HTTP Protocol"), videoPlayerInfo.isHTTPSupported(), width))
		menuList.append(self.buildEntry(_("HLS Protocol"), videoPlayerInfo.isHLSSupported(), width))
		menuList.append(self.buildEntry(_("MMS Protocol"), videoPlayerInfo.isMMSSupported(), width))
		menuList.append(self.buildEntry(_("RTMP Protocol"), videoPlayerInfo.isRTMPSupported(), width))
		menuList.append(self.buildEntry(_("RTSP Protocol"), videoPlayerInfo.isRTSPSupported(), width))
		self["protocol_list"].setList(menuList)
Exemple #13
0
 def initInfoList(self):
     blueB = os.path.join(settings.IMAGE_PATH, 'buttons/blue.png')
     redB = os.path.join(settings.IMAGE_PATH, 'buttons/red.png')
     yellowB = os.path.join(settings.IMAGE_PATH, 'buttons/yellow.png')
     infolist = []
     infolist.append(PanelListEntry2(_("change search expression"), self.WIDTH_HD, yellowB))
     infolist.append(PanelListEntry2(_("remove diacritic"), self.WIDTH_HD, redB))
     infolist.append(PanelListEntry2(_("choose from EPG"), self.WIDTH_HD, blueB))
     self['infolist'].l.setList(infolist)
Exemple #14
0
 def __init__(self):
     try:
         self.ctx_items.append((_("Show recent downloads"), None, self.showDownloadListScreen))
     except AttributeError:
         pass
     self["DownloadListActions"] = HelpableActionMap(self, "DownloadActions",
         {
             "showDownloadListView": (self.showDownloadListScreen, _("show download list")),
         })
Exemple #15
0
 def __call__(self, func):
     def wrapped(*args, **kwargs):
         try:
             func(*args, **kwargs) 
         except download.NotSupportedProtocolError, e:
             message = "%s %s" % (e.message, _("protocol is not supported"))
             self.errorMessage(message)
         except urllib2.HTTPError, e:
             message = "%s %s:%d" % (_("Error in loading"), _("HTTP Error"), e.code)
             self.errorMessage(message)
Exemple #16
0
 def __call__(self, func):
     def wrapped(*args, **kwargs):
         try:
             func(*args, **kwargs) 
         except urllib2.HTTPError, e:
             message = "%s %s:%d" % (_("Error in loading"), _("HTTP Error"), e.code)
             self.errorMessage(message)
         except urllib2.URLError, e:
             message = "%s %s:%s" % (_("Error in loading"), _("URL Error"), str(e.reason))
             self.errorMessage(message)
Exemple #17
0
 def _createMenuListEntry(self, item, idx):
     addon = item.addon
     name = item.name
     width = self["menu"].instance.size().width() -5
     if addon.get_info('broken'):
         return PanelColorListEntry2(name, _('broken'), 0xffffff, 0xff0000, width)
     elif not addon.get_setting('enabled'):
         return PanelColorListEntry2(name, _('disabled'), 0xffffff, 0xffff00, width)
     else:
         return PanelColorListEntry2(name, _('enabled'), 0xffffff, 0x00ff00, width)
Exemple #18
0
    def toggleCancelLoading(self):
        if Task.getInstance() is not None and not Task.getInstance().isCancelling():
            self["status_label"].setText(_("Canceling..."))
            Task.getInstance().setCancel()

        elif Task.getInstance() is not None and Task.getInstance().isCancelling():
            self["status_label"].setText(_("Loading..."))
            Task.getInstance().setResume()
        else:
            log.debug("Task is not running")
Exemple #19
0
 def _init_menu(self, item, *args, **kwargs):
     provider = self.content_provider
     if 'play' in provider.capabilities:
         item.add_context_menu_item(_("Play"),
                                                     action=self.play_item,
                                                     params={'item':item,
                                                     'mode':'play'})
     item.add_context_menu_item(_("Show playlist"),
                                action=self.show_playlist,
                                params={'item':item})
Exemple #20
0
    def __init__(self, session, archivCZSK):
        provider = ArchivCZSKContentProvider(archivCZSK, os.path.join(settings.PLUGIN_PATH, 'categories'))
        provider.start()
        contentHandler = ArchivCZSKContentHandler(session, self, provider)
        defaultCategory = config.plugins.archivCZSK.defaultCategory.value
        categoryItem = categoryAddons = None
        if defaultCategory != 'categories':
            categoryItem = provider.get_content({'category':defaultCategory})
            categoryAddons = provider.get_content({'category_addons':defaultCategory})
            categoryAddons is not None and categoryAddons.insert(0, PExit())
        categoryItems = provider.get_content()
        BaseContentScreen.__init__(self, session, contentHandler, categoryItems)
        if categoryItem is not None  and categoryAddons is not None:
            self.save()
            self.load({'lst_items':categoryAddons,
                            'parent_it':categoryItem,
                            'refresh':False})
        self.ctx_items.append((_("Add Category"), None, self.addCategory))
        self.provider = provider
        self.updateGUITimer = eTimer()
        self.updateGUITimer.callback.append(self.updateAddonGUI)

        # include DownloadList
        DownloadList.__init__(self)

        # include TipList
        TipBar.__init__(self, [self.CONTEXT_TIP], startOnShown=True)
        self.onUpdateGUI.append(self.changeAddon)
        self.onClose.append(self.__onClose)

        self["image"] = Pixmap()
        self["title"] = Label("")
        self["author"] = Label("")
        self["version"] = Label("")
        self["about"] = Label("")

        self["key_red"] = Label("")
        self["key_green"] = Label(_("Manager"))
        self["key_yellow"] = Label(_("Live streams"))
        self["key_blue"] = Label(_("Settings"))

        self["actions"] = ActionMap(["archivCZSKActions"],
            {
                "ok": self.ok,
                "cancel": self.cancel,
                "up": self.up,
                "down": self.down,
                "blue": self.openSettings,
                "green": self.openAddonManagement,
                "yellow": self.showStreams,
                "menu" : self.menu
            }, -2)
        # after layout show update item "GUI" - edit: shamann
        self.onLayoutFinish.append(self.updateAddonGUI)
Exemple #21
0
    def __init__(self, session):

        categories = [
                      {'label':_("Main"), 'subentries':settings.get_main_settings},
                      {'label':_("Player"), 'subentries':settings.get_player_settings},
                      {'label':_("Path"), 'subentries':settings.get_path_settings},
                      {'label':_("Misc"), 'subentries':settings.get_misc_settings}
                     ]

        BaseArchivCZSKConfigScreen.__init__(self, session, categories=categories)
        self.onLayoutFinish.append(self.layoutFinished)
        self.onShown.append(self.buildMenu)
Exemple #22
0
 def renameCB(callback=None):
     if callback and len(callback) > 0:
         dpath = os.path.join(download.destDir, callback)
         if download.filename == callback:
             session.open(MessageBox, _("You've to change download filename. Try again.."), type=MessageBox.TYPE_WARNING)
         elif os.path.isfile(dpath):
             message = "%s: %s %s\n%s" % (_("The file"), callback, _("already exists"), _("Try to use another name..."))
             session.open(MessageBox, message, type=MessageBox.TYPE_WARNING)
         else:
             download.filename = callback
             download.local = dpath
             dManager.addDownload(download)
Exemple #23
0
	def _showPlayDownloadDelay(self, download):
		"""called on download start"""
		self.download = download

		# download is not running already, so we dont continue
		if not self.download.downloaded and not self.download.running:
			log.debug("download %s not started at all", self.download.name)
			self.download = None
			self.exit()
		else:
			self.session.openWithCallback(self._playAndDownloadCB, MessageBox, '%s %d %s' % (_('Video starts playing in'), \
									 self.playDelay, _("seconds.")), type=MessageBox.TYPE_INFO, timeout=self.playDelay, enable_input=False)
Exemple #24
0
    def _handle_broken_addon(self, addon):
        def disable_addon(cb):
            if cb:
                addon.set_setting('enabled', False)
                self.content_screen.workingStarted()
                self.content_screen.refreshList()
                self.content_screen.workingFinished()

        reason = addon.get_info('broken').encode('utf-8')
        message = _("Addon is broken") + '\n'
        message += _("Reason") + ' : ' + reason +'\n\n'
        message += _("Do you want to disable this addon?")
        self.session.openWithCallback(disable_addon,MessageBox, message, type=MessageBox.TYPE_YESNO)
Exemple #25
0
 def __updateState(self):
     if not self.running and self.downloaded:
         self.state = 'success_finished'
         self.textState = _('succesfully finished')
     elif not self.running and not self.downloaded:
         self.state = 'error_finished'
         self.textState = _('not succesfully finished')
     elif self.running and not self.downloaded:
         self.state = 'downloading'
         self.textState = _('downloading')
     else:
         self.state = 'unknown'
         self.textState = _("unknown")
Exemple #26
0
 def finishDownloadCB(download):
     session = GlobalSession.getSession()
     def updateDownloadList(callback=None):
         if DownloadListScreen.instance is not None:
             DownloadListScreen.instance.refreshList()
     if download.downloaded:
         session.openWithCallback(updateDownloadList, MessageBox, _("ArchivyCZSK - Download:") + ' ' + \
                                   download.name.encode('utf-8', 'ignore') + ' ' + _("successfully finished."), \
                                   type=MessageBox.TYPE_INFO, timeout=0)
     else:
         session.openWithCallback(updateDownloadList, MessageBox, _("ArchivyCZSK - Download:") + ' ' + \
                                   download.name.encode('utf-8', 'ignore') + ' ' + _("finished with errors."), \
                                   type=MessageBox.TYPE_ERROR, timeout=0)
Exemple #27
0
 def _init_menu(self, item):
     MediaItemHandler._init_menu(self, item)
     item.add_context_menu_item(_("Resolve videos"),
                                    action=self._resolve_videos,
                                    params={'item':item})
     if 'favorites' in self.content_provider.capabilities:
         item.add_context_menu_item(_("Add Shortcut"), 
                 action=self.ask_add_shortcut, 
                 params={'item':item})
     else:
         item.remove_context_menu_item(_("Add Shortcut"), 
                 action=self.ask_add_shortcut, 
                 params={'item':item})
Exemple #28
0
 def getInstance(session, cb=None):
     if ArchivCZSKSeeker.instance is None:
         try:
             return ArchivCZSKSeeker(session, cb)
         except ImportError:
             showInfoMessage(session, _('Cannot search, archivCZSK is not installed'), 5, cb=cb)
             print 'cannot found archivCZSK'
             return None
         except Exception:
             traceback.print_exc()
             showErrorMessage(session, _('unknown error'), 5, cb=cb)
             return None
     return ArchivCZSKSeeker.instance
Exemple #29
0
 def search(self, search_exp, addon_id, mode=None):
     if self.searching:
         showInfoMessage(self.session, _("You cannot search, archivCZSK Search is already running"))
         print "%s cannot search, searching is not finished" % self
         return
     searcher = getSearcher(self.session, addon_id, self.archivCZSK, self._successSearch, self._errorSearch)
     if searcher is not None:
         self.searcher = searcher
         self.searching = True
         self.addon = searcher.addon
         searcher.start()
         searcher.search(search_exp, mode)
     else:
         showInfoMessage(self.session, _("Cannot find searcher") + ' ' + addon_id.encode('utf-8'))
Exemple #30
0
	def askInstallRtmpPlugin(self):
		if ARCH == 'mipsel':
			self.selectedInstallType = self.GST_INSTALL_RTMP
			warnMessage = _("ATTENTION: Installation of this plugin can cause")
			warnMessage += '\n' + _("crash of Enigma2.")
			if videoPlayerInfo.isRTMPSupported():
				message = warnMessage
				message += '\n'
				message += '\n' + _("It looks like RTMP plugin is already installed")
				message += '\n' + _("Do you want to reinstall it?")
			else:
				message = warnMessage
				message += '\n\n' + _("Do you want to continue?")
			showYesNoDialog(self.session, message, self.installGstPlugins)
Exemple #31
0
    def __init__(self, session):

        categories = [{
            'label': _("Main"),
            'subentries': settings.get_main_settings
        }, {
            'label': _("Player"),
            'subentries': settings.get_player_settings
        }, {
            'label': _("Path"),
            'subentries': settings.get_path_settings
        }, {
            'label': _("Misc"),
            'subentries': settings.get_misc_settings
        }]

        BaseArchivCZSKConfigScreen.__init__(self,
                                            session,
                                            categories=categories)
        self.onLayoutFinish.append(self.layoutFinished)
        self.onShown.append(self.buildMenu)
Exemple #32
0
 def _save_download(self, cb=None):
     if cb:
         # we need to pause playing downloaded file because we want to move
         # it to our download location
         self.pause_service()
         log.debug("saving %s to %s", self.gst_download_path, self.download_path)
         os.system('mv %s %s' % (self.gst_download_path, self.download_path))
         #shutil.move(self.gst_download_path, self.download_path)
         show_info_message(self.session, _("Download was succesfully saved"))
         self._exit_video_player()
     else:
         self._exit_video_player()
Exemple #33
0
 def cancel(self):
     if self.working:
         self.toggleCancelLoading()
     elif not self.working:
         if config.plugins.archivCZSK.confirmExit.value:
             self.session.openWithCallback(
                 self.closePlugin,
                 MessageBox,
                 _('Do you want to exit ArchivCZSK?'),
                 type=MessageBox.TYPE_YESNO)
         else:
             self.closePlugin(True)
Exemple #34
0
 def do_seek_relative(self, pts):
     if self.download_percent == 100 or pts < 0:
         self._do_seek_relative(pts)
         return
     
     play_pts = self.video.getCurrentPosition()
     download_pts = self.get_download_position()
     if play_pts is None or download_pts is None:
         show_info_message(self.session, _("Error when trying to seek"), 2)
         return
     
     if (play_pts + pts) < download_pts:
         self._do_seek_relative(pts)
         return
     else:
         want_seek_minutes = pts / 90000 / 60
         can_seek = self.pts_to_hms(download_pts - play_pts)
         can_seek_minutes = can_seek[1]
         show_info_message(self.session, _("Cannot seek") + " " + str(want_seek_minutes) + " " + 
                                         _("minutes forward not enough video is downloaded.\n") + 
                                         _("You can seek maximum") + " " + str(can_seek_minutes) + " " + _("minutes forward"))
Exemple #35
0
def get_misc_settings():
    list = []
    list.append(
        getConfigListEntry(_("Show broken addons"),
                           config.plugins.archivCZSK.showBrokenAddons))
    list.append(
        getConfigListEntry(_("Convert captcha images to 8bit"),
                           config.plugins.archivCZSK.convertPNG))
    list.append(
        getConfigListEntry(_("Drop caches on exit"),
                           config.plugins.archivCZSK.clearMemory))
    verification = config.plugins.archivCZSK.linkVerification.getValue()
    if not (videoPlayerInfo.type == 'gstreamer'):
        list.append(
            getConfigListEntry(_("Use link verification"),
                               config.plugins.archivCZSK.linkVerification))
        if verification:
            list.append(
                getConfigListEntry(
                    _("Verification timeout"),
                    config.plugins.archivCZSK.linkVerificationTimeout))
    if ARCH == 'sh4':
        list.append(
            getConfigListEntry(_("Amiko HDMU fix"),
                               config.plugins.archivCZSK.hdmuFix))
    return list
Exemple #36
0
    def __init__(self, session, name, content_provider):
        BaseArchivCZSKMenuListScreen.__init__(self, session, panelList=PanelListDownload)
        DownloadList.__init__(self)
        self.name = name
        self.content_provider = content_provider
        from Plugins.Extensions.archivCZSK.engine.player.player import Player
        self.player = Player(session, self.workingFinished)
        self.sort_options = [{'id':'az', 'name':_('Sort alphabetically')},
                             {'id':'date', 'name':_('Sort by date')},
                             {'id':'size', 'name':_('Sort by size')},
                             {'id':'state', 'name':_('Sort by state')}]
        self.sort_current = self.sort_options[0]
        self.sort_next = self.sort_options[1]
        self.lst_items = self.content_provider.get_downloads()

        self["key_red"] = Button(_("Remove"))
        self["key_green"] = Button("")
        self["key_yellow"] = Button(self.sort_next['name'])
        self["key_blue"] = Button("")
        self.title = self.name.encode('utf-8', 'ignore') + ' - ' + (_("Downloads"))

        self["actions"] = NumberActionMap(["archivCZSKActions"],
            {
                "ok": self.ok,
                "cancel": self.cancel,
                "red": self.askRemoveDownload,
                "yellow": self.toggleSort,
                "up": self.up,
                "down": self.down,
            }, -2)

        self.onLayoutFinish.append(self.sortList)
        self.onShown.append(self.setWindowTitle)
Exemple #37
0
    def __init__(self, session, it):
        BaseArchivCZSKScreen.__init__(self, session)
        self.image_link = None
        self.it = it
        self.image_dest = None
        if it.image is not None:
            self.image_link = it.image.encode('utf-8', 'ignore')
            self.image_dest = os.path.join('/tmp/',
                                           self.image_link.split('/')[-1])
        self.plot = ''
        self.genre = ''
        self.rating = ''
        self.year = ''

        for key, value in it.info.iteritems():
            if key == 'Plot' or key == 'plot':
                self.plot = value.encode('utf-8', 'ignore')
            if key == 'Genre' or key == 'genre':
                self.genre = value.encode('utf-8', 'ignore')
            if key == 'Rating' or key == 'rating':
                self.rating = value.encode('utf-8', 'ignore')
            if key == 'Year' or key == 'year':
                self.year = value.encode('utf-8', 'ignore')

        self["img"] = Pixmap()
        self["genre"] = Label(_("Genre: ") + self.genre)
        self["year"] = Label(_("Year: ") + self.year)
        self["rating"] = Label(_("Rating: ") + self.rating)
        self["plot"] = ScrollLabel(self.plot)

        self["actions"] = NumberActionMap(["archivCZSKActions"], {
            "cancel": self.close,
            "up": self.pageUp,
            "down": self.pageDown,
        }, -2)
        self.title = self.it.name.encode('utf-8', 'ignore')
        self.Scale = AVSwitch().getFramebufferScale()
        self.picLoad = ePicLoad()
        self.picLoad.PictureData.get().append(self.decodePicture)
        self.onLayoutFinish.append(self.showPicture)
Exemple #38
0
def showCSFDInfo(session, item):
    try:
        name = removeDiacriticsCsfd(item.name)
        name = name.replace('.', ' ').replace('_', ' ').replace('-', ' ')

        name = name.replace(" CZ ", "").replace(" EN ", "").replace(
            " SK ", "").replace(" DA ", "").replace(" FI ", "").replace(
                " CH ", "").replace(" HI ",
                                    "").replace(" JP ",
                                                "").replace(" KH ", "")
        name = name.replace(" RU ", "").replace(" KO ", "").replace(" SP ", "")

        year = 0
        yearStr = ""
        try:
            mask = re.compile('([0-9]{4})', re.DOTALL)
            yearStr = mask.findall(name)[0]
            year = int(yearStr)
        except:
            pass

        if ' (' in name:
            name = name[0:name.index("(")]

        name = name.strip()
        log.logDebug("Csfd search '%s', year=%s." % (name, year))

        csfdType = int(config.plugins.archivCZSK.csfdMode.getValue())

        if csfdType == 1:
            from Plugins.Extensions.archivCZSK.gui.archivcsfd import ArchivCSFD
            session.open(ArchivCSFD, name, year)
        elif csfdType == 2:
            from Plugins.Extensions.CSFD.plugin import CSFD
            session.open(CSFD, name)
        elif csfdType == 3:
            from Plugins.Extensions.CSFDLite.plugin import CSFDLite
            try:
                session.open(CSFDLite, name, yearStr)
            except:
                log.logDebug("Trying CsfdLite older version compatibility...")
                session.open(CSFDLite, name)
        else:
            raise Exception("CsfdMode '%s' not supported." % csfdType)
    except:
        log.logError(
            "Show CSFD info failed (plugin may not be installed).\n%s" %
            traceback.format_exc())
        try:
            showInfoMessage(session, _("Show CSFD info failed."), timeout=6)
        except:
            pass
Exemple #39
0
 def showUpdatePremium2(self, callback=None):
     if not callback:
         pdir = os.path.join(settings.ENIGMA_PLUGIN_PATH,'archivCZSKpremium')
         if not os.path.isdir(pdir):
             os.mkdir(pdir)
         self.downloadCommit()
     else:
         strMsg = _('Remove old ArchivCZSK?')+'\n'
         self.archiv.session.openWithCallback(self.updatePremium,
                     MessageBox,
                     strMsg,
                     type=MessageBox.TYPE_YESNO,
                     default=False)
Exemple #40
0
 def removeDiacritics(self):
     try:
         import unicodedata
     except ImportError:
         showInfoMessage(
             self.session,
             _("Cannot remove diacritics, missing unicodedata.so"))
     else:
         self.searchExp = ''.join(
             (c for c in unicodedata.normalize(
                 'NFD', unicode(self.searchExp, 'utf-8', 'ignore'))
              if unicodedata.category(c) != 'Mn')).encode('utf-8')
         self["search"].setText(self.searchExp)
Exemple #41
0
 def askOverrideCB(callback=None):
     if callback:
         if callback[1] == "override":
             try:
                 if dInstance:
                     dManager.removeDownload(dInstance)
                 else:
                     os.remove(download.local)
                 dManager.addDownload(download)
             except OSError as e:
                 print e
         elif callback[1] == "rename":
             session.openWithCallback(renameCB, VirtualKeyBoard, _("Rename filename"), text=download.filename)
Exemple #42
0
 def showMenu(self):
     try:
         self["statusbar"].show()
         #if ( self.Page is 1 or self.Page is 2 ) and self.resultlist:
         self.setTitle(_("Search results for")+ (" '%s'"%self.nazeveventuproskin))
         self["menu"].show()
         self["stars"].hide()
         self["starsbg"].hide()
         self["ratinglabel"].hide()
         self["poster"].hide()
         self["extralabel"].hide()
         #self["titlelabel"].hide()
         self["detailslabel"].hide()
         self["baseFilmInfo"].hide()
         self["key_blue"].setText("")
         self["key_green"].setText(_("List"))
         self["key_yellow"].setText(_("Film info"))
         self.Page = 0
     except:
         self["statusbar"].show()
         self["statusbar"].setText("Fatal ERROR")
         log.logError("Action showMenu failed.\n%s"%traceback.format_exc())
Exemple #43
0
    def _init_menu(self, item):
        addon = item.addon
        item.add_context_menu_item(_("Enable"),
                                   enabled=not addon.get_setting('enabled'),
                                   action=self._enable_addon,
                                   params={'addon': addon})
        item.add_context_menu_item(_("Disable"),
                                   enabled=addon.get_setting(('enabled')),
                                   action=self._disable_addon,
                                   params={'addon': addon})
        item.add_context_menu_item(_("Settings"),
                                   action=addon.open_settings,
                                   params={'session': self.session})
        item.add_context_menu_item(_("Changelog"),
                                   action=addon.open_changelog,
                                   params={'session': self.session})

        item.add_context_menu_item(_("Remove"),
                                   enabled=not addon.supported,
                                   action=self._remove_addon,
                                   params={'addon': addon})
        ItemHandler._init_menu(self, item)
Exemple #44
0
    def search(self, search_exp, addon_id, mode=None):
        if self.searching:
            showInfoMessage(self.session, _("You cannot search, archivCZSK Search is already running"))
            print "%s cannot search, searching is not finished" % self
            return
        if addon_id.lower() == 'csfd':
            CsfdSearch().showCSFDInfo(self.session, search_exp)
            return self.cb()
        elif addon_id.lower() == 'internalcsfd':

            return self.cb()
        else:
            searcher = getSearcher(self.session, addon_id, self.archivCZSK, self._successSearch, self._errorSearch)
            if searcher is not None:
                self.searcher = searcher
                self.searching = True
                self.addon = searcher.addon
                searcher.start()
                searcher.search(search_exp, mode)
            else:
                showInfoMessage(self.session, _("Cannot find searcher") + ' ' + addon_id.encode('utf-8'))
                return self.cb()
Exemple #45
0
 def __init__(self, session, captcha_file):
     BaseArchivCZSKScreen.__init__(self, session, False)
     VirtualKeyBoard.__init__(self,
                              session,
                              title=removeDiac(_('Type text of picture')))
     self["captcha"] = Pixmap()
     self.Scale = AVSwitch().getFramebufferScale()
     self.picPath = captcha_file
     self.picLoad = ePicLoad()
     self.picLoad_conn = eConnectCallback(self.picLoad.PictureData,
                                          self.decodePicture)
     self.onLayoutFinish.append(self.showPicture)
     self.onClose.append(self.__onClose)
Exemple #46
0
 def __service_started(self):
     self.__timer.stop()
     self.resetSubs(True)
     if (self.__resume_time_sec is not None
             or self.__subtitles_url is not None):
         if self.__resume_time_sec is not None:
             Notifications.AddNotificationWithID(self.RESUME_POPUP_ID,
                                                 MessageBox,
                                                 _("Resuming playback"),
                                                 timeout=0,
                                                 type=MessageBox.TYPE_INFO,
                                                 enable_input=False)
         self.__timer.start(500, True)
Exemple #47
0
 def player_callback(self, callback):
     log.info("player_callback(%r)" % (callback, ))
     if callback is not None:
         if callback[0] == "eof":
             if callback[1]:
                 self.player_callback(("playlist", "next"))
             else:
                 self.video_player.close()
         elif callback[0] == "exit":
             exit_player = True
             if len(callback) == 2:
                 exit_player = callback[1]
             else:
                 if self.settings.confirmExit.value:
                     self.session.openWithCallback(
                         lambda x: self.player_callback(("exit", x)),
                         MessageBox,
                         text=_("Stop playing this movie?"),
                         type=MessageBox.TYPE_YESNO)
                     exit_player = False
             if exit_player:
                 playpos = getPlayPositionInSeconds(self.session)
                 duration = getDurationInSeconds(self.session)
                 self.video_player.close()
         elif callback[0] == "playlist":
             if callback[1] == "show":
                 if self.playlist_item is not None:
                     title = self.playlist_item.name
                 else:
                     title = self._play_item.name
                 self.playlist_dialog = self.session.openWithCallback(
                     lambda x: self.player_callback(
                         ("playlist", "idx", x)), ArchivCZSKPlaylist,
                     self.playlist, title, self.curr_idx)
             elif callback[1] == "prev":
                 idx = self.curr_idx
                 if idx == 0:
                     idx = len(self.playlist) - 1
                 else:
                     idx -= 1
                 self.play_item(idx=idx)
             elif callback[1] == "next":
                 idx = self.curr_idx
                 # maybe ignore/make optional
                 if idx == len(self.playlist) - 1:
                     self.video_player.close()
                 else:
                     idx += 1
                     self.play_item(idx=idx)
             elif callback[1] == "idx":
                 self.play_item(idx=callback[2])
Exemple #48
0
def getCapabilities():
    """
    Vrati zoznam vsetkych moznosti vyhladavania: tuple(nazov_vyhladavania, id_doplnku, mod_vyhladavania)
    """
    list = []
    #list.append((_('Search in') + ' ' + 'OnlineFiles', 'plugin.video.online-files', 'all'))
    list.append((_('Search in') + ' ' + 'Stream Cinema Community', 'plugin.video.sc2', 'all'))
    list.append((_('Search in') + ' ' + 'Stream Cinema', 'plugin.video.stream-cinema', 'all'))
    list.append((_('Search in') + ' ' + 'Sosac', 'plugin.video.sosac.ph', 'all'))
    list.append((_('Search in') + ' ' + 'CSFD', 'csfd', 'all'))
    #list.append((_('Search in') + ' ' + 'Befun.cz', 'plugin.video.befun.cz', 'all'))
    #list.append((_('Search in') + ' ' + 'Koukni.cz', 'plugin.video.koukni.cz', 'koukni.cz'))
    list.append((_('Search in') + ' ' + 'Webshare.cz', 'plugin.video.online-files', 'webshare.cz'))
    list.append((_('Search in') + ' ' + 'Ulozto.cz', 'plugin.video.online-files', 'ulozto.cz'))
    list.append((_('Search in') + ' ' + 'Bezvadata.cz', 'plugin.video.online-files', 'bezvadata.cz'))
    list.append((_('Search in') + ' ' + 'Hellspy.cz', 'plugin.video.online-files', 'hellspy.cz'))
    list.append((_('Search in') + ' ' + 'Fastshare.cz', 'plugin.video.online-files', 'fastshare.cz'))
    
    return list
Exemple #49
0
def get_main_settings():
    list = []
    list.append(getConfigListEntry(_("Skin"), config.plugins.archivCZSK.skin))
    list.append(
        getConfigListEntry(_("Default category"),
                           config.plugins.archivCZSK.defaultCategory))
    list.append(
        getConfigListEntry(_("Allow archivCZSK auto update"),
                           config.plugins.archivCZSK.archivAutoUpdate))
    list.append(
        getConfigListEntry(_("Allow addons auto update"),
                           config.plugins.archivCZSK.autoUpdate))
    list.append(MENU_SEPARATOR)
    list.append(
        getConfigListEntry(_("Show movie info"),
                           config.plugins.archivCZSK.showVideoInfo))
    list.append(
        getConfigListEntry(_("Show movie poster"),
                           config.plugins.archivCZSK.downloadPoster))
    list.append(
        getConfigListEntry(_("Max posters on HDD"),
                           config.plugins.archivCZSK.posterImageMax))
    list.append(MENU_SEPARATOR)
    # list.append(getConfigListEntry(_("Preload"), config.plugins.archivCZSK.preload))
    list.append(
        getConfigListEntry(_("Add to extensions menu"),
                           config.plugins.archivCZSK.extensions_menu))
    list.append(
        getConfigListEntry(_("Add to main menu"),
                           config.plugins.archivCZSK.main_menu))
    # if i know this is not functional
    #list.append(getConfigListEntry(_("Add search option in epg menu"), config.plugins.archivCZSK.epg_menu))
    list.append(MENU_SEPARATOR)
    list.append(
        getConfigListEntry(_("CSFD plugin"),
                           config.plugins.archivCZSK.csfdMode))

    return list
Exemple #50
0
 def _init_menu(self, item):
     self.item = item
     addon = item.addon
     # item.add_context_menu_item(_("Update"), action=item.addon.update)
     item.add_context_menu_item(_("Settings"),
                                action=addon.open_settings,
                                params={'session': self.session})
     item.add_context_menu_item(_("Changelog"),
                                action=addon.open_changelog,
                                params={'session': self.session})
     item.add_context_menu_item(_("Downloads"),
                                action=addon.open_downloads,
                                params={
                                    'session': self.session,
                                    'cb':
                                    self.content_screen.workingFinished
                                })
     item.add_context_menu_item(_("Shortcuts"),
                                action=addon.open_shortcuts,
                                params={
                                    'session': self.session,
                                    'cb': self.open_shortcuts_cb
                                })
Exemple #51
0
def Plugins(path, **kwargs):
    list = [PluginDescriptor(where=[PluginDescriptor.WHERE_SESSIONSTART], fnc=sessionStart),
        PluginDescriptor(NAME, description=DESCRIPTION, where=PluginDescriptor.WHERE_PLUGINMENU, fnc=main, icon="czsk.png")]
    if config.plugins.archivCZSK.extensions_menu.value:
        #list.append(PluginDescriptor(NAME, where=PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main))
        list.append(PluginDescriptor(NAME, description=DESCRIPTION, where=PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main))
    if config.plugins.archivCZSK.main_menu.value:
        #list.append(PluginDescriptor(NAME, where=PluginDescriptor.WHERE_MENU, fnc=menu))
        list.append(PluginDescriptor(NAME, description=DESCRIPTION, where=PluginDescriptor.WHERE_MENU, fnc=menu))
    if config.plugins.archivCZSK.epg_menu.value:
        list.append(PluginDescriptor(_("Search in ArchivCZSK"), where=PluginDescriptor.WHERE_EVENTINFO, fnc=eventInfo))

    list.append(PluginDescriptor("OS_refresh", where=PluginDescriptor.WHERE_EVENTINFO, fnc=osrefresh))
    return list
Exemple #52
0
 def wrapped(*args, **kwargs):
     try:
         try:
             func(*args, **kwargs) 
         # addon specific exceptions
         except addon.AddonInfoError as er:
             log.logError("Addon (AddonInfoError) error '%s'.\n%s"%(er.value,traceback.format_exc()))
             self.infoMessage(er.value)
         except addon.AddonWarningError as er:
             log.logError("Addon (AddonWarningError) error '%s'.\n%s"%(er.value,traceback.format_exc()))
             self.warningMessage(er.value)
         except addon.AddonError as er:
             log.logError("Addon (AddonError) error '%s'.\n%s"%(er.value,traceback.format_exc()))
             self.errorMessage(er.value)
         # loading exceptions
         except urllib2.HTTPError, e:
             log.logError("Addon (HTTPError) error '%s'.\n%s"%(e.code,traceback.format_exc()))
             message = "%s %s:%d" % (_("Error in loading"), _("HTTP Error"), e.code)
             self.errorMessage(message)
         except urllib2.URLError, e:
             log.logError("Addon (URLError) error '%s'.\n%s"%(e.reason,traceback.format_exc()))
             message = "%s %s:%s" % (_("Error in loading"), _("URL Error"), str(e.reason))
             self.errorMessage(message)
Exemple #53
0
    def showCSFDInfo(self, session, searchExp):
        try:
            name = removeDiac(searchExp)
            name = name.replace('.', ' ').replace('_', ' ').replace('*', '')

            # remove languages ... "Mother - CZ, EN, KO (2017)"
            name = re.sub("\s-\s[A-Z]{2}(,\s[A-Z]{2})*\s\(", " (", name)

            year = 0
            yearStr = ""
            try:
                mask = re.compile('([0-9]{4})', re.DOTALL)
                yearStr = mask.findall(name)[0]
                year = int(yearStr)
            except:
                pass
            # remove year
            name = re.sub("\([0-9]{4}\)", "", name)

            name = name.strip()
            log.logDebug("Csfd search '%s', year=%s." % (name, year))

            csfdType = int(config.plugins.archivCZSK.csfdMode.getValue())

            if csfdType == 1:
                from Plugins.Extensions.archivCZSK.gui.archivcsfd import ArchivCSFD
                session.open(ArchivCSFD, name, year)
            elif csfdType == 2:
                from Plugins.Extensions.CSFD.plugin import CSFD
                session.open(CSFD, name)
            elif csfdType == 3:
                from Plugins.Extensions.CSFDLite.plugin import CSFDLite
                try:
                    session.open(CSFDLite, name, yearStr)
                except:
                    log.logDebug(
                        "Trying CsfdLite older version compatibility...")
                    session.open(CSFDLite, name)
            else:
                raise Exception("CsfdMode '%s' not supported." % csfdType)
        except:
            log.logError(
                "Show CSFD info failed (plugin may not be installed).\n%s" %
                traceback.format_exc())
            try:
                showInfoMessage(session,
                                _("Show CSFD info failed."),
                                timeout=6)
            except:
                pass
Exemple #54
0
def get_misc_settings():
    list = []
    list.append(getConfigListEntry(_("Debug mode"), config.plugins.archivCZSK.debugMode))
    list.append(getConfigListEntry(_("Confirm exit when closing plugin"), config.plugins.archivCZSK.confirmExit))
    list.append(getConfigListEntry(_("Show broken addons"), config.plugins.archivCZSK.showBrokenAddons))
    list.append(getConfigListEntry(_("Show video source selection"), config.plugins.archivCZSK.showVideoSourceSelection))
    list.append(getConfigListEntry(_("Convert captcha images to 8bit"), config.plugins.archivCZSK.convertPNG))
    list.append(getConfigListEntry(_("Drop caches on exit"), config.plugins.archivCZSK.clearMemory))
    return list
Exemple #55
0
class AddonExceptionHandler(GUIExceptionHandler):
    errorName = _("Addon error")
    warningName = _("Addon warning")
    infoName = _("Addon info")
    
    def __call__(self, func):
        def wrapped(*args, **kwargs):
            try:
                try:
                    func(*args, **kwargs) 
                # addon specific exceptions
                except addon.AddonInfoError as er:
                    log.logError("Addon (AddonInfoError) error '%s'.\n%s"%(er.value,traceback.format_exc()))
                    self.infoMessage(er.value)
                except addon.AddonWarningError as er:
                    log.logError("Addon (AddonWarningError) error '%s'.\n%s"%(er.value,traceback.format_exc()))
                    self.warningMessage(er.value)
                except addon.AddonError as er:
                    log.logError("Addon (AddonError) error '%s'.\n%s"%(er.value,traceback.format_exc()))
                    self.errorMessage(er.value)
                # loading exceptions
                except urllib2.HTTPError, e:
                    log.logError("Addon (HTTPError) error '%s'.\n%s"%(e.code,traceback.format_exc()))
                    message = "%s %s:%d" % (_("Error in loading"), _("HTTP Error"), e.code)
                    self.errorMessage(message)
                except urllib2.URLError, e:
                    log.logError("Addon (URLError) error '%s'.\n%s"%(e.reason,traceback.format_exc()))
                    message = "%s %s:%s" % (_("Error in loading"), _("URL Error"), str(e.reason))
                    self.errorMessage(message)
                except addon.AddonThreadException as er:
                    log.logError("Addon (AddonThreadException) error.\n%s"%(traceback.format_exc()))
                    pass
                # we handle all possible exceptions since we dont want plugin to crash because of addon error..       
                except Exception, e:
                    log.logError("Addon error.\n%s"%traceback.format_exc())
                    self.errorMessage(_("Author of this addon needs to update it"))
                    traceback.print_exc()
Exemple #56
0
def search(session, search_exp, addon_id, mode=None, cb=None):
    """
    Vyhlada v archivCZSK hladany vyraz prostrednictvom addonu s addon_id s modom vyhladavania mode
    @param : session - aktivna session
    @param : search_exp - hladany vyraz
    @param : addon_id - id addonu v ktorom chceme vyhladavat
    @param : mode - mod vyhladavania podporovany addonom
    """
    if search_exp is None or search_exp == "":
        showInfoMessage(session, _("Empty search expression"))
        return cb()

    archivCZSKSeeker = ArchivCZSKSeeker.getInstance(session, cb)
    if archivCZSKSeeker is not None:
        archivCZSKSeeker.search(search_exp, addon_id, mode)
Exemple #57
0
 def download_commit(self):
     try:
         log.logInfo("Checking addons update...")
         path = os.path.join(os.path.dirname(__file__), 'commit')
         if os.path.exists(path):
             os.remove(path)
         self.__updateDialog = self.session.openWithCallback(self.check_updates_finished, MessageBox, 
                                            _("Checking for updates"), 
                                            type=MessageBox.TYPE_INFO, 
                                            enable_input=False)
         self.__console = Console()
         self.__console.ePopen('curl -kfo %s https://raw.githubusercontent.com/mx3L/archivczsk-doplnky/master-next/commit' % path, self.check_commit_download)
     except:
         log.logError("Download addons commit failed.")
         self.open_archive_screen()
Exemple #58
0
 def updateMenuList(self, index=0):
     itemList = []
     itemColor = 0xffffff
     addonState = _("enabled")
     for item in self.lst_items:
         addon = item.addon
         if addon.get_info('broken'):
             itemColor = 0xff0000
             addonState = _("broken")
         elif not addon.get_setting('enabled'):
             if addon.supported:
                 itemColor = 0xffff00
             else:
                 itemColor = 0xf5f500
             addonState = _("disabled")
         else:
             if addon.supported:
                 itemColor = 0x00ff00
             else:
                 itemColor = 0x00f500
             addonState = _("enabled")
         itemList.append((toString(item.name), addonState, itemColor))
     self["menu"].list = itemList
     self["menu"].index = index
        def ask_if_download():
            filename[0], size_bytes = getFilenameAndLength(
                item.url, headers, filename[0])
            size_mbytes = size_bytes and util.BtoMB(size_bytes) or "???"
            free_bytes = util.get_free_space(destination[0])
            free_mbytes = free_bytes and util.BtoMB(free_bytes) or "???"

            message = "%s:\n\n%s:\n%s - %sMB\n\n%s:\n%s - %sMB %s\n\n%s:\n%s" % (
                _("Do you want to download"), _("Source"), toString(
                    item.name), str(size_mbytes), _("Destination"),
                toString(destination[0]), str(free_mbytes), _("free"),
                _("Filename"), toString(filename[0]))
            choices = [(_("yes"), "yes"), (_("no"), "no"),
                       (_("Change location"), "change"),
                       (_("Edit filename"), "filename")]

            session.openWithCallback(ask_if_download_callback,
                                     MessageBox,
                                     message,
                                     MessageBox.TYPE_YESNO,
                                     list=choices)
Exemple #60
0
    def doWork(self):
        try:

            def check_archiv():
                try:
                    if self.downloadUpdateXml():
                        from Plugins.Extensions.archivCZSK.version import version
                        local_version = version
                        xmlroot = util.load_xml(
                            self.updateXmlFilePath).getroot()
                        self.remote_version = xmlroot.attrib.get('version')
                        log.logDebug(
                            "ArchivUpdater version local/remote: %s/%s" %
                            (local_version, self.remote_version))

                        if util.check_version(local_version,
                                              self.remote_version):
                            self.needUpdate = True
                        else:
                            self.needUpdate = False
                    else:
                        self.needUpdate = False
                except:
                    log.logError("ArchivUpdater compare versions failed.\n%s" %
                                 traceback.format_exc())

            check_archiv()
            #thread = threading.Thread(target=check_archiv)
            #thread.start()
            #thread.join()

            if self.needUpdate:
                log.logInfo("ArchivUpdater update found...%s" %
                            self.remote_version)
                strMsg = "%s %s?" % (
                    _("Do you want to update archivCZSK to version"),
                    toString(self.remote_version))
                self.archiv.session.openWithCallback(
                    self.updateArchiv,
                    MessageBox,
                    strMsg,
                    type=MessageBox.TYPE_YESNO)
            else:
                self.continueToArchiv()
        except:
            log.logError("ArchivUpdater update failed.\n%s" %
                         traceback.format_exc())
            self.continueToArchiv()