Exemple #1
0
        public Plugin(string aPackage, string aFilename, string aPluginPath, IContentDirectorySupportV2 aSupport)
        {
            iPackage  = aPackage;
            iFilename = aFilename;

            Load(aPluginPath, aSupport);
        }
Exemple #2
0
        public ContentDirectoryMovieTrailers(string aDataPath, IContentDirectorySupportV2 aSupport)
        {
            string installPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);

            iWebFetcher = new WebFetcher(aDataPath);

            iPodcast = new Podcast(iWebFetcher, installPath, aSupport);
        }
Exemple #3
0
        public MediaProviderItunes(string aDataPath, IContentDirectorySupportV2 aSupport)
        {
            iSupport = aSupport;

            // create the user options - don't start any scanning yet - the options will
            // be set at default until the application gets any stored values from
            // the options file, which occurs after this constructor and before the Start() method
            iUserOptions = new UserOptions();
            iInstallPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
        }
Exemple #4
0
        private void Load(string aPluginPath, IContentDirectorySupportV2 aSupport)
        {
            try
            {
                Assembly assembly = Assembly.LoadFrom(iFilename);
                if (assembly.Location != iFilename)
                {
                    throw new PluginManager.NotMediaProviderPluginException(iFilename);
                }
                object[] attributes = assembly.GetCustomAttributes(typeof(ContentDirectoryFactoryTypeAttribute), false);
                if (attributes.Length > 0)
                {
                    ContentDirectoryFactoryTypeAttribute type = attributes[0] as ContentDirectoryFactoryTypeAttribute;
                    if (type != null)
                    {
                        IContentDirectoryFactory factory = Activator.CreateInstance(assembly.GetType(type.TypeName)) as IContentDirectoryFactory;

                        Trace.WriteLine(Trace.kKinsky, "Plugin.Load: Found MediaProvider plugin (" + iFilename + ")");

                        string dataPath = Path.Combine(aPluginPath, Path.GetFileNameWithoutExtension(iFilename));
                        if (!Directory.Exists(dataPath))
                        {
                            try
                            {
                                Directory.CreateDirectory(dataPath);
                            }
                            catch (Exception e)
                            {
                                UserLog.WriteLine("Failed to create data directory for " + iFilename + "(" + e.Message + ")");
                            }
                        }

                        iMediaProvider = factory.Create(dataPath, aSupport);
                        UserLog.WriteLine("Loaded plugin " + iMediaProvider.Name);
                        Trace.WriteLine(Trace.kKinsky, "Loaded plugin " + iMediaProvider.Name);
                    }
                    else
                    {
                        UserLog.WriteLine(iFilename + " is not a plugin");
                        Trace.WriteLine(Trace.kKinsky, "Plugin.Load(" + iFilename + "): not a plugin");
                    }
                }
            }
            catch (Exception e)   // just ignore all errors
            {
                UserLog.WriteLine("Error loading " + iFilename + " (" + e.Message + ")");
                Trace.WriteLine(Trace.kKinsky, "Plugin.Load(" + iFilename + "): " + e.Message);
            }

            if (iMediaProvider == null)
            {
                throw new PluginManager.NotMediaProviderPluginException(iFilename);
            }
        }
Exemple #5
0
 public ContainerDataNode(NodeContainer aNode, NodeContainer aParent,
                          Library aLibrary, IContentDirectorySupportV2 aSupport,
                          ContainerItunes.InsertDelegate aInserter, string aInstallPath)
 {
     iLibrary         = aLibrary;
     iSupport         = aSupport;
     iNode            = aNode;
     iMetadataFactory = new MetadataFactory(iLibrary, iSupport, aInstallPath);
     iMetadata        = iMetadataFactory.Create(iNode, aParent);
     iInserter        = aInserter;
     iInstallPath     = aInstallPath;
 }
Exemple #6
0
        public PluginManager(IHelper aHelper, IHttpClient aHttpClient, IContentDirectorySupportV2 aSupport)
        {
            iHttpClient    = aHttpClient;
            iSupport       = aSupport;
            iHelper        = aHelper;
            iPluginPath    = Path.Combine(aHelper.DataPath.FullName, "Plugins");
            iStdPluginPath = Path.Combine(aHelper.ExePath.FullName, "");
            iDownloadPath  = Path.Combine(aHelper.DataPath.FullName, "DownloadCache");

            iPlugins = new List <Plugin>();

            if (!Directory.Exists(iDownloadPath))
            {
                try
                {
                    Directory.CreateDirectory(iDownloadPath);
                }
                catch (Exception)
                {
                    UserLog.WriteLine("Unable to create plugin download cache directory");
                }
            }

            if (!Directory.Exists(iPluginPath))
            {
                try
                {
                    Directory.CreateDirectory(iPluginPath);
                }
                catch (Exception)
                {
                    UserLog.WriteLine("Unable to create plugin cache directory");
                }
            }

            /*if (!Directory.Exists(iStdPluginPath))
             * {
             *  try
             *  {
             *      Directory.CreateDirectory(iStdPluginPath);
             *  }
             *  catch (Exception)
             *  {
             *      UserLog.WriteLine("Unable to create standard plugin directory");
             *  }
             * }*/

            CleanUpPlugins();
        }
