Does Virtual Folders works

Discuss third-party additions, plugins and translations for PS3 Media Server

Does Virtual Folders works

Postby kiptanoi » Tue May 29, 2012 7:35 pm

Does Virtual Folders works?
How to?

I am new to PS3 and PMS.... So please explain to me how I can get this to work..
Thanks =)
kiptanoi
 
Posts: 10
Joined: Tue May 29, 2012 7:32 pm

Re: Does Virtual Folders works

Postby chocolateboy » Wed May 30, 2012 2:05 am

Yes, but they're not documented. Try looking through this thread and/or take a look at pms-mlx.
chocolateboy
Project Member
 
Posts: 2580
Joined: Wed Sep 16, 2009 10:05 am

Re: Does Virtual Folders works

Postby kiptanoi » Wed May 30, 2012 4:29 am

chocolateboy wrote:Yes, but they're not documented. Try looking through this thread.


I tryed to understand This thread, but without resault... :/
I dont know how to use it.... And I dont understand it right now :(

So... Where to put this code?
Code: Select all
Index: net/pms/PMS.java
===================================================================
--- net/pms/PMS.java   (revision 410)
+++ net/pms/PMS.java   (working copy)
@@ -36,6 +36,7 @@
 import java.net.NetworkInterface;

 import java.text.SimpleDateFormat;

 import java.util.ArrayList;

+import java.util.Collections;

 import java.util.Date;

 import java.util.Locale;

 import java.util.StringTokenizer;

@@ -114,6 +115,7 @@
 import net.pms.dlna.RealFile;

 import java.net.URI;

 import java.net.URLDecoder;

+import java.util.Comparator;

 

 

 import static org.hamcrest.MatcherAssert.assertThat;

@@ -479,7 +481,16 @@
       }

       getRootFolder(renderer).browse(files);

       

-     

+      VirtualFolder vfs [] = loadVirtualFoldersConf(configuration.getVirtualFolders());

+      if (files == null || files.length == 0) {

+         

+      }

+      else {

+         for(VirtualFolder vf:vfs) {

+            getRootFolder(renderer).addChild(vf);

+         }

+      }

+         

       File webConf = new File("WEB.conf"); //$NON-NLS-1$

       if (webConf.exists()) {

          try {

@@ -944,6 +955,58 @@
          f[j] = directories.get(j);

       return f;

    }

+   

+   public VirtualFolder [] loadVirtualFoldersConf(String vfolders) throws IOException {

+      if (vfolders == null || vfolders.length() == 0)

+         return null;

+      ArrayList<VirtualFolder> directories = new ArrayList<VirtualFolder>();

+      Comparator<File> byDirThenAlpha = new DirAlphaComparator();

+      VirtualFolder vf;

+      StringTokenizer st = new StringTokenizer(vfolders, ";"); //$NON-NLS-1$

+      while (st.hasMoreTokens()) {

+         String line = st.nextToken();

+         String[] vfolder = line.split("\\|");

+         if (vfolder.length == 2)

+         {

+            vf = new VirtualFolder(vfolder[0],null);

+         }

+         else

+         {

+            PMS.error("Error Parsing Virtual Folder: " + vfolder[0], null);

+            continue;

+         }

+         ArrayList<File> folderFiles = new ArrayList<File>();

+         StringTokenizer stF = new StringTokenizer(vfolder[1], ",");

+         while (stF.hasMoreTokens()) {

+            String path = stF.nextToken();

+            File file = new File(path);

+            if (file.exists()) {

+               if (file.isDirectory()) {

+                  //directories.add(file);

+                  //vf.addChild(new RealFile(file));

+                  File files [] = file.listFiles();

+                  for(File f:files) {

+                     //vf.addChild(new RealFile(f));

+                     folderFiles.add(f);

+                  }

+               } else

+               PMS.error("File " + path + " is not a directory!", null); //$NON-NLS-1$ //$NON-NLS-2$

+            } else {

+               PMS.error("File " + path + " does not exists!", null); //$NON-NLS-1$ //$NON-NLS-2$

+            }

+         }

+         Collections.sort(folderFiles, byDirThenAlpha);

+         for(File f:folderFiles)

+         {

+            vf.addChild(new RealFile(f));

+         }

+         directories.add(vf);

+      }

+      VirtualFolder f [] = new VirtualFolder[directories.size()];

+      for(int j=0;j<f.length;j++)

+         f[j] = directories.get(j);

+      return f;

+   }

 

   

    public void reset() throws IOException {

@@ -1200,3 +1263,22 @@
    }

 

 }

+

