def __init__(self, session, service, file_name, is_main_movie): s = eServiceReferenceBludisc(service) if file_name: s.setPath(file_name) BludiscCutListSupport.__init__(self, s, is_main_movie) eBludiscPlayer.__init__(self, session, service) self.addPlayerEvents()
def scanForMovies(self, root): # print "[AdvancedMovieSelection] scan folder:", root scan_service = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + root) root_list = self.serviceHandler.list(scan_service) if root_list is None: print("listing of movies failed") return tags = set() l = [] dirs = [] while True: serviceref = root_list.getNext() if not serviceref.valid(): break dvd = None # print serviceref.getPath() # dvd structure if serviceref.flags & eServiceReference.mustDescent: dvd = detectDVDStructure(serviceref.getPath()) if dvd is not None: if serviceref.getPath()[:-1].endswith(TRASH_NAME): continue serviceref = eServiceReferenceDvd(serviceref, True) bludisc = detectBludiscStructure(serviceref.getPath()) if bludisc is not None: if serviceref.getPath()[:-1].endswith(TRASH_NAME): continue serviceref = eServiceReferenceBludisc(serviceref, True) if not dvd and not bludisc: continue if False: # add folder dir tempDir = serviceref.getPath() parts = tempDir.split(os.sep) dirName = parts[-2] if self.movieConfig.isHidden(dirName): continue serviceref.setName(dirName) dirs.append((serviceref, None, -1, -1)) continue # check hidden files temp = serviceref.getPath() parts = temp.split(os.sep) if self.movieConfig.isHidden(parts[-1]): continue ext = temp.split(".")[-1].lower() if ext in AUDIO_EXCLUDE: continue # check currently moving files if serviceUtil.isServiceMoving(serviceref): continue # check iso and img files extension = serviceref.getPath().split(".")[-1].lower() if extension == "iso" or extension == "img": serviceref = eServiceReferenceDvd(serviceref) info = self.serviceHandler.info(serviceref) # get begin time if dvd is not None: begin = int(os.stat(dvd).st_mtime) else: begin = info.getInfo(serviceref, iServiceInformation.sTimeCreate) # convert space-seperated list of tags into a set this_tags = info.getInfoString( serviceref, iServiceInformation.sTags).split(' ') if this_tags is None or this_tags == ['']: this_tags = [] this_tags = set(this_tags) tags |= this_tags # add to list service_name = info.getName(serviceref) mi = MovieInfo(service_name, serviceref, info, begin) l.append(mi) # we always must add location to movielibrary dir_size = getDirSize(root) self.movielibrary.addMovieList(root, l, dir_size) self.movielibrary.addTags(tags)
def getService(self, service): service = eServiceReferenceBludisc(service) service.setBludisc(self.MOUNT_PATH) return service
def scanForMovies(self, root): # print "[AdvancedMovieSelection] scan folder:", root scan_service = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + root) root_list = self.serviceHandler.list(scan_service) if root_list is None: print "listing of movies failed" return tags = set() l = [] dirs = [] while 1: serviceref = root_list.getNext() if not serviceref.valid(): break dvd = None # print serviceref.getPath() # dvd structure if serviceref.flags & eServiceReference.mustDescent: dvd = detectDVDStructure(serviceref.getPath()) if dvd is not None: if serviceref.getPath()[:-1].endswith(TRASH_NAME): continue serviceref = eServiceReferenceDvd(serviceref, True) bludisc = detectBludiscStructure(serviceref.getPath()) if bludisc is not None: if serviceref.getPath()[:-1].endswith(TRASH_NAME): continue serviceref = eServiceReferenceBludisc(serviceref, True) if not dvd and not bludisc: continue if False: # add folder dir tempDir = serviceref.getPath() parts = tempDir.split(os.sep) dirName = parts[-2] if self.movieConfig.isHidden(dirName): continue serviceref.setName(dirName) dirs.append((serviceref, None, -1, -1)) continue # check hidden files temp = serviceref.getPath() parts = temp.split(os.sep) if self.movieConfig.isHidden(parts[-1]): continue ext = temp.split(".")[-1].lower() if ext in AUDIO_EXCLUDE: continue # check currently moving files if serviceUtil.isServiceMoving(serviceref): continue # check iso and img files extension = serviceref.getPath().split(".")[-1].lower() if extension == "iso" or extension == "img": serviceref = eServiceReferenceDvd(serviceref) info = self.serviceHandler.info(serviceref) # get begin time if dvd is not None: begin = long(os.stat(dvd).st_mtime) else: begin = info.getInfo(serviceref, iServiceInformation.sTimeCreate) # convert space-seperated list of tags into a set this_tags = info.getInfoString(serviceref, iServiceInformation.sTags).split(' ') if this_tags is None or this_tags == ['']: this_tags = [] this_tags = set(this_tags) tags |= this_tags # add to list service_name = info.getName(serviceref) mi = MovieInfo(service_name, serviceref, info, begin) l.append(mi) # we always must add location to database dir_size = getDirSize(root) self.database.addMovieList(root, l, dir_size) self.database.addTags(tags)