#  -*- coding: utf-8 -*-

# Copyright 2020 FanFicFare team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#


from __future__ import absolute_import
import logging
logger = logging.getLogger(__name__)

from .adapter_wuxiaworldco import WuxiaWorldCoSiteAdapter

def getClass():
    return NovelUpdatesCcSiteAdapter

class NovelUpdatesCcSiteAdapter(WuxiaWorldCoSiteAdapter):
    DATE_FORMAT = '%Y-%m-%d %H:%M'

    def __init__(self, config, url):
        WuxiaWorldCoSiteAdapter.__init__(self, config, url)
        self.story.setMetadata('siteabbrev', 'nucc')

    @staticmethod
    def getSiteDomain():
        return 'www.novelupdates.cc'

    @classmethod
    def getAcceptDomains(cls):
        return ['www.novelupdates.cc','m.novelupdates.cc']

    @classmethod
    def getSiteExampleURLs(cls):
        return 'https://%s/story-name' % cls.getSiteDomain()

    def getSiteURLPattern(self):
        return r'https?://(www|m)\.novelupdates\.cc/(?P<id>[^/]+)(/)?'
