Esempio n. 1
0
def parse_link(link, item, patterns):
    link = cleanse_title(urllib.unquote(link))
    file_name = link.split('/')[-1]
    for pattern in patterns:
        pattern = pattern.format(delim=DELIM)
        match = re.search(pattern, file_name, re.I)
        if match:
            match = dict((k, v) for k, v in match.groupdict().iteritems()
                         if v is not None)
            item.update(match)
            break
    else:
        logger.log('No Regex Match: |%s|%s|' % (item, link),
                   log_utils.LOGDEBUG)

    extra = item['extra'].upper()
    if 'X265' in extra or 'HEVC' in extra:
        item['format'] = 'x265'

    item['dubbed'] = True if 'DUBBED' in extra else False

    if 'airdate' in item and item['airdate']:
        pattern = '{delim}+'.format(delim=DELIM)
        item['airdate'] = re.sub(pattern, '-', item['airdate'])
        item['airdate'] = utils2.to_datetime(item['airdate'],
                                             "%Y-%m-%d").date()

    return item
Esempio n. 2
0
def parse_link(link, item, patterns):
    link = cleanse_title(urllib.unquote(link))
    file_name = link.split('/')[-1]
    for pattern in patterns:
        pattern = pattern.format(delim=DELIM)
        match = re.search(pattern, file_name, re.I)
        if match:
            match = dict((k, v) for k, v in match.groupdict().iteritems() if v is not None)
            item.update(match)
            break
    else:
        logger.log('No Regex Match: |%s|%s|' % (item, link), log_utils.LOGDEBUG)

    extra = item['extra'].upper()
    if 'X265' in extra or 'HEVC' in extra:
        item['format'] = 'x265'
    
    item['dubbed'] = True if 'DUBBED' in extra else False
    
    if 'airdate' in item and item['airdate']:
        pattern = '{delim}+'.format(delim=DELIM)
        item['airdate'] = re.sub(pattern, '-', item['airdate'])
        item['airdate'] = utils2.to_datetime(item['airdate'], "%Y-%m-%d").date()
        
    return item
Esempio n. 3
0
 def __init__(self, video_type, title, year, trakt_id, season='', episode='', ep_title='', ep_airdate=''):
     assert(video_type in (VIDEO_TYPES.__dict__[k] for k in VIDEO_TYPES.__dict__ if not k.startswith('__')))
     self.video_type = video_type
     if isinstance(title, unicode): self.title = title.encode('utf-8')
     else: self.title = title
     self.year = str(year)
     self.season = season
     self.episode = episode
     if isinstance(ep_title, unicode): self.ep_title = ep_title.encode('utf-8')
     else: self.ep_title = ep_title
     self.trakt_id = trakt_id
     self.ep_airdate = utils2.to_datetime(ep_airdate, "%Y-%m-%d").date() if ep_airdate else None
Esempio n. 4
0
 def __init__(self, video_type, title, year, trakt_id, season='', episode='', ep_title='', ep_airdate=''):
     assert(video_type in (VIDEO_TYPES.__dict__[k] for k in VIDEO_TYPES.__dict__ if not k.startswith('__')))
     self.video_type = video_type
     if isinstance(title, unicode): self.title = title.encode('utf-8')
     else: self.title = title
     self.year = str(year)
     self.season = season
     self.episode = episode
     if isinstance(ep_title, unicode): self.ep_title = ep_title.encode('utf-8')
     else: self.ep_title = ep_title
     self.trakt_id = trakt_id
     self.ep_airdate = utils2.to_datetime(ep_airdate, "%Y-%m-%d").date() if ep_airdate else None