Plugin: RARFileSource (A rar filter) (1 Viewer)

robomonkey

Portal Pro
August 4, 2005
207
1
Hi

This plugin was a godsend for me, unpacking rar files takes ages on my system.

Mine however has stopped working. I'm using 1.3 beta, and rarfilesource 0.4, when I click on file in MP it just returns an error "cannot play file". I think the filter is installed ok, because I can drop the same rar file in WMP and it plays fine. I can also unpack the file and it plays fine n MP.

Is there anyway to check if MP is using the filter?


Thanks
 

robomonkey

Portal Pro
August 4, 2005
207
1
Yeh, thanks, I actually just upgraded to 1.3 and it was working, but then I did something and it stopped again. So I've reverted to an partition image when it was working and so far so good. I'll gradually make the changes / updates I did before and see if I can pin the problem down.

So far so good tho.
 

1stdead

Portal Pro
February 1, 2008
1,089
139
Copenhagen
Home Country
Denmark Denmark
I updated it to work properly and added support for mp4, BUT there's currently a bug in the code adding/removing the rar extensions from mediaportal.xml.. I couldn't locate that. Perhaps someone could help?

Code:
//css_reference "MpeCore.dll";
//css_reference "Utils.dll";
   
using MpeCore.Classes;
using MpeCore;
using System.Diagnostics;
using System;
using MediaPortal.Profile;
   
	public class Script
	{
		public static void Main(PackageClass packageClass, ActionItem actionItem)
		{
					ProcessStartInfo psi = new ProcessStartInfo();
			psi.WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.System);
					psi.FileName = "cmd.exe";
			psi.Arguments = "/c regsvr32 /s \"" + MpeInstaller.TransformInRealPath(@"%Base%\RARFileSource.ax") + "\"";		psi.Verb = "runas";
			psi.CreateNoWindow = true;
			psi.WindowStyle = ProcessWindowStyle.Hidden;
			psi.ErrorDialog = false;
			try
			{
				Process p = System.Diagnostics.Process.Start(psi);
				p.WaitForExit(10000);
				addVideoExtension(".rar");
			}
			catch
			{
			 
			}
		}
 
		// add the extension
		static bool addVideoExtension(string extension)
		{
				using (MediaPortal.Profile.Settings xmlwriter = new MPSettings())
				{
					  string currValue = xmlwriter.GetValue("movies", "extensions");
					  if(!currValue.ToLower().Contains(extension))
					  {
							  xmlwriter.SetValue("movies", "extensions", currValue + "," + extension);
							  MediaPortal.Profile.Settings.SaveCache();
							  return true;
					  }
				}
			  return false;
		}
	}

Code:
//css_reference "Utils.dll";
   
using MpeCore.Classes;
using MpeCore;
using System.Diagnostics;
using System;
using System.IO;
using MediaPortal.Profile;
using System.Windows.Forms;
   
	public class Script
	{
		public static void Main(PackageClass packageClass, UnInstallItem actionItem)
		{
			string rarfilter = MpeInstaller.TransformInRealPath(@"%Base%\RARFileSource.ax");
			ProcessStartInfo psi = new ProcessStartInfo();
			psi.WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.System);
			psi.FileName = "cmd.exe";
			psi.Arguments = "/c regsvr32 /s /u \"" + rarfilter + "\"";
			psi.Verb = "runas";
			psi.CreateNoWindow = true;
			psi.WindowStyle = ProcessWindowStyle.Hidden;
			psi.ErrorDialog = false;
			try
			{
				Process p = System.Diagnostics.Process.Start(psi);
				p.WaitForExit(10000);
				if (File.Exists(rarfilter))
				  File.Delete(rarfilter );
				  removeVideoExtension(".rar");
			}
			catch
			{
			}
		}
 
		// remove the extension
		static bool removeVideoExtension(string extension)
		{
				using (MediaPortal.Profile.Settings xmlwriter = new MPSettings())
				{
					  string currValue = xmlwriter.GetValue("movies", "extensions");
					  if(currValue.ToLower().Contains(extension))
					  {
				  if (MessageBox.Show("Would you like to remove the .rar Extension as a Video Extension?", "Remove Extension", MessageBoxButtons.YesNo)
						== DialogResult.Yes)
				{
						xmlwriter.SetValue("movies", "extensions", currValue.Replace("," + extension, ""));
									  MediaPortal.Profile.Settings.SaveCache();
									  return true;
					  }
							 
					  }
				}
			  return false;
		}

The code is above. Please someone help, so that i can push a fix out.
 

1stdead

Portal Pro
February 1, 2008
1,089
139
Copenhagen
Home Country
Denmark Denmark
I have no programming experience. I just wrapped everything up. Inker wrote that particular part.
 

kobus

Portal Member
February 12, 2008
14
2
Yeh, thanks, I actually just upgraded to 1.3 and it was working, but then I did something and it stopped again. So I've reverted to an partition image when it was working and so far so good. I'll gradually make the changes / updates I did before and see if I can pin the problem down.

So far so good tho.

Does it still work for you?
I also get the "Unable to play:...." message. I never worked for me with MP1.3. In 1.2.6 it was perfect so I would love to have it back.
 

Users who are viewing this thread

Top Bottom