Thumbnails for shortcuts, the xbe way
#1
Sup,

I have a few folders with lots of shortcuts and it's painfully chuggy browsing through them.

What I'm trying to do is have XBMC treat .cut files like an xbe for thumbnails. So instead of defining the thumb in the cut, I can just make a .tbn file the same name as the .cut so the thumbs will be cached in Programs.

I downloaded the 8.10 source for win32 and commented out one line and had it working perfectly. So I downloaded the latest svn for xbox, commented out the same line - and it's not working Sad.

Just trying to figure out why it would work on the win32 build and not the xbox?

Around line 2572 in FileItem.cpp, I commented out the return to "let it keep going":
Code:
if (IsShortCut())
  {
    CShortcut shortcut;
    if ( shortcut.Create( m_strPath ) )
    {
      // use the shortcut's thumb
      if (!shortcut.m_strThumb.IsEmpty())
        m_strThumbnailImage = shortcut.m_strThumb;
      else
      {
        CFileItem item(shortcut.m_strPath,false);
        item.SetUserProgramThumb();
        m_strThumbnailImage = item.m_strThumbnailImage;
      }
      
      //return; //let it keep going...
    }
  }

It worked perfectly on the older win32 build. Why would it not work on the latest svn for xbox?

Thanks
Reply
#2
I'd be interested in having this in my build, as I'm sure others would as well. Why not commit your changes to the baseline once you figure out what's wrong?
Reply
#3
The code above should be like this:
Code:
if (IsShortCut())
  {
    CShortcut shortcut;
    if ( shortcut.Create( m_strPath ) )
    {
      // use the shortcut's thumb
      if (!shortcut.m_strThumb.IsEmpty())
      {
        m_strThumbnailImage = shortcut.m_strThumb;

        return; // return here
      }
      else
      {
        // if i pull this out, it causes issues - so i'll leave it for now
        CFileItem item(shortcut.m_strPath,false);
        item.SetUserProgramThumb();
        m_strThumbnailImage = item.m_strThumbnailImage;
      }
      
      //return; // don't return here
    }
  }

Around line 2572 in GUIWindowPrograms.cpp, I commented out a few lines that are only in the XBOX build:
Code:
else if (item->IsShortCut())
    { // resolve the shortcut to set it's description etc.
      // and save the old shortcut path (so we can reassign it later)
      CShortcut cut;
      if (cut.Create(item->m_strPath))
      {
        shortcutPath = item->m_strPath;
        item->m_strPath = cut.m_strPath;
        
        //XBOX only - prevents tbn file usage for cuts
        //if (cut.m_strThumb.IsEmpty()) // try to cache thumb for path
        //  item->SetUserProgramThumb();
        //else
        
          item->SetThumbnailImage(cut.m_strThumb);

        LABEL_MASKS labelMasks;
        m_guiState->GetSortMethodLabelMasks(labelMasks);
        CLabelFormatter formatter("", labelMasks.m_strLabel2File);
        if (!cut.m_strLabel.IsEmpty())
        {
          item->SetLabel(cut.m_strLabel);
          __stat64 stat;
          if (CFile::Stat(item->m_strPath,&stat) == 0)
            item->m_dwSize = stat.st_size;

          formatter.FormatLabel2(item.get());
          item->SetLabelPreformated(true);
        }
      }
    }

It works perfectly now, cuts are blazing fast. But I have run into another wall. Music, Pictures and Videos all save their thumbs in sub folders which gets around the 4096 file limit for all folders. But Programs is caching them all to the root of the program thumbnail folder.

If you have less than 4,000 programs/cuts, you're all good. In my case - I need to cache about 8,000 cuts Sad. I'm looking into what it would take to get Programs to cache thumbs like the rest, but XBMC is flipping huge (and I'm pretty noob).

If someone could chime in on how to do it, I would greatly appreciate it! Nod

I don't understand why Program thumbs wouldn't work like the rest (via sub folders)?
Reply
#4
Never mind, I got it. I have a thread at xbox-scene going that explains it:
http://forums.xbox-scene.com/index.php?showtopic=679583

Don't know what the devs think about this, but I would like to see something official make it's way into the svn. Big Grin
Reply
#5
as this is xbox only code don't hold your breath waiting for us to do anything about it.

CFileItem::GetCachedProgramThumb() vs CFileItem::GetCachedVideoThumb()

should give you the idea.
Reply
#6
I figured as much. Kinda sucks getting into XBOX XBMC at the tail end of the project. I love this thing to bits.

Kinda like showing up to a party with a kegger and the only few people left are already passed out. What else can you do but indulge yourself? Laugh

I'm just glad you didn't come out the gate with "You fool! You can't do that because...". Big Grin

Thanks
Reply

Logout Mark Read Team Forum Stats Members Help
Thumbnails for shortcuts, the xbe way3