Beispiel #1
0
  def __init__(self, library, settings):
    super(ArtistProcessor, self).__init__(library, settings)

    self.artist_processor_settings = self.get_required_setting(settings, 'artist_processor_settings')
    self.setup  = ProcessorSetup(self.library, self.library.artist_processors(), self.artist_processor_settings)
    
    self.runner = self.setup.runner()

  def process(self, show, state, dependent_states):
    logger.debug('[show:%s] Starting artist processing' % (show.id))

    for artist in show.related_artists().values():  
      logger.debug('[show:%s] Starting artist processing for artist: %s (%s)' % (show.id, artist.name, artist.id))

      self.runner.process(artist)

  def cleanup(self, show, state):
    for artist in show.related_artists().values():  
      self.runner.cleanup(artist)
    
  @classmethod
  def id(self):
    return 'artist-processor'
    
  @classmethod
  def depends_on(self):
    return ( 'resource-handler', 'artist-association' )
  
extensions.register_show_processor(ArtistAssociation)
extensions.register_show_processor(ArtistProcessor)
Beispiel #2
0
    
    retcode = subprocess.call(command, stdin = inp_file, stdout = out_file)

    out_file.seek(0)
    
    final_image = pil.open(out_file)
    final_file  = StringIO()
    
    final_image.save(final_file, 'JPEG')
    final_file.seek(0)

    file_name = '%s/images/%s.%d.jpg' % (show.id, self.image_type(), image_version)
    
    return file_name, final_file

class FeaturedImageProcessor(ImageMagickImageProcessor):
  def image_magick_command(self):
    #'-channel', 'R', '-fx', '0.854*u^2+0.537*u',
    #'-channel', 'G', '-fx', '-0.799*u^3+1.066*u^2+0.734*u',
    #'-channel', 'B', '-fx', '0.833*u+0.083',
    return ('-normalize', '-contrast', '-modulate', '100,120,100')
    
  def image_type(self):
    return 'featured'

  @classmethod    
  def id(self):
    return 'featured-image'
    
extensions.register_show_processor(DownloadImageProcessor)
extensions.register_show_processor(FeaturedImageProcessor)
Beispiel #3
0
from fancyashow.extensions        import ExtensionLibrary, ShowProcessor
from fancyashow.processing.common import ResourceHandlerProcessorMixin

extensions = ExtensionLibrary()

class ShowResourceHandlerProcessor(ResourceHandlerProcessorMixin, ShowProcessor):
  def resources(self, obj, state, dependent_states):
    return obj.parse_meta.resources
    
  def handlers(self):
    return [h() for h in self.library.show_resource_handlers()]
    
  @classmethod
  def id(self):
    return 'resource-handler'
    
  @classmethod
  def depends_on(self):
    return ( )
    
extensions.register_show_processor(ShowResourceHandlerProcessor)
Beispiel #4
0
import logging
from fancyashow.extensions       import ExtensionLibrary
from fancyashow.extensions.shows import ShowProcessor
from fancyashow.processing       import ProcessorSetup

logger = logging.getLogger(__name__)

extensions = ExtensionLibrary()

class ShowRanking(ShowProcessor):
  def process(self, show, state, dependent_states):
    artists = show.related_artists().values()
    
    if artists:
      show.rank = max(a.rank for a in artists)
    
    return deepcopy(state)

  def cleanup(self, show, state):
    pass
    
  @classmethod
  def id(self):
    return 'ranking'
    
  @classmethod
  def depends_on(self):
    return ( )#'artist-processor', )
  
extensions.register_show_processor(ShowRanking)