[Approved] Fix for Problems with Folder.jpg for Pictures (1 Viewer)

kaipron

MP Donator
  • Premium Supporter
  • November 11, 2007
    24
    1
    Hi,
    i had many errors when the System was creating the folder.jpg for my very large pictures collection. See Thread. This Patch fixed it for me.



    Regards
    Kai
     

    Attachments

    • Fix for creating Pictures-Folder.jpg (SVN 25836).patch
      30.8 KB

    chemelli

    Retired Team Member
  • Premium Supporter
  • September 28, 2006
    6,159
    2,264
    51
    Milano, Italy
    Home Country
    Italy Italy
    I cannot reproduce your issue in any way. Can you give me detailed steps please ?

    I would also point out that the log from the old thread linked in your post shows a issue that is not coming from the part of the code you tried to fix. It's 99% something skin related.

    Simone
     

    kaipron

    MP Donator
  • Premium Supporter
  • November 11, 2007
    24
    1
    AW: Fix for Problems with Folder.jpg for Pictures

    Sorry for my late reply. I overlook my own thread -.-
    I have a large number of images (> 21k). When i switched fast through the folders this error very often happen.

    The error messages can you see in the linked thread. The images are created by multiple threads and in the code all the threads access on the same temp created picture.

    With the current version I have not tested it, I now create the folder-images themselves.

    Sorry for my bad english.

    Grüße
    Kai
     

    Deda

    Lead Dev MP1 Videos
  • Premium Supporter
  • March 18, 2009
    2,423
    2,385
    Zagreb
    Home Country
    Croatia Croatia
    Ok, we analyzed your patch as I reproduced you error, patch itself can't be accepted in full because it leaves temp folder polluted but one hint from it help a lot:

    Code:
               if (File.Exists(defaultBackground))
               {
    -            [COLOR=Red]using (FileStream fs = new FileStream(defaultBackground, FileMode.Open, FileAccess.ReadWrite))[/COLOR]
    +           [COLOR=Red] [COLOR=Green]using (FileStream fs = new FileStream(defaultBackground, FileMode.Open, FileAccess.Read))[/COLOR][/COLOR]

    this is (red part) a main 'cause of your exception, and also for thumbs not to be created. Green part (your idea) help us a lot but there is some other issue because thumb file sometimes with fast browsing between folders fail's to save and will not be created in current session (it's on blacklist). But it is created in next session.
    I'm not fully satisfied with result but at least almost all thumbs will be there (in my case it failed in one so I restart MP and go again in that folder and it was there after).

    You can try with this first part and see if it helps, but we need to investigate more why next exception occur. I will reject this patch (half of it to be clear enough), but that doesn't mean it fails, you help a lot and if you can, please investigate with your first change part and let us know how it goes and also you can provide us with new patch. :D
     

    kaipron

    MP Donator
  • Premium Supporter
  • November 11, 2007
    24
    1
    AW: Fix for Problems with Folder.jpg for Pictures

    Zdravo,
    the first line is not enough. I also need the second part of my patches.
    I know that many files were created and not automatical deleted. We can insert a new line which deletes the files.


    Pozdra iz nemacke

    Code:
    -                    string tmpFile = Path.Combine(Path.GetTempPath(), "folderpreview.jpg");
    -                    if (File.Exists(tmpFile))
    -                      FileDelete(tmpFile);
    +                    string tmpFile = Path.GetTempFileName();
    +                    //if (File.Exists(tmpFile))
    +                    //  FileDelete(tmpFile); 
                         bmp.Save(tmpFile, Thumbs.ThumbCodecInfo, Thumbs.ThumbEncoderParams);
    	      [B]File.Delete(tmpFile);[/B]
     

    Deda

    Lead Dev MP1 Videos
  • Premium Supporter
  • March 18, 2009
    2,423
    2,385
    Zagreb
    Home Country
    Croatia Croatia
    Yes, fair enough and right but delete tmp little bit down in

    Code:
    if (aThumbPath.ToLowerInvariant().Contains(@"folder.jpg"))
                        {
                          Picture.CreateThumbnail(tmpFile, aThumbPath, (int)Thumbs.ThumbLargeResolution,
                                                  (int)Thumbs.ThumbLargeResolution, 0, false);
                          FileDelete(tmpFile);
                        }
                        else if (Picture.CreateThumbnail(tmpFile, aThumbPath, (int)Thumbs.ThumbResolution,
                                                         (int)Thumbs.ThumbResolution, 0, Thumbs.SpeedThumbsSmall))
                        {
                          aThumbPath = Util.Utils.ConvertToLargeCoverArt(aThumbPath);
                          Picture.CreateThumbnail(tmpFile, aThumbPath, (int)Thumbs.ThumbLargeResolution,
                                                  (int)Thumbs.ThumbLargeResolution, 0, false);
                          FileDelete(tmpFile);
                        }

    otherwise no thumb will be created in pic folder because we deleted tmp. Just to check it little bit more. First test goes 100% and no tmp left. Good work kaipron.
     

    Deda

    Lead Dev MP1 Videos
  • Premium Supporter
  • March 18, 2009
    2,423
    2,385
    Zagreb
    Home Country
    Croatia Croatia
    Can you test with your patch but with delete tmp in place from my previous post. In my case all goes ok now without any exception and all thumbs were in place, tmp folder clean. If all goes well I can put this in SVN for 1.1.1 so we do not not need to wait for 1.2.0 alpha
     

    Users who are viewing this thread

    Similar threads

    maybe setting loglevel to debug might pinpoint the difference between normal and stuck? Preferable with as much disabled as possible also try to see if anything is happening during stuck for the mediaportal process(resource monitor, disk activity, cpu usage, anything) maybe other programs competing for resouces?
    maybe setting loglevel to debug might pinpoint the difference between normal and stuck? Preferable with as much disabled as...
    Since over a year my MP sometimes stucks while showing the welcome screen. It started once a week now it happens every second time...
    Replies
    4
    Views
    1K
    Ok, thanks much. I will look into the instructions above. For the moment, I turned off the "Automatic channel logo update" in Settings (which somehow I had missed, I think because it wasn't an option previously), and the deleted everything in the Flat-default folder and populated it with my own logos. Works, so far.
    Ok, thanks much. I will look into the instructions above. For the moment, I turned off the "Automatic channel logo update" in...
    Hi-- I have to revisit an old issue, unfortunately. I just downloaded MP 2.5, a fresh installation, on a new computer (reluctantly...
    Replies
    5
    Views
    2K
    After many hours of troubleshooting I've given up and accepted that it's just "one of these things" when using madVR for watching live TV. I've now ticked the box to "Use EVR for LiveTV", with a default display refresh rate of 50Hz. In combination with tweaking some of the Nvidia 3D settings for the MP executable only, I now have a...
    After many hours of troubleshooting I've given up and accepted that it's just "one of these things" when using madVR for watching...
    Every so often, when I switch to a TV channel, my MP client stops accepting user inputs, either from the remote or keyboard/mouse...
    Replies
    30
    Views
    7K
    4.5 is really old. I'm not sure 4.5.5 even is a version that actually existed. You should be able to install .NET Framework 4.8.0 on Windows 7 SP1
    4.5 is really old. I'm not sure 4.5.5 even is a version that actually existed. You should be able to install .NET Framework 4.8.0...
    My TV PC is more a cast-off on older hardware (a 'Quiet PC' i5 4690, 16GB ram, 2xSSD 1xHDD, system graphics), mainly as a cheap way...
    Replies
    5
    Views
    1K
    Great Work, i tried for 10h music and pictures without any problem. Thank you for your help. a Donation is on the way
    Great Work, i tried for 10h music and pictures without any problem. Thank you for your help. a Donation is on the way
    Hi, I use the slideshow when I play MP3-Playlists at partys to make the screen more interesting. Sadly after a couple-pictures I...
    Replies
    2
    Views
    2K
    Top Bottom