masterscraper/masterscraper/core/meta_tags.py

25 lines
1.1 KiB
Python

#!/usr/bin/env python3
#--------[ Extract Tag Information ]--------#
def meta_tags(self):
if not self.meta['type'] in self.meta['tags']: self.meta['tags'].append(self.meta['type'])
if not self.meta['category'] in self.meta['tags']: self.meta['tags'].append(self.meta['category'])
if not self.meta['subcategory'] in self.meta['tags']: self.meta['tags'].append(self.meta['subcategory'])
if self.meta['scope'] != None:
if not self.meta['scope'].lower() in self.meta['tags']:
self.meta['tags'].append( self.meta['scope'].lower() )
for scope in self.info['scope']:
if not scope in self.meta['tags']:
self.meta['tags'].append(scope)
if scope == 'female' or scope == 'male':
self.meta['tags'].append('gender')
if scope == 'black' or scope == 'white' or scope == 'asian' or scope == 'native':
self.meta['tags'].append('race')
if None in self.meta['tags']:
self.meta['tags'].pop( self.meta['tags'].index(None) )
if 'None' in self.meta['tags']:
self.meta['tags'].pop( self.meta['tags'].index('None') )