Ejemplo n.º 1
0
        public static string[] ToFileName(this DetailMovie movie)
        {
            string          txt      = Properties.Settings.Default.RenameFormat;
            FileInfo        fileInfo = new FileInfo(movie.filepath);
            string          oldName  = movie.filepath;
            string          name     = Path.GetFileNameWithoutExtension(movie.filepath);
            string          dir      = fileInfo.Directory.FullName;
            string          ext      = fileInfo.Extension;
            string          newName  = "";
            MatchCollection matches  = Regex.Matches(txt, "\\{[a-z]+\\}");

            if (matches != null && matches.Count > 0)
            {
                newName = txt;
                foreach (Match match in matches)
                {
                    string property = match.Value.Replace("{", "").Replace("}", "");
                    ReplaceWithValue(property, movie, ref newName);
                }
            }

            //替换掉特殊字符
            foreach (char item in BANFILECHAR)
            {
                newName = newName.Replace(item.ToString(), "");
            }

            if (Properties.Settings.Default.DelRenameTitleSpace)
            {
                newName = newName.Replace(" ", "");
            }
            if (movie.hassubsection)
            {
                string[] result = new string[movie.subsectionlist.Count];
                for (int i = 0; i < movie.subsectionlist.Count; i++)
                {
                    if (Properties.Settings.Default.AddLabelTagWhenRename && Identify.IsCHS(oldName))
                    {
                        result[i] = Path.Combine(dir, $"{newName}-{i + 1}_{Jvedio.Language.Resources.Translated}{ext}");
                    }
                    else
                    {
                        result[i] = Path.Combine(dir, $"{newName}-{i + 1}{ext}");
                    }
                }
                return(result);
            }
            else
            {
                if (Properties.Settings.Default.AddLabelTagWhenRename && Identify.IsCHS(oldName))
                {
                    return(new string[] { Path.Combine(dir, $"{newName}_{Jvedio.Language.Resources.Translated}{ext}") });
                }
                else
                {
                    return(new string[] { Path.Combine(dir, $"{newName}{ext}") });
                }
            }
        }
Ejemplo n.º 2
0
 public static void addTag(ref DetailMovie movie)
 {
     //添加标签戳
     if (Identify.IsHDV(movie.filepath) || movie.genre?.IndexOfAnyString(TagStrings_HD) >= 0 || movie.tag?.IndexOfAnyString(TagStrings_HD) >= 0 || movie.label?.IndexOfAnyString(TagStrings_HD) >= 0)
     {
         movie.tagstamps += Jvedio.Language.Resources.HD;
     }
     if (Identify.IsCHS(movie.filepath) || movie.genre?.IndexOfAnyString(TagStrings_Translated) >= 0 || movie.tag?.IndexOfAnyString(TagStrings_Translated) >= 0 || movie.label?.IndexOfAnyString(TagStrings_Translated) >= 0)
     {
         movie.tagstamps += Jvedio.Language.Resources.Translated;
     }
     if (Identify.IsFlowOut(movie.filepath) || movie.genre?.IndexOfAnyString(TagStrings_FlowOut) >= 0 || movie.tag?.IndexOfAnyString(TagStrings_FlowOut) >= 0 || movie.label?.IndexOfAnyString(TagStrings_FlowOut) >= 0)
     {
         movie.tagstamps += Jvedio.Language.Resources.FlowOut;
     }
 }
Ejemplo n.º 3
0
 public static void addTag(ref DetailMovie movie)
 {
     //添加标签戳
     if (Identify.IsHDV(movie.filepath) || movie.genre?.IndexOf("高清") >= 0 || movie.tag?.IndexOf("高清") >= 0 || movie.label?.IndexOf("高清") >= 0)
     {
         movie.tagstamps += "高清";
     }
     if (Identify.IsCHS(movie.filepath) || movie.genre?.IndexOf("中文") >= 0 || movie.tag?.IndexOf("中文") >= 0 || movie.label?.IndexOf("中文") >= 0)
     {
         movie.tagstamps += "中文";
     }
     if (Identify.IsFlowOut(movie.filepath) || movie.genre?.IndexOf("流出") >= 0 || movie.tag?.IndexOf("流出") >= 0 || movie.label?.IndexOf("流出") >= 0)
     {
         movie.tagstamps += "流出";
     }
 }