Esempio n. 1
0
        /// <summary>
        /// Export the specified tracks to a given directory using the specified encoder.
        /// </summary>
        /// <param name="tracks"></param>
        /// <param name="encoder"></param>
        /// <param name="location"></param>
        /// <param name="createSubdir"></param>

        public void Export(
            PersistentIDCollection list, Encoder encoder,
            string playlistFormat, string location, bool createSubdirectories)
        {
            lock (sync)
            {
                disabled.Add(Resx.I_ScanDuplicates);
                disabled.Add(Resx.I_ScanFileWatch);
                disabled.Add(Resx.I_ScanMaintenance);
            }

            string pathFormat = null;

            if (createSubdirectories)
            {
                pathFormat = PathHelper.GetPathFormat(ExportScanner.DefaultPathFormat);
            }

            IScanner scanner = new ExportScanner(
                controller, catalog, list, encoder, playlistFormat, location, pathFormat, false);

            scanner.Completed = (Action) delegate
            {
                lock (sync)
                {
                    disabled.Remove(Resx.I_ScanDuplicates);
                    disabled.Remove(Resx.I_ScanFileWatch);
                    disabled.Remove(Resx.I_ScanMaintenance);
                }
            };

            AddScanner(scanner, ExportScannerPriority);
        }
Esempio n. 2
0
        /// <summary>
        /// Export the specified tracks to a given USB MP3 player, synchronizing the
        /// contents of the specified location.
        /// </summary>
        /// <param name="list"></param>
        /// <param name="location"></param>
        /// <param name="pathFormat"></param>

        public void Export(PersistentIDCollection list, string location, string pathFormat)
        {
            if (disabled.Contains(Resx.I_ScanExport))
            {
                return;
            }

            Encoder mp3Encoder = null;

            foreach (Encoder encoder in controller.Encoders)
            {
                // skip the Null encoder that's automatically added to controller.Encoders
                if (!encoder.IsEmpty)
                {
                    if (encoder.Format.Equals("MP3"))
                    {
                        mp3Encoder = encoder;
                    }
                }
            }

            if (mp3Encoder != null)
            {
                lock (sync)
                {
                    disabled.Add(Resx.I_ScanDuplicates);
                    disabled.Add(Resx.I_ScanFileWatch);
                    disabled.Add(Resx.I_ScanMaintenance);
                }

                IScanner scanner = new ExportScanner(
                    controller, catalog, list,
                    mp3Encoder,
                    PlaylistProviderFactory.NoFormat,
                    location, pathFormat, true);

                scanner.Completed = (Action) delegate
                {
                    Encoder mp3 = mp3Encoder;
                    lock (sync)
                    {
                        disabled.Remove(Resx.I_ScanDuplicates);
                        disabled.Remove(Resx.I_ScanFileWatch);
                        disabled.Remove(Resx.I_ScanMaintenance);
                    }
                    mp3 = null;
                };

                AddScanner(scanner, ExportScannerPriority);
            }

            // [foo] dispose this reference but do not release underlying instance passed to Librarian
            //mp3Encoder.Dispose(false);
        }
Esempio n. 3
0
        /// <summary>
        /// Export the specified tracks to a given USB MP3 player, synchronizing the
        /// contents of the specified location.
        /// </summary>
        /// <param name="list"></param>
        /// <param name="location"></param>
        /// <param name="pathFormat"></param>
        public void Export(PersistentIDCollection list, string location, string pathFormat)
        {
            if (disabled.Contains(Resx.I_ScanExport))
            {
                return;
            }

            Encoder mp3Encoder = null;
            foreach (Encoder encoder in controller.Encoders)
            {
                // skip the Null encoder that's automatically added to controller.Encoders
                if (!encoder.IsEmpty)
                {
                    if (encoder.Format.Equals("MP3"))
                    {
                        mp3Encoder = encoder;
                    }
                }
            }

            if (mp3Encoder != null)
            {
                lock (sync)
                {
                    disabled.Add(Resx.I_ScanDuplicates);
                    disabled.Add(Resx.I_ScanFileWatch);
                    disabled.Add(Resx.I_ScanMaintenance);
                }

                IScanner scanner = new ExportScanner(
                    controller, list,
                    mp3Encoder,
                    PlaylistFactory.NoFormat,
                    location, pathFormat, true);

                scanner.Completed = (Action)delegate
                {
                    Encoder mp3 = mp3Encoder;
                    lock (sync)
                    {
                        disabled.Remove(Resx.I_ScanDuplicates);
                        disabled.Remove(Resx.I_ScanFileWatch);
                        disabled.Remove(Resx.I_ScanMaintenance);
                    }
                    mp3 = null;
                };

                AddScanner(scanner);
            }

            // [foo] dispose this reference but do not release underlying instance passed to Librarian
            //mp3Encoder.Dispose(false);
        }
Esempio n. 4
0
        /// <summary>
        /// Export the specified tracks to a given directory using the specified encoder.
        /// </summary>
        /// <param name="tracks"></param>
        /// <param name="encoder"></param>
        /// <param name="location"></param>
        /// <param name="createSubdir"></param>
        public void Export(
            PersistentIDCollection list, Encoder encoder,
            string playlistFormat, string location, bool createSubdirectories)
        {
            lock (sync)
            {
                disabled.Add(Resx.I_ScanDuplicates);
                disabled.Add(Resx.I_ScanFileWatch);
                disabled.Add(Resx.I_ScanMaintenance);
            }

            string pathFormat = null;
            if (createSubdirectories)
            {
                pathFormat = PathHelper.GetPathFormat(ExportScanner.DefaultPathFormat);
            }

            IScanner scanner = new ExportScanner(
                controller, list, encoder, playlistFormat, location, pathFormat, false);

            scanner.Completed = (Action)delegate
            {
                lock (sync)
                {
                    disabled.Remove(Resx.I_ScanDuplicates);
                    disabled.Remove(Resx.I_ScanFileWatch);
                    disabled.Remove(Resx.I_ScanMaintenance);
                }
            };

            AddScanner(scanner);
        }