forked from mono/taglib-sharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParsePhoto.cs
82 lines (70 loc) · 2.73 KB
/
ParsePhoto.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
using System;
public class ParsePhotoApp
{
public static void Main (string [] args)
{
if(args.Length == 0) {
Console.Error.WriteLine("USAGE: mono ParsePhoto.exe PATH [...]");
return;
}
foreach (string path in args)
ParsePhoto (path);
}
static void ParsePhoto (string path)
{
TagLib.File file = null;
try {
file = TagLib.File.Create(path);
} catch (TagLib.UnsupportedFormatException) {
Console.WriteLine ("UNSUPPORTED FILE: " + path);
Console.WriteLine (String.Empty);
Console.WriteLine ("---------------------------------------");
Console.WriteLine (String.Empty);
return;
}
var image = file as TagLib.Image.File;
if (file == null) {
Console.WriteLine ("NOT AN IMAGE FILE: " + path);
Console.WriteLine (String.Empty);
Console.WriteLine ("---------------------------------------");
Console.WriteLine (String.Empty);
return;
}
Console.WriteLine (String.Empty);
Console.WriteLine (path);
Console.WriteLine (String.Empty);
Console.WriteLine("Tags in object : " + image.TagTypes);
Console.WriteLine (String.Empty);
Console.WriteLine("Comment : " + image.ImageTag.Comment);
Console.Write("Keywords : ");
foreach (var keyword in image.ImageTag.Keywords) {
Console.Write (keyword + " ");
}
Console.WriteLine ();
Console.WriteLine("Rating : " + image.ImageTag.Rating);
Console.WriteLine("DateTime : " + image.ImageTag.DateTime);
Console.WriteLine("Orientation : " + image.ImageTag.Orientation);
Console.WriteLine("Software : " + image.ImageTag.Software);
Console.WriteLine("ExposureTime : " + image.ImageTag.ExposureTime);
Console.WriteLine("FNumber : " + image.ImageTag.FNumber);
Console.WriteLine("ISOSpeedRatings : " + image.ImageTag.ISOSpeedRatings);
Console.WriteLine("FocalLength : " + image.ImageTag.FocalLength);
Console.WriteLine("FocalLength35mm : " + image.ImageTag.FocalLengthIn35mmFilm);
Console.WriteLine("Make : " + image.ImageTag.Make);
Console.WriteLine("Model : " + image.ImageTag.Model);
if (image.Properties != null) {
Console.WriteLine("Width : " + image.Properties.PhotoWidth);
Console.WriteLine("Height : " + image.Properties.PhotoHeight);
Console.WriteLine("Type : " + image.Properties.Description);
}
Console.WriteLine ();
Console.WriteLine("Writable? : " + image.Writeable.ToString ());
Console.WriteLine("Corrupt? : " + image.PossiblyCorrupt.ToString ());
if (image.PossiblyCorrupt) {
foreach (string reason in image.CorruptionReasons) {
Console.WriteLine (" * " + reason);
}
}
Console.WriteLine ("---------------------------------------");
}
}