[Approved] Fix for Problems with Folder.jpg for Pictures (2 Viewers)

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
    50
    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

    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
    698
    When I tested MP 2.5 some months ago using TVE3.5, I found that "scan for channels" failed to find any channels when I selected a DVB-T2 tuner (a TBS 6284) :(, but succeeded when I used a DVB-T tuner (a Pinnacle 2000i) :). Obviously the Pinnacle found only those channels broadcast in DVB-T MUXes (in the UK we have both DVB-T MUXes and...
    When I tested MP 2.5 some months ago using TVE3.5, I found that "scan for channels" failed to find any channels when I selected a...
    Hi all Running 1.7.1.0 TV Server as part of a full upgrade to MP2 2.5 setup After some problems with retuning (solved -...
    Replies
    3
    Views
    986
    As video playback in MP2 2.5 is buggy, PLEASE add an option for an external video player! I'd LOVE to have VLC back as videoplayer, like in MP1! This works perfectly. You will make a LOT of people VERY happy when you add this option. THANK YOU! EDIT: let me do some explaining about why it's buggy: regarding functionality, everything...
    As video playback in MP2 2.5 is buggy, PLEASE add an option for an external video player! I'd LOVE to have VLC back as videoplayer...
    As video playback in MP2 2.5 is buggy, PLEASE add an option for an external video player! I'd LOVE to have VLC back as videoplayer...
    Replies
    0
    Views
    258
    I was not previously aware of the "Drive Free Space" plugin, and it is not easy to find. (There really ought to be an easier way of finding plugins.) There is this thread that introduces the plugin, and this thread that details some changes to the Titan skin made by Gary Martyn (from 2013 :eek: ). I installed the plugin on my Aorus...
    I was not previously aware of the "Drive Free Space" plugin, and it is not easy to find. (There really ought to be an easier way of...
    I have a multiseat MP setup running version 1.33. I use the Titan skin and yesterday I decided I would update all my plugins on my...
    Replies
    20
    Views
    5K
    I've updated dlls in first post. Fixes: Summary / Overview was always empty Collections were not filtered to official ones Studios were not populated Fallback to english tagline didn't work Score / Popularity now empty instead of dummy rating and unknown popularity numbers Also I've tried to compile plugin against MP 1.34 x64 and...
    I've updated dlls in first post. Fixes: Summary / Overview was always empty Collections were not filtered to official ones Studios...
    Hi! TheTVDB.com has movies in their API now. API itself looks ok now so I decided to add TVDB to Moving Pictures. Check it if you...
    Replies
    2
    Views
    934
    Top Bottom