Folder Limit

Discuss issues related to PS3 Media Server development (only for programmers)

Folder Limit

Postby SharkHunter » Fri Jul 15, 2011 4:08 pm

Hi,

I mad a try at getting around the 8 depth folder limit on the PS3. It is a first try and it's not that good. It will be a lot of clicking to use it :)

Code: Select all
Index: configuration/RendererConfiguration.java
===================================================================
--- configuration/RendererConfiguration.java   (revision 583)
+++ configuration/RendererConfiguration.java   (working copy)
@@ -10,6 +10,7 @@
 import java.util.regex.Pattern;
 
 import net.pms.Messages;
+import net.pms.dlna.DLNAResource;
 import net.pms.dlna.MediaInfoParser;
 import net.pms.dlna.RootFolder;
 import net.pms.formats.Format;
@@ -84,6 +85,11 @@
       }
       return rootFolder;
    }
+   
+   public void addFolderLimit(DLNAResource res) {
+      if(rootFolder!=null)   
+         rootFolder.setFolderLim(res);
+   }
 
    public int getSpeedInMbits() {
       return speedInMbits;
Index: dlna/DLNAResource.java
===================================================================
--- dlna/DLNAResource.java   (revision 583)
+++ dlna/DLNAResource.java   (working copy)
@@ -272,6 +272,8 @@
       if (parent != null) {
          defaultRenderer = parent.defaultRenderer;
       }
+      if(defaultRenderer!=null)
+         defaultRenderer.addFolderLimit(child);
       if (child.isValid()) {
          logger.trace("Adding " + child.getName() + " / class: " + child.getClass().getName());
          VirtualFolder vf = null;
Index: dlna/FolderLimit.java
===================================================================
--- dlna/FolderLimit.java   (revision 0)
+++ dlna/FolderLimit.java   (revision 0)
@@ -0,0 +1,47 @@
+package net.pms.dlna;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.pms.dlna.virtual.VirtualFolder;
+
+public class FolderLimit extends VirtualFolder {
+   private static final Logger logger = LoggerFactory.getLogger(FolderLimit.class);
+   private DLNAResource start;
+   
+   public FolderLimit() {
+      super("Folder Limit",null);
+      start=null;
+   }
+   
+   private boolean inMe(DLNAResource res) {
+      while(res!=null) {
+         if(res instanceof FolderLimit)
+            return true;
+         if(res instanceof RootFolder)
+            break;
+         res=res.getParent();
+      }
+      return false;
+   }
+   
+   public void setStart(DLNAResource res) {
+      if(inMe(res))
+         return;
+      if(res.getParent()==null)
+         start=res;
+      else
+         start=res.getParent();
+   }
+   
+   public void discoverChildren() {
+      if(start!=null)
+         addChild(start);
+   }
+   
+   public void resolve() {
+      this.discovered=false;
+      this.childrenNumber=0;
+      this.children.clear();
+   }
+}
Index: dlna/RootFolder.java
===================================================================
--- dlna/RootFolder.java   (revision 583)
+++ dlna/RootFolder.java   (working copy)
@@ -59,6 +59,7 @@
    private static final Logger logger = LoggerFactory.getLogger(RootFolder.class);
    private PmsConfiguration configuration = PMS.getConfiguration();
    private boolean running;
+   private FolderLimit lim;
 
    public RootFolder() {
       id = "0";
@@ -137,8 +138,17 @@
             addChild(videoSettingsRes);
          }
       }
+      
+      lim=new FolderLimit();
+      addChild(lim);
+      
       discovered = true;
    }
+   
+   public void setFolderLim(DLNAResource r) {
+      if(lim!=null)
+         lim.setStart(r);
+   }
 
    public void scan() {
       running = true;
SharkHunter
 
Posts: 941
Joined: Tue Jun 01, 2010 8:39 pm

Re: Folder Limit

Postby Donut » Sun Jul 17, 2011 1:41 pm

Please add the patch as a zipped File. Otherwise it might not be possible to test. If I copy your patch to the clipboard, eclipse always tells me, that there is no valid patch in the clipboard.


Thanks

Donut
Donut
 
Posts: 6
Joined: Fri Nov 20, 2009 11:49 am

Re: Folder Limit

Postby SharkHunter » Wed Jul 20, 2011 8:57 pm

OK,
Attachments
flimit.zip
(1.09 KiB) Downloaded 202 times
SharkHunter
 
Posts: 941
Joined: Tue Jun 01, 2010 8:39 pm

Re: Folder Limit

Postby SharkHunter » Thu Jul 21, 2011 2:25 pm

Added a discussion thread for how this should evolve from a user perspective (viewtopic.php?f=12&t=11584). We'll keep this thread for patches and WTF about the ugly code :)
SharkHunter
 
Posts: 941
Joined: Tue Jun 01, 2010 8:39 pm

Re: Folder Limit

Postby grantjohnston » Sat Aug 11, 2012 5:56 am

Yeah... I know this is like a year late... But Is there a file I need to edit somewhere in PMS to get this working?


Thanks & really appreciate the work on this!


grant
grantjohnston
 
Posts: 1
Joined: Sat Aug 11, 2012 5:53 am

Re: Folder Limit

Postby chocolateboy » Sat Aug 11, 2012 6:12 am

Please don't necropost. Thread locked.
chocolateboy
Project Member
 
Posts: 2580
Joined: Wed Sep 16, 2009 10:05 am


Return to Developers

Who is online

Users browsing this forum: No registered users and 1 guest