2018-10-31 16:08:29 +00:00
|
|
|
# coding=utf-8
|
|
|
|
|
2019-09-17 02:04:27 +00:00
|
|
|
from __future__ import absolute_import
|
2018-10-31 16:08:29 +00:00
|
|
|
import logging
|
|
|
|
from libfilebot import get_filebot_attrs
|
2019-09-17 02:04:27 +00:00
|
|
|
from .common import update_video
|
2018-10-31 16:08:29 +00:00
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
def refine(video, **kwargs):
|
|
|
|
"""
|
|
|
|
|
|
|
|
:param video:
|
|
|
|
:param kwargs:
|
|
|
|
:return:
|
|
|
|
"""
|
|
|
|
try:
|
|
|
|
orig_fn = get_filebot_attrs(video.name)
|
|
|
|
|
|
|
|
if orig_fn:
|
|
|
|
update_video(video, orig_fn)
|
|
|
|
else:
|
|
|
|
logger.info(u"%s: Filebot didn't return an original filename", video.name)
|
|
|
|
except:
|
|
|
|
logger.exception(u"%s: Something went wrong when retrieving filebot attributes:", video.name)
|