[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
    49
    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

    Hello all, Recently I have been having a few problems importing movies to Moving Pictures using the IMDB+ plugin (missing fields) so I have decided to have a go at creating an XML based on the XBMC Local xml. This has not been tested with multi languages and it has been configured for my personal collection. I'm hoping it will work...
    Hello all, Recently I have been having a few problems importing movies to Moving Pictures using the IMDB+ plugin (missing fields)...
    Hello all, Recently I have been having a few problems importing movies to Moving Pictures using the IMDB+ plugin (missing fields)...
    Replies
    0
    Views
    515
    I had the same issue and found the executable under C:\ProgramData\Team MediaPortal\MediaPortal\skin\Titan\BasicHome.Editor\TitanEditor.exe Only the shortcut was missing.
    I had the same issue and found the executable under C:\ProgramData\Team...
    Hi all, Not a rant, more a sharing of experience (maybe hoping to get some clarification on which wrong turn I took) It has been...
    Replies
    9
    Views
    2K
    Hi, First off: there are some issues with the latest Mediaportal (32bits vs 64bits), so that is one of the issues you're stumbling with. If you take the previous version (1.31) it should work as expected. For IPTV there is also a different option (with different pros and cons): Onlinevideos. I'm using that sometimes for my IPTV as...
    Hi, First off: there are some issues with the latest Mediaportal (32bits vs 64bits), so that is one of the issues you're stumbling...
    Hi I am trying to play a m3u file from my IPTV provider, but when I try to install the TV part of Media Portal v1.3.2 I get an...
    Replies
    1
    Views
    674
    And this is the follow-up thread, which includes log files: PiP audio problem
    And this is the follow-up thread, which includes log files: PiP audio problem
    I just updated from 2.4. Update did not conserve my channels or epg plug-in or anything, looks like, which of course was a...
    Replies
    5
    Views
    627
    Didn't know computers are available in Canada's jails... :p
    Didn't know computers are available in Canada's jails... :p
    Hi folks, basically I have this m3u list with links I am trying to scan with the TV configuration tool but all the channels even...
    Replies
    5
    Views
    705
    Top Bottom