AutoPlay: Who can help debugging? (1 Viewer)

Albert

MP2 Developer
  • Premium Supporter
  • February 18, 2008
    1,297
    1,130
    46
    Freiburg im Breisgau, Germany
    Home Country
    Germany Germany
    Hi all!
    I need help with the debugging of the new RemovableMedia function. In git branch "Rework_Autoplay", I created a new core service which listens for media device changes and which sends a system message when such an event occurs.
    The former Autoplay plugin has changed its name to "RemovableMediaManager" and listens for those media change messages. When such a message arrives, the plugin auto-plays the media, if possible.
    Furthermore, if the current screen is either the Browse screen or the Local Media Navigation screen, the screen is automatically updated and the inserted CD/DVD etc. is shown (or removed).

    The functionality doesn't work for all media types yet, it only works for audio CDs, BDs, DVDs and video CDs. Other media types such as mixed media or MP3 audio etc. will be added.

    But there is a problem. When I start MP2 without a media in any drive and insert an audio CD into the drive, MP2 crashes in AudioCDDriveHandler#81:

    Code:
        public static bool DetectAudioCD(string drive, out IEnumerable<MediaItem> tracks)
        {
          int numTracks = BassUtils.GetNumTracks(drive);
          if (numTracks <= 0)
          {
            tracks = null;
            return false;
          }
          ISystemResolver systemResolver = ServiceRegistration.Get<ISystemResolver>();
          string systemId = systemResolver.LocalSystemId;
          IList<MediaItem> resultTracks = new List<MediaItem>(numTracks);
          string[] files = Directory.GetFiles(drive); // Here is line 81, here it crashes with an IOException: "The parameter is invalid"
          int track = 1;
          foreach (string file in files)
            resultTracks.Add(CreateMediaItem(file, track++, numTracks, systemId));
          tracks = resultTracks;
          return true;
        }

    From that time on, even the explorer doesn't recognize the audio CD any more in its "My Computer" view.
    If I remove and add the CD again with MP2 shut down, the explorer works well.
    I think MP2 breaks something in the Windows media insertion messaging or something like that.

    Can anyone test that and find out what the problem is? I currently don't have much time.

    Thanks very much!
    Albert
     

    SilentException

    Retired Team Member
  • Premium Supporter
  • October 27, 2008
    2,617
    1,130
    Rijeka, Croatia
    Home Country
    Croatia Croatia
    I would try to help and debug but dev PC is far away (only VNC possible) so there is no way I can do anything with drive :)

    I noticed Directory.GetFiles sometimes works weird. You can maybe try to do:

    DirectoryInfo di = new DirectoryInfo(drive);
    string[] files = di.GetFiles().Select(fileInfo => fileInfo.FullName).ToArray();
     

    Smeulf

    Retired Team Member
  • Premium Supporter
  • October 27, 2010
    672
    454
    France
    Home Country
    France France
    I would try to help and debug but dev PC is far away (only VNC possible) so there is no way I can do anything with drive :)

    I noticed Directory.GetFiles sometimes works weird. You can maybe try to do:

    DirectoryInfo di = new DirectoryInfo(drive);
    string[] files = di.GetFiles().Select(fileInfo => fileInfo.FullName).ToArray();

    There is mutch easyer, just tried and it works fine :

    Code:
    string[] files = Directory.GetFileSystemEntries(drive);

    Cheers.

    [Edit] I have no idea if it works or not with mixed CD content, like data track at the end of a CDA, I don't remember if I have a cd like this or not, will check :) [/Edit]

    [Edit2] OpenDisk won't play nor with MP2 or MP1, but it plays on MediaPlayer... There is something to improve here, when the time will come...[/Edit]
     

    Albert

    MP2 Developer
  • Premium Supporter
  • February 18, 2008
    1,297
    1,130
    46
    Freiburg im Breisgau, Germany
    Home Country
    Germany Germany
    AW: AutoPlay: Who can help debugging?

    The call with DirectoryInfo seems to work, Directory.GetFileSystemEntries doesn't work either because it also crashes the same as Directory.GetFiles.
     

    Albert

    MP2 Developer
  • Premium Supporter
  • February 18, 2008
    1,297
    1,130
    46
    Freiburg im Breisgau, Germany
    Home Country
    Germany Germany
    AW: AutoPlay: Who can help debugging?

    In the meantime, my version of the Rework_Autoplay branch doesn't crash any more in the line from above. But morpheus told me that the version using the DirectoryInfo class also crashed at his computer. Since then, the code changed a bit more, now we have less concurrent threads executing that code when the media in the drive changed.
    If anyone still gets the IOException at the GetFiles() method call at that place, please tell me.

    Thanks!
     

    mats_o

    Portal Member
    September 18, 2011
    17
    3
    Do you still need help with this?
    I'm not a C developer but got some VB knowladge and I'm an ace in Installing stuff (Works as a deployment specialist)
     

    Smeulf

    Retired Team Member
  • Premium Supporter
  • October 27, 2010
    672
    454
    France
    Home Country
    France France
    Do you still need help with this?
    I'm not a C developer but got some VB knowladge and I'm an ace in Installing stuff (Works as a deployment specialist)

    Hi mats_o !

    We were able to solve all errors in this part of the application. In simple terms, we used a method included in BASS libraries to list all the tracks of an Audio-CD.

    So this part is ok now.

    Anyway, you can still help us if you want, by testing MP2 and create good (I mean with logs, steps to reproduce, etc...) bug reports, helping to find a solution for opened bugs, or/and submit patchs to improve MP2. There's still a lot to do :

    https://forum.team-mediaportal.com/general-529/upcoming-mp2-alpha-release-todo-list-95975/

    https://forum.team-mediaportal.com/general-529/bug-todo-list-mp2-99141/

    And donations are always welcome :p

    To Albert : Is your TODO list is still up-to-date ? I mean, you may have made progress in some points of the list... If yes, can you update the list ?

    Cheers.

    Smeulf.
     

    Users who are viewing this thread

    Top Bottom