示例#1
0
 public SongData()
 {
     _mp3ValError     = Util.MP3Error.NoError;
     _mp3ValErrorText = "";
     Frames           = new List <Frame>();
     UserFrames       = new List <Frame>();
 }
示例#2
0
        public static Util.MP3Error FixMp3File(string fileName, out string strError)
        {
            ValidateOrFixFile(fileName, true);
            strError = "";
            // we might have an error in mp3val. the Log should contain the error
            if (StdOutList.Count == 0)
            {
                return(Util.MP3Error.NoError);
            }

            Util.MP3Error error = Util.MP3Error.NoError;

            // No errors found
            if (StdOutList[0].Contains("Done!"))
            {
                return(Util.MP3Error.NoError);
            }

            // This happens, if we fixed an error
            if (StdOutList.Count > 2)
            {
                if (StdOutList[StdOutList.Count - 2].Contains(@"FIXED:"))
                {
                    error = Util.MP3Error.Fixed;
                }
            }

            strError = StdOutList[0];
            return(error);
        }
示例#3
0
        public SongData()
        {
            _mp3ValError = Util.MP3Error.NoError;
            Frames       = new List <Frame>();
            UserFrames   = new ObservableCollection <Frame>();

            Pictures.CollectionChanged   += Pictures_CollectionChanged;
            UserFrames.CollectionChanged += UserFrames_CollectionChanged;
        }
示例#4
0
 public TrackData()
 {
     Changed          = false;
     Status           = -1;
     _mp3ValError     = Util.MP3Error.NoError;
     _mp3ValErrorText = "";
     Frames           = new List <Common.Frame>();
     UserFrames       = new List <Frame>();
     ID3Version       = 3;
 }
示例#5
0
 public TrackData()
 {
     Changed = false;
       Status = -1;
       _mp3ValError = Util.MP3Error.NoError;
       _mp3ValErrorText = "";
       Frames = new List<Common.Frame>();
       UserFrames = new List<Frame>();
       ID3Version = 3;
 }
示例#6
0
        public static Util.MP3Error ValidateMp3File(string fileName, out string strError)
        {
            ValidateOrFixFile(fileName, false);

            strError = "";
            // we might have an error in mp3val. the Log should contain the error
            if (StdOutList.Count == 0)
            {
                return(Util.MP3Error.NoError);
            }

            Util.MP3Error error = Util.MP3Error.NoError;

            // No errors found
            if (StdOutList[0].Contains("Done!"))
            {
                return(Util.MP3Error.NoError);
            }
            else if (StdOutList[0].Contains(@"No supported tags in the file"))
            {
                return(Util.MP3Error.NoError); // Fixed by MPTagThat :-)
            }
            else if (StdOutList[0].Contains(@"Garbage at the beginning of the file"))
            {
                error    = Util.MP3Error.Fixable; // Fixable error
                strError = ServiceScope.Get <ILocalisation>().ToString("mp3val", "01");
            }
            else if (StdOutList[0].Contains(@"Garbage at the end of the file"))
            {
                error    = Util.MP3Error.Fixable; // Fixable error
                strError = ServiceScope.Get <ILocalisation>().ToString("mp3val", "02");
            }
            else if (StdOutList[0].Contains(@"MPEG stream error, resynchronized successfully"))
            {
                error    = Util.MP3Error.Fixable; // Fixable error
                strError = ServiceScope.Get <ILocalisation>().ToString("mp3val", "03");
            }
            else if (StdOutList[0].Contains(@"This is a RIFF file, not MPEG stream"))
            {
                error    = Util.MP3Error.Fixable; // Fixable error
                strError = ServiceScope.Get <ILocalisation>().ToString("mp3val", "04");
            }
            else if (StdOutList[0].Contains(@"It seems that file is truncated or there is garbage at the end of the file"))
            {
                error    = Util.MP3Error.Fixable; // Fixable error
                strError = ServiceScope.Get <ILocalisation>().ToString("mp3val", "05");
            }
            else if (StdOutList[0].Contains(@"Wrong number of MPEG frames specified in Xing header"))
            {
                error    = Util.MP3Error.Fixable; // Fixable error
                strError = ServiceScope.Get <ILocalisation>().ToString("mp3val", "06");
            }
            else if (StdOutList[0].Contains(@"Wrong number of MPEG data bytes specified in Xing header"))
            {
                error    = Util.MP3Error.Fixable; // Fixable error
                strError = ServiceScope.Get <ILocalisation>().ToString("mp3val", "07");
            }
            else if (StdOutList[0].Contains(@"Wrong number of MPEG frames specified in VBRI header"))
            {
                error    = Util.MP3Error.Fixable; // Fixable error
                strError = ServiceScope.Get <ILocalisation>().ToString("mp3val", "08");
            }
            else if (StdOutList[0].Contains(@"Wrong number of MPEG data bytes specified in VBRI header"))
            {
                error    = Util.MP3Error.Fixable; // Fixable error
                strError = ServiceScope.Get <ILocalisation>().ToString("mp3val", "09");
            }
            else if (StdOutList[0].Contains(@"Wrong CRC in"))
            {
                error    = Util.MP3Error.Fixable; // Fixable error
                strError = ServiceScope.Get <ILocalisation>().ToString("mp3val", "10");
            }
            else if (StdOutList[0].Contains(@"Several APEv2 tags in one file"))
            {
                return(Util.MP3Error.NoError); // Handled by MPTagThat
            }
            else if (StdOutList[0].Contains(@"Too few MPEG frames"))
            {
                error    = Util.MP3Error.NonFixable; // Non Fixable error
                strError = ServiceScope.Get <ILocalisation>().ToString("mp3val", "11");
            }
            else if (StdOutList[0].Contains(@"VBR detected, but no VBR header is present. Seeking may not work properly"))
            {
                error    = Util.MP3Error.NonFixable; // Non Fixable error
                strError = ServiceScope.Get <ILocalisation>().ToString("mp3val", "12");
            }
            else if (StdOutList[0].Contains(@"Different MPEG versions or layers in one file"))
            {
                error    = Util.MP3Error.NonFixable; // Non Fixable error
                strError = ServiceScope.Get <ILocalisation>().ToString("mp3val", "13");
            }
            else if (StdOutList[0].Contains(@"Non-layer-III frame encountered"))
            {
                error    = Util.MP3Error.NonFixable; // Non Fixable error
                strError = ServiceScope.Get <ILocalisation>().ToString("mp3val", "14");
            }

            if (error == Util.MP3Error.Fixable)
            {
                log.Warn("MP3 Validate Fixable error: {0}", StdOutList[0]);
            }
            else if (error == Util.MP3Error.NonFixable)
            {
                log.Warn("MP3 Validate Non-Fixable error: {0}", StdOutList[0]);
            }

            // This happens, if we fixed an error
            if (StdOutList.Count > 2)
            {
                if (StdOutList[StdOutList.Count - 2].Contains(@"FIXED:"))
                {
                    error = Util.MP3Error.Fixed;
                }
            }

            return(error);
        }