def run_me(): # set root directory root = os.getcwd() print(root) # find instances of file in base directory base_pod_locs = find_file(root) # for each element in base_pod_locs find name/urls, # find downloaded and download missing for base_pod_loc in base_pod_locs: root = base_pod_loc os.chdir(root) # required podcast dictionary req_pods = dicpod() # check directories in run location old_dirs = check_dirs(root, req_pods) # check all old files old_files = get_files(old_dirs) # download all required podcasts for pod,rss_url in sorted(req_pods.items()): # get podcast info req_pods[pod] = PodcastInfo(pod, rss_url).podcast_episodes() # if directory had to be made no old_files key exists # make it if pod not in old_files.keys(): old_files[pod] = [] # run each podcast through download_missing function download_missing(root, pod, req_pods[pod], old_files[pod])
def load_wires(wire_list_file): root_dir = os.path.dirname(wire_list_file); with open(wire_list_file, 'r') as fin: wire_files = [str(name.strip()) for name in fin]; wire_files = [find_file(name, root_dir) for name in wire_files]; wires = [load_wire(name) for name in wire_files]; return wires;
def load_wires(wire_list_file): root_dir = os.path.dirname(wire_list_file) with open(wire_list_file, 'r') as fin: wire_files = [str(name.strip()) for name in fin] wire_files = [find_file(name, root_dir) for name in wire_files] wires = [load_wire(name) for name in wire_files] return wires
def _load_queuefile_to_queue(self): """ 在启动的时候将所有的文件添加到队列里面 :return: """ for queue_file in find_file(RESOURCE_PATH, ".queue"): queue_file = os.path.join(RESOURCE_PATH, queue_file) with open(queue_file) as f: o_mp4 = eval(f.read()) self._job_queue.put(o_mp4)
if len(row) == 2: parsed[row[0]] = row[1] else: parsed[row[0]] = '' try: identity = parsed['app_label'] del parsed['app_label'] except KeyError: identity = parsed['app_gui_label'] del parsed['app_gui_label'] parsed['id'] = identity parsed['file_name'] = p return parsed def get_files(prop): md5 = prop['app_apk_md5'] apk = list(filter(lambda x: md5 in x,os.listdir(backup_dir)))[0] return [ '{}{sep}{}'.format(backup_dir,apk,sep=os.sep), prop['file_name'], prop['file_name'].replace('.properties','.tar.gz') ] properties = find_file(backup_dir,lambda x: '.properties' in x) big_old_dict = {} for entry in properties: entry = parse(entry) if not entry['id'] in big_old_dict.keys(): big_old_dict[entry['id']] = {} big_old_dict[entry['id']][entry['datetime']] = entry
def convert_to_abs_path(field_name): field = config[field_name]; if isinstance(field, (unicode, str)): config[field_name] = str(find_file(field, config_dir));
def convert_to_abs_path(field_name): field = config[field_name] if isinstance(field, str): config[field_name] = str(find_file(field, config_dir))