File: SetPictures.cs

package info (click to toggle)
taglib-sharp 2.1.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 3,880 kB
  • sloc: cs: 29,524; sh: 594; makefile: 229
file content (28 lines) | stat: -rw-r--r-- 801 bytes parent folder | download | duplicates (4)
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);
    }
}