Compare commits
2 commits
8ed5644f81
...
e15437252e
Author | SHA1 | Date | |
---|---|---|---|
e15437252e | |||
fea0c31d08 |
9 changed files with 42 additions and 34 deletions
17
category/deviantart.py
Normal file
17
category/deviantart.py
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
def makeKeyWordList(tags):
|
||||||
|
catPaths = {
|
||||||
|
'digitalart/paintings/other': ['Digital Art', 'Paintings']
|
||||||
|
}
|
||||||
|
output = [
|
||||||
|
tags.da_category,
|
||||||
|
tags.license,
|
||||||
|
tags.author.username
|
||||||
|
]
|
||||||
|
|
||||||
|
if tags.is_mature:
|
||||||
|
output.append('is_mature')
|
||||||
|
|
||||||
|
|
||||||
|
for item in .get(tags.category_path,[]):
|
||||||
|
output.append(item)
|
||||||
|
|
9
category/furaffinity.py
Normal file
9
category/furaffinity.py
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
def makeKeyWordList(tags):
|
||||||
|
return [
|
||||||
|
tags.theme,
|
||||||
|
tags.rating,
|
||||||
|
tags.species,
|
||||||
|
tags.gender,
|
||||||
|
tags.artist_url,
|
||||||
|
tags.fa_category
|
||||||
|
]
|
22
main.py
22
main.py
|
@ -1,22 +0,0 @@
|
||||||
# module imports
|
|
||||||
import sys
|
|
||||||
import json
|
|
||||||
import logging
|
|
||||||
|
|
||||||
# init logging
|
|
||||||
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
|
|
||||||
|
|
||||||
# variable init
|
|
||||||
infojson={}
|
|
||||||
source=sys.argv[1]
|
|
||||||
|
|
||||||
logging.info(f"loading info.json for {source}...")
|
|
||||||
with open(f"{source}.json") as file:
|
|
||||||
infojson=json.load(file)
|
|
||||||
|
|
||||||
# TODO: insert method to check url or dict
|
|
||||||
logging.debug("determining file type...")
|
|
||||||
import exif
|
|
||||||
if infojson.extension in exif.allowed_exts:
|
|
||||||
logging.debug(f"exif module supports {infojson.extesnion} files. using it... ")
|
|
||||||
|
|
|
@ -102,22 +102,26 @@ def writeTags(file, tags):
|
||||||
if date in tags:
|
if date in tags:
|
||||||
xmptags['Xmp.dc.date'] = tags.date
|
xmptags['Xmp.dc.date'] = tags.date
|
||||||
|
|
||||||
from getpub import getPub
|
from ..misc.getpub import getPub
|
||||||
xmptags['Xmp.dc.publisher'] = getPub(tags)
|
xmptags['Xmp.dc.publisher'] = getPub(tags)
|
||||||
del getPub
|
del getPub
|
||||||
|
|
||||||
keywords=[]
|
keywords=[]
|
||||||
|
|
||||||
if tags in tags: for item in tags.tags: if item not in keywords: keywords.append(item)
|
keywords.append(tags.category)
|
||||||
|
|
||||||
if theme in tags and tags.theme not in keywords:
|
if tags in tags:
|
||||||
keywords.append(tags.theme)
|
for item in tags.tags:
|
||||||
|
if item not in keywords: keywords.append(item)
|
||||||
|
|
||||||
if rating in tags and tags.rating not in keywords:
|
if tags.category == 'deviantart':
|
||||||
keywords.append(tags.rating)
|
from ..category.deviantart import makeKeyWordList
|
||||||
|
for item in makeKeyWordList(tags):
|
||||||
if species in tags and tags.species not in keywords:
|
if item not in keywords: keywords.append(item)
|
||||||
keywords.append(tags.species)
|
elif tags.category == 'furaffinity':
|
||||||
|
from ..category.furaffinity import makeKeyWordList
|
||||||
if gender in tags and tags.gender not in keywords:
|
for item in makeKeyWordList(tags):
|
||||||
keywords
|
if item not in keywords: keywords.append(item)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue