def force_id_search(wanted_item_index): log.info("Force id search") # Get wanted queue lock if not utils.get_wanted_queue_lock(): return # Force id search wanted_item = autosubliminal.WANTEDQUEUE[int(wanted_item_index)] title = wanted_item['title'] year = wanted_item['year'] if wanted_item['type'] == 'episode': wanted_item['tvdbid'] = utils.get_tvdb_id(title, True) elif wanted_item['type'] == 'movie': wanted_item['imdbid'], wanted_item['year'] = utils.get_imdb_info(title, year, True) # Release wanted queue lock utils.release_wanted_queue_lock()
def force_id_search(wanted_item_index): log.info("Force id search") # Get wanted queue lock if not utils.get_wanted_queue_lock(): return # Force id search wanted_item = autosubliminal.WANTEDQUEUE[int(wanted_item_index)] title = wanted_item['title'] year = wanted_item['year'] if wanted_item['type'] == 'episode': wanted_item['tvdbid'] = utils.get_tvdb_id(title, True) elif wanted_item['type'] == 'movie': wanted_item['imdbid'], wanted_item['year'] = utils.get_imdb_info( title, year, True) # Release wanted queue lock utils.release_wanted_queue_lock()
def walk_dir(path): log.info("Scanning video path: %s" % path) for dirname, dirnames, filenames in os.walk(os.path.join(path)): log.debug("Directory: %s" % dirname) # Check folders to be skipped if autosubliminal.SKIPHIDDENDIRS and os.path.split( dirname)[1].startswith(u'.'): continue if re.search('_unpack_', dirname, re.IGNORECASE): log.debug("Found a unpack directory, skipping") continue if re.search('_failed_', dirname, re.IGNORECASE): log.debug("Found a failed directory, skipping") continue # Populate WANTEDQUEUE for filename in filenames: log.debug("File: %s" % filename) root, ext = os.path.splitext(filename) if ext and ext in subliminal.video.VIDEO_EXTENSIONS: # Skip 'sample' videos if re.search('sample', filename, re.IGNORECASE): continue # Check if there are missing subtitle languages for the video file languages = check_missing_subtitle_languages(dirname, filename) if len(languages) > 0: log.debug("File is missing a subtitle") wanted_item = fileprocessor.process_file(dirname, filename) if wanted_item: # Episode wanted if wanted_item['type'] == 'episode': title = wanted_item['title'] season = wanted_item['season'] episode = wanted_item['episode'] if utils.skip_show(title, season, episode): log.info("Skipping %s - Season %s Episode %s" % (title, season, episode)) continue log.info( "Subtitle(s) wanted for %s and added to wantedQueue" % filename) wanted_item[ 'originalFileLocationOnDisk'] = os.path.join( dirname, filename) wanted_item['time'] = os.path.getctime( wanted_item['originalFileLocationOnDisk']) wanted_item['timestamp'] = unicode( time.strftime( '%Y-%m-%d %H:%M:%S', time.localtime(wanted_item['time']))) wanted_item['lang'] = languages wanted_item['tvdbid'] = utils.get_tvdb_id(title) autosubliminal.WANTEDQUEUE.append(wanted_item) # Movie wanted elif wanted_item['type'] == 'movie': title = wanted_item['title'] year = wanted_item['year'] if utils.skip_movie(title, year): log.info("Skipping %s (%s)" % (title, year)) continue log.info( "Subtitle(s) wanted for %s and added to wantedQueue" % filename) wanted_item[ 'originalFileLocationOnDisk'] = os.path.join( dirname, filename) wanted_item['time'] = os.path.getctime( wanted_item['originalFileLocationOnDisk']) wanted_item['timestamp'] = unicode( time.strftime( '%Y-%m-%d %H:%M:%S', time.localtime(wanted_item['time']))) wanted_item['lang'] = languages wanted_item['imdbid'], wanted_item[ 'year'] = utils.get_imdb_info(title, year) autosubliminal.WANTEDQUEUE.append(wanted_item) else: log.error("Could not process the filename: %s" % filename) continue # Sort WANTEDQUEUE autosubliminal.WANTEDQUEUE = sorted(autosubliminal.WANTEDQUEUE, key=itemgetter('time'), reverse=True)
def walk_dir(path): log.info("Scanning video path: %s" % path) for dirname, dirnames, filenames in os.walk(os.path.join(path)): log.debug("Directory: %s" % dirname) # Check folders to be skipped if autosubliminal.SKIPHIDDENDIRS and os.path.split(dirname)[1].startswith(u'.'): continue if re.search('_unpack_', dirname, re.IGNORECASE): log.debug("Found a unpack directory, skipping") continue if re.search('_failed_', dirname, re.IGNORECASE): log.debug("Found a failed directory, skipping") continue # Populate WANTEDQUEUE for filename in filenames: log.debug("File: %s" % filename) root, ext = os.path.splitext(filename) if ext and ext in subliminal.video.VIDEO_EXTENSIONS: # Skip 'sample' videos if re.search('sample', filename, re.IGNORECASE): continue # Check if there are missing subtitle languages for the video file languages = check_missing_subtitle_languages(dirname, filename) if len(languages) > 0: log.debug("File is missing a subtitle") wanted_item = fileprocessor.process_file(dirname, filename) if wanted_item: # Episode wanted if wanted_item['type'] == 'episode': title = wanted_item['title'] season = wanted_item['season'] episode = wanted_item['episode'] if utils.skip_show(title, season, episode): log.info("Skipping %s - Season %s Episode %s" % (title, season, episode)) continue log.info("Subtitle(s) wanted for %s and added to wantedQueue" % filename) wanted_item['originalFileLocationOnDisk'] = os.path.join(dirname, filename) wanted_item['time'] = os.path.getctime(wanted_item['originalFileLocationOnDisk']) wanted_item['timestamp'] = unicode(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime( wanted_item['time']))) wanted_item['lang'] = languages wanted_item['tvdbid'] = utils.get_tvdb_id(title) autosubliminal.WANTEDQUEUE.append(wanted_item) # Movie wanted elif wanted_item['type'] == 'movie': title = wanted_item['title'] year = wanted_item['year'] if utils.skip_movie(title, year): log.info("Skipping %s (%s)" % (title, year)) continue log.info("Subtitle(s) wanted for %s and added to wantedQueue" % filename) wanted_item['originalFileLocationOnDisk'] = os.path.join(dirname, filename) wanted_item['time'] = os.path.getctime(wanted_item['originalFileLocationOnDisk']) wanted_item['timestamp'] = unicode(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime( wanted_item['time']))) wanted_item['lang'] = languages wanted_item['imdbid'], wanted_item['year'] = utils.get_imdb_info(title, year) autosubliminal.WANTEDQUEUE.append(wanted_item) else: log.error("Could not process the filename: %s" % filename) continue # Sort WANTEDQUEUE autosubliminal.WANTEDQUEUE = sorted(autosubliminal.WANTEDQUEUE, key=itemgetter('time'), reverse=True)