INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: problem with MJFileAutomation's GetImageFile function  (Read 2698 times)

@l@n

  • Regular Member
  • World Citizen
  • ***
  • Posts: 146
  • bla bla bla, bla bla bla bla
problem with MJFileAutomation's GetImageFile function
« on: April 13, 2004, 11:52:49 pm »

I'm having a problem with the GetImageFile function of the MJFileAutomation object.

I'm using this object in my aTagger plug-in.  aTagger is a .Net application written in C#.

The problem is that after I successfully retrieve a valid image file, subsequent calls to the function (with a different MJFileAutomation object) return the same filename (with the same contents).  Additionally, when I exit my plug-in, all of cover art that I display within Media Center is the same image.  After restarting Media Center cover art is back to normal.

Has anyone else seen simular results or have any ideas for me?

Thanks...  @l@n
Logged
Download the aLyrics plug-in at http://aLyrics.auldridge.biz

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42382
  • Shoes gone again!
Re:problem with MJFileAutomation's GetImageFile function
« Reply #1 on: April 14, 2004, 09:16:28 am »

I'm having a problem with the GetImageFile function of the MJFileAutomation object in Media center 10.0.110.

I'm using this object in my aTagger plug-in.  aTagger is a .Net application written in C#.

The problem is that after I successfully retrieve a valid image file, subsequent calls to the function (with a different MJFileAutomation object) return the same filename (with the same contents).  Additionally, when I exit my plug-in, all of cover art that I display within Media Center is the same image.  After restarting Media Center cover art is back to normal.

Thanks for your help...  @l@n

Hopefully the notes listed here will clear up the confusion:
http://www.musicex.com/mediacenter/DevZone/MJAutomation.html#CMJFileAutomation
Logged
Matt Ashland, JRiver Media Center

@l@n

  • Regular Member
  • World Citizen
  • ***
  • Posts: 146
  • bla bla bla, bla bla bla bla
Re:problem with MJFileAutomation's GetImageFile function
« Reply #2 on: April 14, 2004, 12:44:30 pm »

Quote
Hopefully the notes listed here will clear up the confusion:
http://www.musicex.com/mediacenter/DevZone/MJAutomation.html#CMJFileAutomation

Matt, the nImageFileFlag options IMAGEFILE_DISPLAY_NO_DEFAULT and IMAGEFILE_DISPLAY_NO_DEFAULT_STANDARD_JPG are not available in the type libe that is on my machine.  I am using Media Center version 10.0.110.  I see that these two options were added back in January (at least the doco was updated back in January).  

I do not know if there is a way to get/view the version of the type lib.

Any suggestions?

Thanks...  @l@n
Logged
Download the aLyrics plug-in at http://aLyrics.auldridge.biz

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42382
  • Shoes gone again!
Re:problem with MJFileAutomation's GetImageFile function
« Reply #3 on: April 14, 2004, 12:58:33 pm »

Sorry, the latest TLB wasn't getting included.

Next version will fix that.
Logged
Matt Ashland, JRiver Media Center

@l@n

  • Regular Member
  • World Citizen
  • ***
  • Posts: 146
  • bla bla bla, bla bla bla bla
Re:problem with MJFileAutomation's GetImageFile function
« Reply #4 on: April 14, 2004, 11:08:42 pm »

Quote
Sorry, the latest TLB wasn't getting included.

Next version will fix that.

Matt, the latest build provided me with the latest TLB  :), bit I'm still having problems  :-[.

I wrote a sample .Net program that demonstrates what I am about to describe.  It is available for download at http://atagger.auldridge.biz/downloads/mctest.zip.  MCTest, iterates through the list of songs in Playing Now.  For each of the songs, it gets the image using each of the following nImageFile Flags: IMAGEFILE_DISPLAY, IMAGEFILE_IN_DATABASE, IMAGEFILE_IN_FILE, IMAGEFILE_DISPLAY_NO_DEFAULT, and IMAGEFILE_DISPLAY NO_DEFAULT_STANDARD_JPG.  The image, song name, and image file name is displayed for each of the 5 file flags.

When I play several albums (all with INTERNAL images), then start MCTest...  The first album (all songs in the album) doesnt find any image (even though it is there).  The image for the second song is found (IMAGEFILE_IN_DATABASE correctly identifies the image as INTERNAL).  All other albums display the same image found for album 2.  The name and contents of the image file never change.

Thanks for your assistance...  @l@n
Logged
Download the aLyrics plug-in at http://aLyrics.auldridge.biz

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42382
  • Shoes gone again!
Re:problem with MJFileAutomation's GetImageFile function
« Reply #5 on: April 15, 2004, 10:40:25 am »

That link isn't working for me.

However, remember that subsequent calls can return the same filename.  That means you need to load the image (or create a copy) before making the next call.  Otherwise you could see the same image over and over.

Could that be the issue?
Logged
Matt Ashland, JRiver Media Center

@l@n

  • Regular Member
  • World Citizen
  • ***
  • Posts: 146
  • bla bla bla, bla bla bla bla
Re:problem with MJFileAutomation's GetImageFile function
« Reply #6 on: April 15, 2004, 11:06:21 am »

Quote
That link isn't working for me.

However, remember that subsequent calls can return the same filename.  That means you need to load the image (or create a copy) before making the next call.  Otherwise you could see the same image over and over.

Could that be the issue?

Matt, the link works fine for me, so I downloaded the .zip to work and have emailed it to you.

Immediately after calling GetImageFile(), I load the file's contents into a bitmap, then I never bother with the file again.  After, MF gives me an image, the contents of the image file never change with subsequent calls to GetImageFile().  Additionally, it is not uncommon for calls to GetImageFile() to return an empty file name string when there IS an image available for the song.  Hopefully the sample that I emailed to you will allow you to identify the problem.

Thanks...  @l@n
Logged
Download the aLyrics plug-in at http://aLyrics.auldridge.biz

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42382
  • Shoes gone again!
Re:problem with MJFileAutomation's GetImageFile function
« Reply #7 on: April 15, 2004, 04:04:44 pm »

The problem is that the CBitmap object is locking the temporary file.

On the next call, the plugin tries to put the new image in the same place.  It fails because the last file (with the same filename) is locked by C#.

I'm not a C# jedi, but maybe there are some CBitmap flags you can use. (?)
Logged
Matt Ashland, JRiver Media Center

@l@n

  • Regular Member
  • World Citizen
  • ***
  • Posts: 146
  • bla bla bla, bla bla bla bla
Re:problem with MJFileAutomation's GetImageFile function
« Reply #8 on: April 15, 2004, 06:57:04 pm »

I updated aTagger to load the file from a FileStream rather than a file name and it works like a champ.  I would have never imagined that the Bitmap constructor would keep the file locked.

THANKS for all of your help...  @l@n

Logged
Download the aLyrics plug-in at http://aLyrics.auldridge.biz
Pages: [1]   Go Up