Compare commits

...

2 commits

Author SHA1 Message Date
e15437252e kyaaa!! >~< 2023-02-05 12:09:44 -08:00
fea0c31d08 oops forgot to readd stuff cuz i moved it >~< 2023-02-05 12:07:35 -08:00
9 changed files with 42 additions and 34 deletions

17
category/deviantart.py Normal file
View 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
View 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
View file

@ -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... ")

View file

@ -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 tags.category == 'deviantart':
from ..category.deviantart import makeKeyWordList
for item in makeKeyWordList(tags):
if item not in keywords: keywords.append(item)
elif tags.category == 'furaffinity':
from ..category.furaffinity import makeKeyWordList
for item in makeKeyWordList(tags):
if item not in keywords: keywords.append(item)
if rating in tags and tags.rating not in keywords:
keywords.append(tags.rating)
if species in tags and tags.species not in keywords:
keywords.append(tags.species)
if gender in tags and tags.gender not in keywords:
keywords