Exemple #7
0
        public Podcast(WebFetcher aWebFetcher, string aInstallPath, IContentDirectorySupportV2 aSupport)
        {
            iTrailers = new List <Trailer>();

            iWebFetcher = aWebFetcher;

            iWebFile = iWebFetcher.Create(new Uri(kAppleTrailersHiResUri), "podcasts.xml", 60);
            iWebFile.EventContentsChanged += WebFileContentsChanged;
            iWebFile.Open();

            string movieTrailerLogo = aSupport.VirtualFileSystem.Uri(Path.Combine(aInstallPath, "MovieTrailers.png"));

            iMetadata       = new container();
            iMetadata.Id    = "movietrailers";
            iMetadata.Title = "Movie Trailers";
            iMetadata.AlbumArtUri.Add(movieTrailerLogo);
            iMetadata.ChildCount = 0;
        }
Exemple #8
0
        public ContentDirectoryWfmu(string aDataPath, IContentDirectorySupportV2 aSupport)
        {
            iSupport    = aSupport;
            iOptionPage = new OptionPage("Wfmu");

            string installPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);

            iWebFetcher = new WebFetcher(aDataPath);

            string wfmuLogo = aSupport.VirtualFileSystem.Uri(Path.Combine(installPath, "Wfmu.png"));

            iLive     = new Live(wfmuLogo);
            iPodcasts = new Podcasts(iWebFetcher, wfmuLogo);

            iMetadata       = new container();
            iMetadata.Id    = "wfmu";
            iMetadata.Title = "WFMU";
            iMetadata.AlbumArtUri.Add(wfmuLogo);
            iMetadata.ChildCount = 2;
        }
Exemple #9
0
        public MediaProviderFolder(string aDataPath, IContentDirectorySupportV2 aSupport)
        {
            iSupport = aSupport;

            iMutex   = new Mutex(false);
            iFolders = new List <string>();

            string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);

            iMetadata             = new container();
            iMetadata.Id          = kRootId;
            iMetadata.Title       = Name;
            iMetadata.WriteStatus = "PROTECTED";
            iMetadata.Restricted  = false;
            iMetadata.Searchable  = true;
            iMetadata.AlbumArtUri.Add(iSupport.VirtualFileSystem.Uri(Path.Combine(path, "Folder.png")));

            iPage   = new OptionPage("Folders");
            iOption = new OptionListFolderPath("folders", "Folders", "Folders to be included");
            iPage.Add(iOption);
            iOption.EventValueChanged += FoldersChanged;
        }
Exemple #10
0
        public ContentDirectoryShoutcast(string aDataPath, IContentDirectorySupportV2 aSupport)
        {
            iSupport    = aSupport;
            iOptionPage = new OptionPage("Shoutcast");

            string installPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);

            iAlbumArtUri = aSupport.VirtualFileSystem.Uri(Path.Combine(installPath, "Shoutcast.png"));

            iStations = new List <LiveStation>();

            iMetadata       = new album();
            iMetadata.Id    = "shoutcast";
            iMetadata.Title = "Shoutcast";
            iMetadata.AlbumArtUri.Add(iAlbumArtUri);

            iWebFetcher = new WebFetcher(aDataPath);

            iWebFile = iWebFetcher.Create(new Uri("http://yp.shoutcast.com/sbin/newxml.phtml?search=radio&br=320&mt=audio/mpeg"), "stations.xml", 60);
            iWebFile.EventContentsChanged += WebFileContentsChanged;
            iWebFile.Open();
        }
Exemple #11
0
        public ContainerDataMessage(string aText, IContentDirectorySupportV2 aSupport, ContainerItunes.InsertDelegate aInserter, string aInstallPath)
        {
            // create a root node
            NodeRoot root = new NodeRoot("iTunes", 0, null);

            // create the metadata for it
            MetadataFactory factory = new MetadataFactory(null, aSupport, aInstallPath);

            iMetadata = factory.Create(root, null);

            // create the child metadata
            iChildMetadata             = new item();
            iChildMetadata.Id          = "1";
            iChildMetadata.ParentId    = "0";
            iChildMetadata.Restricted  = true;
            iChildMetadata.Title       = aText;
            iChildMetadata.WriteStatus = "PROTECTED";
            try
            {
                iChildMetadata.ArtworkUri.Add(aSupport.VirtualFileSystem.Uri(Path.Combine(aInstallPath, "Itunes.png")));
            }
            catch (HttpServerException) { }
            iInserter = aInserter;
        }
Exemple #12
0
 public IContentDirectory Create(string aDataPath, IContentDirectorySupportV2 aSupport)
 {
     return(new MediaProviderFolder(aDataPath, aSupport));
 }
Exemple #13
0
 public MetadataFactory(Library aLibrary, IContentDirectorySupportV2 aSupport, string aInstallPath)
 {
     iLibrary     = aLibrary;
     iSupport     = aSupport;
     iInstallPath = aInstallPath;
 }
Exemple #14
0
 public IContentDirectory Create(string aDataPath, IContentDirectorySupportV2 aSupport)
 {
     return(new ContentDirectoryShoutcast(aDataPath, aSupport));
 }
Exemple #15
0
 public IContentDirectory Create(string aDataPath, IContentDirectorySupportV2 aSupport)
 {
     return(new ContentDirectoryMovieTrailers(aDataPath, aSupport));
 }