Archive for June, 2006

Media Organizer

I’ll get straight down to the code. What this does is create a bunch of folders where you can place your media files (ie: episodes in a tv series’ season). Its pretty roughly coded, you can compile it in Visual Studio 2005 Express Edition (specifically Visual C# Express ‘05). Anyway; code:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using System.Collections;

namespace TVOrganizer {

public partial class Form1 : Form { public Form1() {

InitializeComponent();

}

private void button2_Click(object sender, EventArgs e) {

int it = Convert.ToInt32(epsInSeason.Text);

int i;

for (i = 1; i < it+1; i++) {

string Dir = selectedPath.Text + “\\” + “S” + seasonNo.Text.Normalize() + ” - ” + “E” + i; System.IO.Directory.CreateDirectory(@Dir);

toolStripStatusLabel1.Text = “Created Directory: ” + Dir; } }

private void FolderBrowse_Click(object sender, EventArgs e) {

folderBrowserDialog1.ShowDialog();

selectedPath.Text = folderBrowserDialog1.SelectedPath;

}

public void button1_Click(object sender, EventArgs e) {

folderBrowserDialog2.ShowDialog();

ArrayList fileNames = new ArrayList();

foreach (string fName in System.IO.Directory.GetFiles(folderBrowserDialog2.SelectedPath)) {

fileNames.Add(fName);

}

}

private void button2_Click_1(object sender, EventArgs e) {

ArrayList fileNames = new ArrayList(); string FileNameBeforeAfter = textBox1.Text;

int startEpi = Convert.ToInt32(startEp.Text);

int endEpi = Convert.ToInt32(endEp.Text);

foreach (string value in fileNames) {

for (startEpi; startEpi < endEpi + 1; startEpi++) {

System.IO.File.Move(value, folderBrowserDialog1.SelectedPath);

}

}

}

}

}

 

Enjoy.