File: SetPictures.cs

package info (click to toggle)
taglib-sharp 2.0.3.7%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,120 kB
  • ctags: 3,330
  • sloc: cs: 26,081; sh: 3,439; makefile: 283
file content (28 lines) | stat: -rw-r--r-- 801 bytes parent folder | download | duplicates (5)
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
using System;
using TagLib;

public class SetPictures
{
    public static void Main(string [] args)
    {
        if(args.Length < 2) {
            Console.Error.WriteLine("USAGE: mono SetPictures.exe AUDIO_PATH IMAGE_PATH_1[...IMAGE_PATH_N]");
            return;
        }
    
        TagLib.File file = TagLib.File.Create(args[0]);
        Console.WriteLine("Current picture count: " + file.Tag.Pictures.Length);
        
        Picture [] pictures = new Picture[args.Length - 1];
    
        for(int i = 1; i < args.Length; i++) {
            Picture picture = new Picture(args[i]);
            pictures[i - 1] = picture;
        }
        
        file.Tag.Pictures = pictures;
        file.Save();
        
        Console.WriteLine("New picture count: " + file.Tag.Pictures.Length);
    }
}