Esempio n. 1
0
def associate_video_with_matching_artist(show, video):
  for artist_info, artist in _artists(show):    
    associate = False

    if video.artist:
      logger.debug('Checking if %s matches video artist %s' % (artist_info.name, video.artist))

      associate = artist_matches(artist_info.name, video.artist) or (artist and artist_matches(artist.name, video.artist))

    if not associate:
      logger.debug('Checking if %s matches video title %s' % (artist_info.name, video.title))

      associate = artist_mentioned(artist_info.name, video.title) or (artist and artist_mentioned(artist.name, video.title))
      
    if associate:
      logger.debug('Video matches artist: %s, associating' % (artist_info.name))

      if not artist:
        artist = get_or_create_artist(artist_info.name)

        artist_info.artist_id = artist.id

      artist.add_video(video)

      artist.save()

      return True

  return False
Esempio n. 2
0
def associate_profile_with_matching_artist(show, name, profile):
  for artist_info, artist in _artists(show):      
    logger.debug('Checking if %s matches %s' % (artist_info.name, name))

    if artist_matches(artist_info.name, name) or (artist and artist_matches(artist.name, name)):
      logger.debug('Resource matches artist: %s, associating' % (artist_info.name))
      
      if not artist:
        artist = get_or_create_artist(artist_info.name)

        artist_info.artist_id = artist.id

      artist.add_profile(profile)

      artist.save()
      
      return True
    
  return False
Esempio n. 3
0
def associate_profile_with_artist(artist, name, profile):
  logger.debug('Checking if %s matches %s' % (artist.name, name))

  if artist_matches(artist.name, name):
    logger.debug('Resource matches artist: %s, associating' % (artist.name))

    artist.add_profile(profile)

    artist.save()

    return True
  else:
    return False
Esempio n. 4
0
def associate_video_with_artist(artist, video):
  associate = False

  if video.artist:
    logger.debug('Checking if %s matches video artist %s' % (artist.name, video.artist))

    associate = artist_matches(artist.name, video.artist)

  if not associate:
    logger.debug('Checking if %s matches video title %s' % (artist.name, video.title))

    associate = artist_mentioned(artist.name, video.title)

  if associate:
    logger.debug('Video matches artist: %s, associating' % (artist.name))

    artist.add_video(video)

    artist.save()

  return associate