-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGlobalUserConfig.cs
110 lines (90 loc) · 2.81 KB
/
GlobalUserConfig.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MusicFactory
{
public class GlobalUserConfig
{
static String parentFolderPath;
static String searchPattern;
static string tmpFolder;
static string fileType;
static string fileExtention;
static string musicFilesFolder;
static string tempFolder;
public enum ArtisTagLookUp
{
Unknown = 0,
AlbumArtists = 1,
Artists = 2
}
public static String TempFolder
{
get { return tempFolder; }
set { tempFolder = value; }
}
public static String ParentFolderPath
{
get { return parentFolderPath; }
set { parentFolderPath = value; }
}
[Obsolete]
public static String SearchPattern
{
get { return searchPattern; }
}
public GlobalUserConfig()
{
GlobalUserConfig.searchPattern = "*.wma";
GlobalUserConfig.fileType = "*.wma";
GlobalUserConfig.fileExtention = ".wma";
GlobalUserConfig.musicFilesFolder = @"D:\song\Songs\Wow I am here\";
GlobalUserConfig.tempFolder = AppDomain.CurrentDomain.BaseDirectory + @"Tmp\";
}
public static string FileType
{
get
{
return fileType;
}
}
public static string FileExtention
{
get
{
return fileExtention;
}
}
public static string MusicFilesFolder
{
get
{
return musicFilesFolder;
}
}
public static List<string> GetArtist(TagLib.File tagMusicFile)
{
string[] obsoleteValues = new string[2];
obsoleteValues[0] = "UNKNOWN ARTIST";
obsoleteValues[1] = "ARTIST";
bool isAlbumArtist = tagMusicFile.Tag.AlbumArtists != null;
isAlbumArtist = isAlbumArtist ? tagMusicFile.Tag.AlbumArtists.Count() > 0 : false;
bool isArtist = tagMusicFile.Tag.Artists != null;
isArtist = isArtist ? tagMusicFile.Tag.Artists.Count() > 0 : false;
List<string> artists = new List<string>();
foreach (var val in obsoleteValues)
{
if (isAlbumArtist)
{
artists = tagMusicFile.Tag.AlbumArtists.Where(r => r.ToUpper() != val).ToList();
}
if (isArtist)
{
artists = tagMusicFile.Tag.Artists.Where(r => r.ToUpper() != val).ToList();
}
}
return artists;
}
}
}