+class DirAlphaComparator implements Comparator<File> {

+

+    // Comparator interface requires defining compare method.

+    public int compare(File filea, File fileb) {

+        //... Sort directories before files,

+        //    otherwise alphabetical ignoring case.

+        if (filea.isDirectory() && !fileb.isDirectory()) {

+            return -1;

+

+        } else if (!filea.isDirectory() && fileb.isDirectory()) {

+            return 1;

+

+        } else {

+            return filea.getName().compareToIgnoreCase(fileb.getName());

+        }

+    }

+}

+

Index: net/pms/configuration/PmsConfiguration.java
===================================================================
--- net/pms/configuration/PmsConfiguration.java   (revision 410)
+++ net/pms/configuration/PmsConfiguration.java   (working copy)
@@ -145,6 +145,7 @@
    private static final String CONFIGURATION_PATH_MAC = System.getProperty("user.home") + "/Library/Application Support/PS3 Media Server/";

    private static final char LIST_SEPARATOR = ',';

    private static final String KEY_FOLDERS = "folders";

+   private static final String KEY_VIRTUAL_FOLDERS = "virtual_folders";

 

    private final PropertiesConfiguration configuration;

    private final TempFolder tempFolder;

@@ -826,8 +827,16 @@
   

    public void setFolders(String value) {

       configuration.setProperty(KEY_FOLDERS, value);

-   }   

+   }

   

+   public String getVirtualFolders() {

+      return getString(KEY_VIRTUAL_FOLDERS, "");

+   }

+   

+   public void setVirtualFolders(String value) {

+      configuration.setProperty(KEY_VIRTUAL_FOLDERS, value);

+   }

+   

    public String getNetworkInterface() {

       return getString(KEY_NETWORK_INTERFACE, "");

    }

And does it work with the newest PMS server today?
kiptanoi
 
Posts: 10
Joined: Tue May 29, 2012 7:32 pm

Re: Does Virtual Folders works

Postby chocolateboy » Wed May 30, 2012 10:25 am

chocolateboy wrote:take a look at pms-mlx
chocolateboy
Project Member
 
Posts: 2580
Joined: Wed Sep 16, 2009 10:05 am

Re: Does Virtual Folders works

Postby taconaut » Wed May 30, 2012 10:33 am

What's the question? I don't get what you're trying to do.
If you always wanted to have your most recent videos at the top of the folder in the ps3 or wished you could group all videos with the same genre in one folder, have a look at pms-mlx
taconaut
Project Member
 
Posts: 1083
Joined: Sat Apr 11, 2009 12:29 am
Location: Switzerland

Re: Does Virtual Folders works

Postby kiptanoi » Wed May 30, 2012 2:07 pm

taconaut wrote:What's the question? I don't get what you're trying to do.

I have 3 harddrives with movies.... And I want to get them all under one subcategori in PMS.... :D
kiptanoi
 
Posts: 10
Joined: Tue May 29, 2012 7:32 pm

Re: Does Virtual Folders works

Postby taconaut » Wed May 30, 2012 2:38 pm

Ok, then back to quating ;)
chocolateboy wrote:take a look at pms-mlx

Navigate to Media Library -> Tree -> right click where you want to add the folder -> Add File System Folder -> Configure the folders to share -> :)
If you always wanted to have your most recent videos at the top of the folder in the ps3 or wished you could group all videos with the same genre in one folder, have a look at pms-mlx
taconaut
Project Member
 
Posts: 1083
Joined: Sat Apr 11, 2009 12:29 am
Location: Switzerland

Re: Does Virtual Folders works

Postby kiptanoi » Wed May 30, 2012 3:47 pm

Thanks, I got it working now..... But I can see a problem....
It cant read rar format....
For example:
One movie I have in rar format, the original PMS can stream out that movie...
But this PMS-MLX version can only stream out the sample movie... It cant find any movie inside the rar files.... :(

And I really enjoy this feature there is when it can stream movies from rar format, so I dont has to unrar all my movies... :D
But the other stuff was cool, to get info from IMDB and so on =)
kiptanoi
 
Posts: 10
Joined: Tue May 29, 2012 7:32 pm

Re: Does Virtual Folders works

Postby taconaut » Wed May 30, 2012 6:35 pm

Rars are supposed to work when using file System folders; i'm not using it though. I don't think it makes sense to import videos inside rars when scanning for videos. It makes the process slower and I guess people unpack their stuff if they want to keep it!?
If you always wanted to have your most recent videos at the top of the folder in the ps3 or wished you could group all videos with the same genre in one folder, have a look at pms-mlx
taconaut
Project Member
 
Posts: 1083
Joined: Sat Apr 11, 2009 12:29 am
Location: Switzerland

Re: Does Virtual Folders works

Postby kiptanoi » Thu May 31, 2012 2:06 pm

I guess I has to go with PMS and use it as it is.... :/
kiptanoi
 
Posts: 10
Joined: Tue May 29, 2012 7:32 pm

Next

Return to Additions and Plugins

Who is online

Users browsing this forum: No registered users and 5 guests