Idea: Port LogoManager into common library and use it inside MP2-Server plugin (1 Viewer)

Status
Not open for further replies.

morpheus_xx

Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #81
    Btw, I thought about your idea about making common dll both for MP1 and MP2 and realized that it should communicate not only with two different GUIs but also with two or more different backend (MP1 TVE3 , MP2 TV Server, TVE3.5 (or it is the same as as MP2 TVE?), Argus). So will it store code for communication with all of them or it will be another dll?
    In fact I would see it the opposite way:
    "the common library" has only few task:
    • it will provide a interface to query the online repository,
    • process the raw images into "nice" once using templates and
    • taking care for storage.
    It should not even know the clients that might be using the library. The integration in each product requires code there (plugin) to work with the common library.
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #82
    @offbyone do you have an idea how to continue?

    If a "full" service (user management, adding new logos) is not yet doable, could we start with a smaller, read-only service? I like to work on the missing parts for TV in next few weeks and would like to use the channel logos...
     

    offbyone

    Development Group
  • Team MediaPortal
  • April 26, 2008
    3,989
    3,712
    Stuttgart
    Home Country
    Germany Germany
    If we define the interface of the webservice, you can start implementing against it and I can start fill the server side with code. I have started with the DB and website, but time has been awefully short. Just all of us need to be on the same page what the webservice will do ;)
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #84
    Example:
    GetLogoMappings(localChannelName, regionCode) -> List<Alias>(with Channel and LogoId)
    GetLogos(List<LogoId>) -> List<LogoId, byte[]>
    I'd like to keep it as simple as possible, like:
    • bool GetLogo(channelName, regionCode, out byte[])
    It should take care of the discussed lookup (channel name and its aliases, optionally filtered by regionCode). At least this is what I need to download the logo.
    More methods should be added as they are needed.

    @Edalex / @Vasilich could you separate the image processing methods into an own assembly, so it looks like:
    • bool ProcessLogo(Bitmap logo, (name/bitmap) processingTemplate, out Bitmap finishedLogo)
     

    Vasilich

    Portal Pro
    August 30, 2009
    3,394
    1,170
    Germany, Mayence
    Home Country
    Russian Federation Russian Federation
    bool ProcessLogo(Bitmap logo, (name/bitmap) processingTemplate, out Bitmap finishedLogo)
    processingTemplate is actually background image, overlay image, sample image for preview in GUI, and settings file - here you can see the structure https://code.google.com/p/mediaport...nager/#LogoManager/designs/Modern 4x3 resized . These templates (now called Designs) getting downloaded from the server into local folder, but you can create own designs and put it in the same folder to get the design selection. Not sure how we can shift it to server part.
    For the possibility to make an assembly from it - surely possible (after we clear how to proceed with designs/templates) - just look here https://code.google.com/p/mediaport...se/trunk/LogoManager/LogoManager/Design.cs#68
     

    Edalex

    Community Plugin Dev
  • Premium Supporter
  • January 3, 2008
    2,955
    1,264
    Saratov
    Home Country
    Russian Federation Russian Federation
    And I've tried to refactor our plugin and extract common interfaces as you suggested but realized it's highly dependent of many settings, local paths and user actions. :(
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #87
    And I've tried to refactor our plugin and extract common interfaces as you suggested but realized it's highly dependent of many settings, local paths and user actions. :(
    I could do it myself, but I'd prefer if someone of you takes over this part.

    Generally you should do this steps (taken Effects as example):
    • Define an interface "IBitmapEffect" that exposes the public called methods like
      • Init(IBitmapEffectSettings settings)
      • Apply(Graphics graphics,ImageLogo,string logoFileName)"
      • ..
    • Define an interface "IBitmapEffectSettings " (could be even empty as marker interface, or only contains common setting like "IsEnabled")
      • Define a Settings class for each effect
    • Implement an AbstractBitmapEffect:IBitmapEffect, (IDisposable) and include all common code
    • Derive all effects from this one, move each Effect's code into own file
    Then you are able to fill each Effect's parameters from whereever you do now (I think reading MP1 settings xml?) and pass the settings object to IBitmapEffect.Init(settings).

    Same procedure for common settings (template paths,...), put them into a settings object that you pass to class for initialization...
     

    offbyone

    Development Group
  • Team MediaPortal
  • April 26, 2008
    3,989
    3,712
    Stuttgart
    Home Country
    Germany Germany
    bool GetLogo(channelName, regionCode, out byte[])

    What we should think about is the number of roundtrips required. I know that it can take quite some time, as I did basically the same with Onlinevideos Site Manager. The problem is the number of requests - for 100 channels there is so many overhead due to http... it will take a minute.

    So I suggest a method to ask for a list of channels at once?

    Another additional idea is to transfer the byte[] of the logo not via the webservice, but only get the Guid of the logo and download it via Http Get. (It is available that way anyway). Reason: Webservice will have to base64 encode the byte[] data and thus almost double the message in size. And we can download the images multithreaded a lot faster then.
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #89
    Yes, good points. I had the same experience with SlimTV and loading current/next programs. In batch it's a lot faster than multiple individual requests.
     

    Vasilich

    Portal Pro
    August 30, 2009
    3,394
    1,170
    Germany, Mayence
    Home Country
    Russian Federation Russian Federation
    Another additional idea is to transfer the byte[] of the logo not via the webservice, but only get the Guid of the logo and download it via Http Get
    surely good idea. but do we need to use GUIDs because we want to keep pictures in DB? or we can get direct download links to pictures (if we will keep pictures as files) and download them one by one. Or we can build list with needed logos (packet request), and get from webserver link to zip file (with all requested logos) that webserver created for that request...
     
    Status
    Not open for further replies.

    Users who are viewing this thread

    Top Bottom