예제 #1
0
    protocol, video_id = uri.split(':')

    video = api.video_info(video_id)

    return artist_matcher.associate_video_with_artist(artist, _trans_video(video, 'artist-resource-handler:vimeo').get_video())

  @classmethod
  def id(self):
    return 'vimeo'

class VimeoMediaExtractor(ArtistMediaExtractor):
  def extract_media(self, artist):
    videos = []
    
    for video in artist.get_videos('vimeo'):
      logger.debug('Fetching video information for: %s' % video.media_id)
        
      video = api.video_info(video.media_id)

      videos.append(_trans_video(video, 'media-extractor:vimeo-videos'))

    return videos

  @classmethod
  def id(self):
    return'vimeo'

extensions.register_resource_extractor     (VimeoResourceExtractor)
extensions.register_show_resource_handler  (VimeoShowResourceHandler)
extensions.register_artist_resource_handler(VimeoArtistResourceHandler)
extensions.register_media_extractor        (VimeoMediaExtractor)
예제 #2
0
    video = api.video_info(video_id)

    return artist_matcher.associate_video_with_artist(artist, _trans_video(video, 'artist-resource-handler:youtube').get_video())

  @classmethod
  def id(self):
    return 'youtube'

class YouTubeMediaExtractor(ArtistMediaExtractor):
  def extract_media(self, artist):
    videos = []
    
    for video in artist.get_videos('youtube'):
      logger.debug('Fetching video information for: %s' % video.media_id)
        
      video = api.video_info(video.media_id)

      videos.append(_trans_video(video, 'media-extractor:youtube-videos'))

    return videos

  @classmethod
  def id(self):
    return 'youtube'

extensions.register_resource_extractor     (YouTubeResourceExtractor)
extensions.register_show_resource_handler  (YouTubeShowResourceHandler)
extensions.register_artist_resource_handler(YouTubeArtistResourceHandler)
extensions.register_media_extractor        (YouTubeMediaExtractor)
예제 #3
0
    return artist_matcher.associate_profile_with_matching_artist(show, name, artist_profile)

  @classmethod
  def id(self):
    return 'muxtape'
    
class MuxtapeArtistResourceHandler(ArtistResourceHandler):
  def supports(self, uri):
    protocol, user_id = uri.split(':')

    return protocol == 'muxtape-profile'

  def handle(self, artist, uri):
    protocol, user_id = uri.split(':')

    profile_link = 'http://%s.muxtape.com/' % user_id

    name = parsing.get_name_from_title(profile_link, NAME_RE)

    artist_profile = ArtistProfile(system_id = 'muxtape', profile_id = user_id, source_id = 'artist-resource-handler:muxtape', url = profile_link)

    return artist_matcher.associate_profile_with_artist(artist, name, artist_profile)

  @classmethod
  def id(self):
    return 'muxtape'

extensions.register_resource_extractor     (MuxtapeResourceExtractor)
extensions.register_show_resource_handler  (MuxtapeShowResourceHandler)
extensions.register_artist_resource_handler(MuxtapeArtistResourceHandler)
예제 #4
0
    return artist_matcher.associate_profile_with_matching_artist(show, name, artist_profile)

  @classmethod
  def id(self):
    return 'twitter'

class TwitterArtistResourceHandler(ArtistResourceHandler):
  def supports(self, uri):
    protocol, user_id = uri.split(':')

    return protocol == 'twitter-profile'

  def handle(self, artist, uri):
    protocol, user_id = uri.split(':')

    profile_link = 'http://www.twitter.com/%s' % user_id

    name = parsing.get_name_from_title(profile_link, NAME_RE)

    artist_profile = ArtistProfile(system_id = 'twitter', profile_id = user_id, source_id = 'artist-resource-handler:twitter', url = profile_link)

    return artist_matcher.associate_profile_with_artist(artist, name, artist_profile)

  @classmethod
  def id(self):
    return 'twitter'

extensions.register_resource_extractor     (TwitterResourceExtractor)
extensions.register_show_resource_handler  (TwitterShowResourceHandler)
extensions.register_artist_resource_handler(TwitterArtistResourceHandler)
예제 #5
0
    else:
      table = None
      
      for item in tr.iterancestors(tag = 'table'):
        table = item
        
        break
        
      resources = self.resource_extractor.extract_resources(doc)
      
      return ArtistProfileParserResult(resources)
      
  def _parse_v2(self, doc):
    content    = parsing.get_first_element(doc, '.content.contentMid')

    html_boxes = list(parsing.get_elements(content, '.htmlBoxModule'))

    resources = self.resource_extractor.extract_resources(*html_boxes)
    
    return ArtistProfileParserResult(resources)

  @classmethod
  def id(self):
    return SYSTEM_ID

extensions.register_resource_extractor     (MySpaceResourceExtractor)
extensions.register_show_resource_handler  (MySpaceShowResourceHandler)
extensions.register_artist_resource_handler(MySpaceArtistResourceHandler)
extensions.register_media_extractor        (MySpaceSongExtractor)
extensions.register_artist_profile_parser  (MyspaceProfileParser)