def remove_tags(self): """ This function is used to scan processed emby profile, so it will only scan correct directories and their nfo files """ for (root, dirs, files) in os.walk(self.root_path): for each_file in files: # we only process nfo file from here # also ignore file starts with . (auto generated by macos) if os.path.splitext(each_file)[1] == '.nfo' and \ not os.path.splitext(each_file)[0].startswith('.'): try: nfo_obj = EmbyNfo() nfo_obj.parse_emby_nfo(os.path.join(root, each_file)) # we only save Relative path to the root in db to make the db work across different machine nfo_obj.jav_obj['directory'] = os.path.relpath( root, self.root_path) nfo_obj.jav_obj['stat'] = 3 self.jav_manage.upcreate_jav(nfo_obj.jav_obj) self.file_list.append(nfo_obj.jav_obj) self.write_nfo(nfo_obj.jav_obj, verify=True) print('deleted tag for {}'.format( nfo_obj.jav_obj['directory'])) except Exception as e: print('**********error {} detected for {}***********'. format(e, each_file))
def scan_emby_root_path(self): """ This function is used to scan processed emby profile, so it will only scan correct directories and their nfo files """ for (root, dirs, files) in os.walk(self.root_path): for each_file in files: # we only process nfo file from here # also ignore file starts with . (auto generated by macos) if os.path.splitext(each_file)[1] == '.nfo' and \ not os.path.splitext(each_file)[0].startswith('.'): nfo_obj = EmbyNfo() nfo_obj.parse_emby_nfo(os.path.join(root, each_file)) nfo_obj.jav_obj['directory'] = root nfo_obj.jav_obj['stat'] = 3 self.jav_manage.upcreate_jav(nfo_obj.jav_obj) self.file_list.append(nfo_obj.jav_obj)