Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
Parse promo metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
dnas2 committed Dec 12, 2017
1 parent ba09703 commit 2d147e6
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 4 deletions.
84 changes: 81 additions & 3 deletions ad-automation/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion ad-automation/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ private string getPromosFolder()
{
string promoPath = promoBrowserDialog.SelectedPath;
promosFolderSelectedLabel.Text = promoPath;
getPromosInFolder(promoPath);
return promoPath;
}
return "";
Expand Down Expand Up @@ -109,7 +110,6 @@ private void canGenerateButtonBeDisabled()

private void generateBreaksButton_Click(object sender, EventArgs e)
{
getPromosInFolder(promoPath);
createTargetDirectory();
createBreaks();
jingleStudioPathValue = jinglesStudioPath.Text;
Expand Down Expand Up @@ -250,7 +250,9 @@ private void getPromosInFolder(string folderPath)
tmpPromo.originalPath = file.FullName;
tmpPromo.targetPath = promosStudioPath.Text + tmpPromo.filename;
tmpPromo.getMP3Comment();
tmpPromo.deserialiseSavedInfo();
tmpPromo.setPriority(createBreaksForPicker.Value);
tmpPromo.addToPromoTablePanel(promoTableLayoutPanel);
allPromos.Add(tmpPromo);
}
}
Expand Down
44 changes: 44 additions & 0 deletions ad-automation/promo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ad_automation
{
Expand Down Expand Up @@ -45,5 +46,48 @@ internal void setPriority(DateTime breakTime)
else { priority = 2; }
}


internal void addToPromoTablePanel(TableLayoutPanel promoTablePanel)
{
DateTimePicker tmpStartDatePicker = new DateTimePicker { Value = startDate };
tmpStartDatePicker.TextChanged += new System.EventHandler(tmpStartDatePicker_TextChanged);
DateTimePicker tmpEndDatePicker = new DateTimePicker { Value = endDate, Format = DateTimePickerFormat.Custom, CustomFormat = "dd MMM yyyy HH:mm:ss" };
tmpEndDatePicker.TextChanged += new System.EventHandler(tmpEndDatePicker_TextChanged);
Button tmpButton = new Button { Text = "Save" };
tmpButton.Click += new System.EventHandler(tmpButton_Click);

promoTablePanel.RowCount = promoTablePanel.RowCount + 1;
promoTablePanel.Controls.Add(new Label() { Text = filename, AutoSize=true }, 0, promoTablePanel.RowCount);
promoTablePanel.Controls.Add(tmpStartDatePicker, 1, promoTablePanel.RowCount);
promoTablePanel.Controls.Add(tmpEndDatePicker, 2, promoTablePanel.RowCount);
promoTablePanel.Controls.Add(tmpButton, 4, promoTablePanel.RowCount);
}

private void tmpEndDatePicker_TextChanged(object sender, EventArgs e)
{
DateTimePicker tmpDatePicker = sender as DateTimePicker;
endDate = DateTime.Parse(tmpDatePicker.Text);
}

private void tmpStartDatePicker_TextChanged(object sender, EventArgs e)
{
DateTimePicker tmpDatePicker = sender as DateTimePicker;
startDate = DateTime.Parse(tmpDatePicker.Text);
}

protected void tmpButton_Click(object sender, EventArgs e)
{
Button button = sender as Button;
writeMetadataToMP3();
}

private void writeMetadataToMP3()
{
TagLib.File tmpFile = TagLib.File.Create(originalPath);
string output = JsonConvert.SerializeObject(this);
tmpFile.Tag.Comment = mp3CommentString + " ###ADDATA###" + output;
tmpFile.Save();
}

}
}

0 comments on commit 2d147e6

Please sign in to comment.