Click here to Skip to main content
15,892,575 members
Articles / Programming Languages / XML

WMP Playlist Fix

Rate me:
Please Sign up or sign in to vote.
4.80/5 (2 votes)
6 Dec 2013CPOL6 min read 20.5K   546   5  
The goal is to clean-up double entries in Windows Media Player playlists because the player doesn’t do that itself. For that, a WPL class has been written, and a program that uses that class.
namespace WPLControlLib
{
  partial class WMPPlayListCtrl
  {
    /// <summary> 
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    /// <summary> 
    /// Clean up any resources being used.
    /// </summary>
    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    protected override void Dispose(bool disposing)
    {
      if (disposing && (components != null))
      {
        components.Dispose();
      }
      base.Dispose(disposing);
    }

    #region Component Designer generated code

    /// <summary> 
    /// Required method for Designer support - do not modify 
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
      this.groupBox1 = new System.Windows.Forms.GroupBox();
      this.buttonShuffle = new System.Windows.Forms.Button();
      this.buttonProcessFile = new System.Windows.Forms.Button();
      this.buttonBrowseSingleFile = new System.Windows.Forms.Button();
      this.comboBoxFile = new System.Windows.Forms.ComboBox();
      this.label1 = new System.Windows.Forms.Label();
      this.groupBox2 = new System.Windows.Forms.GroupBox();
      this.buttonOpenFolder = new System.Windows.Forms.Button();
      this.buttonProcessFolder = new System.Windows.Forms.Button();
      this.buttonBrowseFolder = new System.Windows.Forms.Button();
      this.comboBoxFolder = new System.Windows.Forms.ComboBox();
      this.label2 = new System.Windows.Forms.Label();
      this.groupBox3 = new System.Windows.Forms.GroupBox();
      this.radioButtonBasedOnFilename = new System.Windows.Forms.RadioButton();
      this.checkBoxRemoveNonFiles = new System.Windows.Forms.CheckBox();
      this.radioButtonBasedOnLocation = new System.Windows.Forms.RadioButton();
      this.radioButtonBasedOnTrackTitle = new System.Windows.Forms.RadioButton();
      this.checkBoxRemoveDoubles = new System.Windows.Forms.CheckBox();
      this.checkBoxRemoveTID = new System.Windows.Forms.CheckBox();
      this.backgroundWorker = new System.ComponentModel.BackgroundWorker();
      this.progressBar1 = new System.Windows.Forms.ProgressBar();
      this.labelProgress = new System.Windows.Forms.Label();
      this.groupBox1.SuspendLayout();
      this.groupBox2.SuspendLayout();
      this.groupBox3.SuspendLayout();
      this.SuspendLayout();
      // 
      // groupBox1
      // 
      this.groupBox1.BackColor = System.Drawing.SystemColors.Control;
      this.groupBox1.Controls.Add(this.buttonShuffle);
      this.groupBox1.Controls.Add(this.buttonProcessFile);
      this.groupBox1.Controls.Add(this.buttonBrowseSingleFile);
      this.groupBox1.Controls.Add(this.comboBoxFile);
      this.groupBox1.Controls.Add(this.label1);
      this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
      this.groupBox1.Location = new System.Drawing.Point(0, 0);
      this.groupBox1.Name = "groupBox1";
      this.groupBox1.Size = new System.Drawing.Size(484, 76);
      this.groupBox1.TabIndex = 0;
      this.groupBox1.TabStop = false;
      this.groupBox1.Text = "Single file process";
      // 
      // buttonShuffle
      // 
      this.buttonShuffle.Location = new System.Drawing.Point(71, 46);
      this.buttonShuffle.Name = "buttonShuffle";
      this.buttonShuffle.Size = new System.Drawing.Size(75, 23);
      this.buttonShuffle.TabIndex = 4;
      this.buttonShuffle.Text = "Shuffle";
      this.buttonShuffle.UseVisualStyleBackColor = true;
      this.buttonShuffle.Click += new System.EventHandler(this.buttonShuffle_Click);
      // 
      // buttonProcessFile
      // 
      this.buttonProcessFile.Location = new System.Drawing.Point(346, 40);
      this.buttonProcessFile.Name = "buttonProcessFile";
      this.buttonProcessFile.Size = new System.Drawing.Size(129, 29);
      this.buttonProcessFile.TabIndex = 3;
      this.buttonProcessFile.Text = "Process file";
      this.buttonProcessFile.UseVisualStyleBackColor = true;
      this.buttonProcessFile.Click += new System.EventHandler(this.buttonProcessFile_Click);
      // 
      // buttonBrowseSingleFile
      // 
      this.buttonBrowseSingleFile.Location = new System.Drawing.Point(444, 18);
      this.buttonBrowseSingleFile.Name = "buttonBrowseSingleFile";
      this.buttonBrowseSingleFile.Size = new System.Drawing.Size(31, 23);
      this.buttonBrowseSingleFile.TabIndex = 2;
      this.buttonBrowseSingleFile.Text = "...";
      this.buttonBrowseSingleFile.UseVisualStyleBackColor = true;
      this.buttonBrowseSingleFile.Click += new System.EventHandler(this.buttonBrowseSingleFile_Click);
      // 
      // comboBoxFile
      // 
      this.comboBoxFile.FormattingEnabled = true;
      this.comboBoxFile.Location = new System.Drawing.Point(71, 19);
      this.comboBoxFile.Name = "comboBoxFile";
      this.comboBoxFile.Size = new System.Drawing.Size(373, 21);
      this.comboBoxFile.TabIndex = 1;
      this.comboBoxFile.SelectedIndexChanged += new System.EventHandler(this.comboBoxFile_SelectedIndexChanged);
      this.comboBoxFile.TextChanged += new System.EventHandler(this.comboBoxFile_TextChanged);
      // 
      // label1
      // 
      this.label1.AutoSize = true;
      this.label1.Location = new System.Drawing.Point(16, 23);
      this.label1.Name = "label1";
      this.label1.Size = new System.Drawing.Size(49, 13);
      this.label1.TabIndex = 0;
      this.label1.Text = "Filename";
      // 
      // groupBox2
      // 
      this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                  | System.Windows.Forms.AnchorStyles.Right)));
      this.groupBox2.BackColor = System.Drawing.SystemColors.Control;
      this.groupBox2.Controls.Add(this.buttonOpenFolder);
      this.groupBox2.Controls.Add(this.buttonProcessFolder);
      this.groupBox2.Controls.Add(this.buttonBrowseFolder);
      this.groupBox2.Controls.Add(this.comboBoxFolder);
      this.groupBox2.Controls.Add(this.label2);
      this.groupBox2.Location = new System.Drawing.Point(0, 76);
      this.groupBox2.Name = "groupBox2";
      this.groupBox2.Size = new System.Drawing.Size(484, 76);
      this.groupBox2.TabIndex = 1;
      this.groupBox2.TabStop = false;
      this.groupBox2.Text = "Process all WPL files in folder.";
      // 
      // buttonOpenFolder
      // 
      this.buttonOpenFolder.Location = new System.Drawing.Point(71, 47);
      this.buttonOpenFolder.Name = "buttonOpenFolder";
      this.buttonOpenFolder.Size = new System.Drawing.Size(141, 23);
      this.buttonOpenFolder.TabIndex = 6;
      this.buttonOpenFolder.Text = "Open Folder in Explorer";
      this.buttonOpenFolder.UseVisualStyleBackColor = true;
      this.buttonOpenFolder.Click += new System.EventHandler(this.buttonOpenFolder_Click);
      // 
      // buttonProcessFolder
      // 
      this.buttonProcessFolder.Location = new System.Drawing.Point(346, 40);
      this.buttonProcessFolder.Name = "buttonProcessFolder";
      this.buttonProcessFolder.Size = new System.Drawing.Size(129, 29);
      this.buttonProcessFolder.TabIndex = 5;
      this.buttonProcessFolder.Text = "Process Folder";
      this.buttonProcessFolder.UseVisualStyleBackColor = true;
      this.buttonProcessFolder.Click += new System.EventHandler(this.buttonProcessFolder_Click);
      // 
      // buttonBrowseFolder
      // 
      this.buttonBrowseFolder.Location = new System.Drawing.Point(444, 18);
      this.buttonBrowseFolder.Name = "buttonBrowseFolder";
      this.buttonBrowseFolder.Size = new System.Drawing.Size(31, 23);
      this.buttonBrowseFolder.TabIndex = 4;
      this.buttonBrowseFolder.Text = "...";
      this.buttonBrowseFolder.UseVisualStyleBackColor = true;
      this.buttonBrowseFolder.Click += new System.EventHandler(this.buttonBrowseFolder_Click);
      // 
      // comboBoxFolder
      // 
      this.comboBoxFolder.FormattingEnabled = true;
      this.comboBoxFolder.Location = new System.Drawing.Point(71, 19);
      this.comboBoxFolder.Name = "comboBoxFolder";
      this.comboBoxFolder.Size = new System.Drawing.Size(373, 21);
      this.comboBoxFolder.TabIndex = 1;
      this.comboBoxFolder.TextChanged += new System.EventHandler(this.comboBoxFolder_TextChanged);
      // 
      // label2
      // 
      this.label2.AutoSize = true;
      this.label2.Location = new System.Drawing.Point(16, 23);
      this.label2.Name = "label2";
      this.label2.Size = new System.Drawing.Size(36, 13);
      this.label2.TabIndex = 0;
      this.label2.Text = "Folder";
      // 
      // groupBox3
      // 
      this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                  | System.Windows.Forms.AnchorStyles.Right)));
      this.groupBox3.BackColor = System.Drawing.SystemColors.Control;
      this.groupBox3.Controls.Add(this.radioButtonBasedOnFilename);
      this.groupBox3.Controls.Add(this.checkBoxRemoveNonFiles);
      this.groupBox3.Controls.Add(this.radioButtonBasedOnLocation);
      this.groupBox3.Controls.Add(this.radioButtonBasedOnTrackTitle);
      this.groupBox3.Controls.Add(this.checkBoxRemoveDoubles);
      this.groupBox3.Controls.Add(this.checkBoxRemoveTID);
      this.groupBox3.Location = new System.Drawing.Point(0, 152);
      this.groupBox3.Name = "groupBox3";
      this.groupBox3.Size = new System.Drawing.Size(484, 155);
      this.groupBox3.TabIndex = 2;
      this.groupBox3.TabStop = false;
      this.groupBox3.Text = "Settings";
      // 
      // radioButtonBasedOnFilename
      // 
      this.radioButtonBasedOnFilename.AutoSize = true;
      this.radioButtonBasedOnFilename.Location = new System.Drawing.Point(44, 131);
      this.radioButtonBasedOnFilename.Name = "radioButtonBasedOnFilename";
      this.radioButtonBasedOnFilename.Size = new System.Drawing.Size(112, 17);
      this.radioButtonBasedOnFilename.TabIndex = 5;
      this.radioButtonBasedOnFilename.TabStop = true;
      this.radioButtonBasedOnFilename.Text = "Based on filename";
      this.radioButtonBasedOnFilename.UseVisualStyleBackColor = true;
      // 
      // checkBoxRemoveNonFiles
      // 
      this.checkBoxRemoveNonFiles.AutoSize = true;
      this.checkBoxRemoveNonFiles.Location = new System.Drawing.Point(16, 16);
      this.checkBoxRemoveNonFiles.Name = "checkBoxRemoveNonFiles";
      this.checkBoxRemoveNonFiles.Size = new System.Drawing.Size(150, 17);
      this.checkBoxRemoveNonFiles.TabIndex = 4;
      this.checkBoxRemoveNonFiles.Text = "Remove non-existent files.";
      this.checkBoxRemoveNonFiles.UseVisualStyleBackColor = true;
      this.checkBoxRemoveNonFiles.CheckedChanged += new System.EventHandler(this.checkBoxRemoveNonFiles_CheckedChanged);
      // 
      // radioButtonBasedOnLocation
      // 
      this.radioButtonBasedOnLocation.AutoSize = true;
      this.radioButtonBasedOnLocation.Enabled = false;
      this.radioButtonBasedOnLocation.Location = new System.Drawing.Point(44, 108);
      this.radioButtonBasedOnLocation.Name = "radioButtonBasedOnLocation";
      this.radioButtonBasedOnLocation.Size = new System.Drawing.Size(184, 17);
      this.radioButtonBasedOnLocation.TabIndex = 3;
      this.radioButtonBasedOnLocation.TabStop = true;
      this.radioButtonBasedOnLocation.Text = "Based on unique location/filepath";
      this.radioButtonBasedOnLocation.UseVisualStyleBackColor = true;
      this.radioButtonBasedOnLocation.CheckedChanged += new System.EventHandler(this.radioButtonBasedOnLocation_CheckedChanged);
      // 
      // radioButtonBasedOnTrackTitle
      // 
      this.radioButtonBasedOnTrackTitle.AutoSize = true;
      this.radioButtonBasedOnTrackTitle.Enabled = false;
      this.radioButtonBasedOnTrackTitle.Location = new System.Drawing.Point(44, 85);
      this.radioButtonBasedOnTrackTitle.Name = "radioButtonBasedOnTrackTitle";
      this.radioButtonBasedOnTrackTitle.Size = new System.Drawing.Size(206, 17);
      this.radioButtonBasedOnTrackTitle.TabIndex = 2;
      this.radioButtonBasedOnTrackTitle.TabStop = true;
      this.radioButtonBasedOnTrackTitle.Text = "Based on track name (MP3 only, slow)";
      this.radioButtonBasedOnTrackTitle.UseVisualStyleBackColor = true;
      this.radioButtonBasedOnTrackTitle.CheckedChanged += new System.EventHandler(this.radioButtonBasedOnTrackTitle_CheckedChanged);
      // 
      // checkBoxRemoveDoubles
      // 
      this.checkBoxRemoveDoubles.AutoSize = true;
      this.checkBoxRemoveDoubles.Location = new System.Drawing.Point(16, 62);
      this.checkBoxRemoveDoubles.Name = "checkBoxRemoveDoubles";
      this.checkBoxRemoveDoubles.Size = new System.Drawing.Size(196, 17);
      this.checkBoxRemoveDoubles.TabIndex = 1;
      this.checkBoxRemoveDoubles.Text = "Remove double entries from Playlist.";
      this.checkBoxRemoveDoubles.UseVisualStyleBackColor = true;
      this.checkBoxRemoveDoubles.CheckedChanged += new System.EventHandler(this.checkBoxRemoveDoubles_CheckedChanged);
      // 
      // checkBoxRemoveTID
      // 
      this.checkBoxRemoveTID.AutoSize = true;
      this.checkBoxRemoveTID.Location = new System.Drawing.Point(16, 39);
      this.checkBoxRemoveTID.Name = "checkBoxRemoveTID";
      this.checkBoxRemoveTID.Size = new System.Drawing.Size(226, 17);
      this.checkBoxRemoveTID.TabIndex = 0;
      this.checkBoxRemoveTID.Text = "Remove TID and CID tags from WPL files.";
      this.checkBoxRemoveTID.UseVisualStyleBackColor = true;
      this.checkBoxRemoveTID.CheckedChanged += new System.EventHandler(this.checkBoxRemoveTID_CheckedChanged);
      // 
      // backgroundWorker
      // 
      this.backgroundWorker.WorkerReportsProgress = true;
      this.backgroundWorker.WorkerSupportsCancellation = true;
      this.backgroundWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker_DoWork);
      this.backgroundWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.backgroundWorker_ProgressChanged);
      this.backgroundWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker_RunWorkerCompleted);
      // 
      // progressBar1
      // 
      this.progressBar1.Location = new System.Drawing.Point(0, 334);
      this.progressBar1.Name = "progressBar1";
      this.progressBar1.Size = new System.Drawing.Size(484, 23);
      this.progressBar1.TabIndex = 3;
      this.progressBar1.Visible = false;
      // 
      // labelProgress
      // 
      this.labelProgress.BackColor = System.Drawing.Color.Transparent;
      this.labelProgress.Location = new System.Drawing.Point(3, 313);
      this.labelProgress.Name = "labelProgress";
      this.labelProgress.Size = new System.Drawing.Size(478, 18);
      this.labelProgress.TabIndex = 4;
      this.labelProgress.Text = "label3";
      this.labelProgress.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
      this.labelProgress.Visible = false;
      // 
      // WMPPlayListCtrl
      // 
      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
      this.Controls.Add(this.labelProgress);
      this.Controls.Add(this.progressBar1);
      this.Controls.Add(this.groupBox3);
      this.Controls.Add(this.groupBox2);
      this.Controls.Add(this.groupBox1);
      this.Name = "WMPPlayListCtrl";
      this.Size = new System.Drawing.Size(484, 360);
      this.Load += new System.EventHandler(this.WMPPlayListCtrl_Load);
      this.groupBox1.ResumeLayout(false);
      this.groupBox1.PerformLayout();
      this.groupBox2.ResumeLayout(false);
      this.groupBox2.PerformLayout();
      this.groupBox3.ResumeLayout(false);
      this.groupBox3.PerformLayout();
      this.ResumeLayout(false);

    }

    #endregion

    private System.Windows.Forms.GroupBox groupBox1;
    private System.Windows.Forms.Button buttonProcessFile;
    private System.Windows.Forms.Button buttonBrowseSingleFile;
    private System.Windows.Forms.ComboBox comboBoxFile;
    private System.Windows.Forms.Label label1;
    private System.Windows.Forms.GroupBox groupBox2;
    private System.Windows.Forms.ComboBox comboBoxFolder;
    private System.Windows.Forms.Label label2;
    private System.Windows.Forms.Button buttonBrowseFolder;
    private System.Windows.Forms.Button buttonProcessFolder;
    private System.Windows.Forms.GroupBox groupBox3;
    private System.Windows.Forms.RadioButton radioButtonBasedOnLocation;
    private System.Windows.Forms.RadioButton radioButtonBasedOnTrackTitle;
    private System.Windows.Forms.CheckBox checkBoxRemoveDoubles;
    private System.Windows.Forms.CheckBox checkBoxRemoveTID;
    private System.Windows.Forms.CheckBox checkBoxRemoveNonFiles;
    private System.Windows.Forms.RadioButton radioButtonBasedOnFilename;
    private System.ComponentModel.BackgroundWorker backgroundWorker;
    private System.Windows.Forms.ProgressBar progressBar1;
    private System.Windows.Forms.Label labelProgress;
    private System.Windows.Forms.Button buttonOpenFolder;
    private System.Windows.Forms.Button buttonShuffle;
  }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
South Africa South Africa
Started in 1988 programming in Pascal, making a 68000 emulator on a DOS platform. Then from Pascal to Clipper, to C++ and now using C#. I've been programming for all walks of businesses; opticians, opthomologist, carbage collectors, reinforcement steel producers, retail chains, and more.
I'm now travelling through Africa with a home-build expedition truck.

Comments and Discussions