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
def autostart(reason, **kwargs): if reason == 0: # startup if "session" in kwargs: logger.info("+++ Version: %s starts...", VERSION) logger.info("reason: %s", reason) session = kwargs["session"] touchFile("/etc/enigma2/.mvc") launch_key = config.plugins.moviecockpit.launch_key.value if launch_key == "showMovies": InfoBar.showMovies = boundFunction(openMovieCockpit, session) elif launch_key == "showTv": InfoBar.showTv = boundFunction(openMovieCockpit, session) elif launch_key == "showRadio": InfoBar.showRadio = boundFunction(openMovieCockpit, session) elif launch_key == "openQuickbutton": InfoBar.openQuickbutton = boundFunction( openMovieCockpit, session) elif launch_key == "startTimeshift": InfoBar.startTimeshift = boundFunction(openMovieCockpit, session) ConfigScreenInit.setEPGLanguage( config.plugins.moviecockpit.epglang) MountCockpit.getInstance().registerBookmarks( ID, config.plugins.moviecockpit.bookmarks.value) initPluginSkinPath() applyPluginStyle() loadPluginSkin("skin.xml") elif reason == 1: # shutdown logger.info("--- shutdown") deleteFile("/etc/enigma2/.mvc") else: logger.info("reason not handled: %s", reason)
def applyPluginStyle(): logger.info("...") layout_screen_path = resolveFilename( SCOPE_SKIN, "Default-FHD/MovieCockpit/skin/layout_screen.xml") if os.path.islink(layout_screen_path): deleteFile(layout_screen_path) createSymlink(getSkinPath(config.plugins.moviecockpit.layout_screen.value), layout_screen_path) layout_button_path = resolveFilename( SCOPE_SKIN, "Default-FHD/MovieCockpit/skin/layout_button.xml") if os.path.islink(layout_button_path): deleteFile(layout_button_path) createSymlink(getSkinPath(config.plugins.moviecockpit.layout_button.value), layout_button_path)
def getThisCover(self): logger.debug("search_name: %s", self.search_name) self.page = PAGE_DETAILS self.cover_path = TEMP_COVER_PATH self.backdrop_path = TEMP_BACKDROP_PATH self.info_path = TEMP_INFO_PATH deleteFile(TEMP_COVER_PATH) deleteFile(TEMP_BACKDROP_PATH) deleteFile(TEMP_INFO_PATH) self.info = None self.movielist = [] self.search_names = [self.search_name] for split_char in [":", "-"]: search_names = self.search_name.split(split_char) if len(search_names) > 1: self.search_names += search_names logger.debug("self.search_names: %s", self.search_names) for search_name in self.search_names: movielist = self.getMovieList(search_name) if movielist: self.movielist = movielist break if self.movielist: logger.debug("len(self.movielist): %s", len(self.movielist)) self["previewlist"].setList(self.movielist) if len(self.movielist) > 1: self.page = PAGE_SELECTION self.getInfoAndCoverForCurrentSelection(self.info_path, self.cover_path, self.backdrop_path) else: logger.debug("no movielist available for: %s", search_names) self.switchPage()
def getInfoAndCoverForCurrentSelection(self, info_path, cover_path, backdrop_path): deleteFile(TEMP_COVER_PATH) deleteFile(TEMP_INFO_PATH) deleteFile(TEMP_BACKDROP_PATH) self.info = None self.selection = self["previewlist"].l.getCurrentSelection() logger.debug("selection: %s", str(self.selection)) if self.selection: self.info = self.getTMDBInfo( self.selection[SELECTION_ID], self.selection[SELECTION_TYPE], config.plugins.moviecockpit.cover_language.value) self.saveInfo(info_path, self.info) self.downloadCover(self.info[INFO_COVER_URL], cover_path, self.info[INFO_BACKDROP_URL], backdrop_path)
def deleteCutList(self, path): logger.info("path: %s", path) data = "" FileManager.getInstance().update(path, cuts=data) deleteFile(path + ".cuts")
def deleteThisCover(self): logger.debug("...") deleteFile(TEMP_COVER_PATH) deleteFile(self.cover_path) self.cover_path = TEMP_COVER_PATH deleteFile(TEMP_BACKDROP_PATH) deleteFile(self.backdrop_path) self.back_drop_path = TEMP_BACKDROP_PATH deleteFile(TEMP_INFO_PATH) deleteFile(self.info_path) self.info_path = TEMP_INFO_PATH self.info = None self.session.openWithCallback( self.deleteThisCoverCallback, MessageBox, _("Cover/TMDB Info deleted successfully"), MessageBox.TYPE_INFO, 5)
def KeyExit(self): deleteFile( os.path.join(config.plugins.mediacockpit.cache_dir.value, MDCTEMPFILE) + ".*") config.plugins.mediacockpit.save() self.close(self.fileindex)