1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using NDesk.Options;
- using log4net;
- namespace MovieBarcodeGenerator {
- class Program {
- private static log4net.ILog log = log4net.LogManager.GetLogger("Main");
- static void Main(string[] args) {
- log4net.Config.XmlConfigurator.Configure();
- string inputFile = null;
- string outputFile = null;
- int outputHeight = 100;
- int iterations = 1000;
- int barWidth = 1;
- OptionSet op = new OptionSet()
- .Add("i=|input=", delegate(string v) { inputFile = v; })
- .Add("o=|output=", delegate(string v) { outputFile = v; })
- .Add("h:|height:", delegate(int v) { outputHeight = v; })
- .Add("s:|slices:", delegate(int v) { iterations = v; })
- .Add("bw:|barwidth:", delegate(int v) { barWidth = v; });
- op.Parse(args);
- if (inputFile == null || outputFile == null) {
- ShowHelp();
- return;
- }
- BarcodeGenerator.ffmpegPath = System.Configuration.ConfigurationManager.AppSettings["folderFFMpeg"];
- if (!File.Exists(Path.Combine()))
- BarcodeGenerator.Generate(inputFile, outputFile, outputHeight, barWidth, iterations);
- log.Info("Complete.");
- }
- private static void ShowHelp() {
- Console.WriteLine("Movie Barcode Generator v1.0, Created 2015 pixelbath.com");
- Console.WriteLine();
- Console.WriteLine(" -i, --input FILE\t(required) the input video file path");
- Console.WriteLine(" -o, --output FILE\t(required) the output image file path");
- Console.WriteLine(" -h, --height HEIGHT\tthe output image height, in pixels (default: 100)");
- Console.WriteLine(" -s, --slices WIDTH\tnumber of slices used to generate image (default: 1000)");
- Console.WriteLine(" -bw, --barwidth WIDTH\tindividual slice width, in pixels (default: 1)");
- Console.WriteLine();
- Console.WriteLine($" ffmpeg path: {BarcodeGenerator.ffmpegPath}");
- Console.WriteLine();
- }
- }
- }
|