Esempio n. 1
0
 public RecurringChannel(int oid, string name, RecurringRecordingList list)
 {
     this.OID   = oid;
     this.Name  = name;
     this.List  = list;
     this.Shows = new List <RecurringRecording>();
 }
Esempio n. 2
0
        private void onChannelSortClick(object sender, EventArgs e)
        {
            if (this.mRecurringChannels == null || this.mRecurringChannelCount < 2)
            {
                return;
            }

            RecNameSort sortByName;

            if (this.mChannelSortNameNoneRAD.Checked)
            {
                sortByName = RecNameSort.None;
            }
            else if (this.mChannelSortNameAscendingRAD.Checked)
            {
                sortByName = RecNameSort.NameAscending;
            }
            else if (this.mChannelSortNameDescendingRAD.Checked)
            {
                sortByName = RecNameSort.NameDescending;
            }
            else if (this.mChannelSortOidAscendingRAD.Checked)
            {
                sortByName = RecNameSort.OidAscending;
            }
            else if (this.mChannelSortOidDescendingRAD.Checked)
            {
                sortByName = RecNameSort.OidDescending;
            }
            else
            {
                sortByName = RecNameSort.None;
            }

            RecSizeSort sortBySize;

            if (this.mChannelSortSizeNoneRAD.Checked)
            {
                sortBySize = RecSizeSort.None;
            }
            else if (this.mChannelSortSizeAscendingRAD.Checked)
            {
                sortBySize = RecSizeSort.Ascending;
            }
            else if (this.mChannelSortSizeDescendingRAD.Checked)
            {
                sortBySize = RecSizeSort.Descending;
            }
            else
            {
                sortBySize = RecSizeSort.None;
            }

            RecurringRecordingList.SortLists(this.mRecurringChannels, this.mRecurringChannelCount, sortByName, sortBySize);
        }
Esempio n. 3
0
        private void onFileSaveAsClick(object sender, EventArgs e)
        {
            SaveFileDialog dialog = new SaveFileDialog();

            dialog.Filter           = "XML Files (*.xml)|*.xml";
            dialog.RestoreDirectory = true;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                this.mFileName = dialog.FileName;
                RecurringRecordingList list = RecurringRecordingList.MergeLists(this.mRecurringChannels, this.mRecurringChannelCount);
                list.Serialize(this.mFileName);
            }
        }
Esempio n. 4
0
        private void onChannelDownClick(object sender, EventArgs e)
        {
            int index = this.mChannelsListBox.SelectedIndex;

            if (index == this.mRecurringChannelCount - 1)
            {
                return;
            }

            object display = this.mChannelsListBox.Items[index];

            this.mChannelsListBox.Items[index]     = this.mChannelsListBox.Items[index + 1];
            this.mChannelsListBox.Items[index + 1] = display;

            RecurringRecordingList list = this.mRecurringChannels[index];

            this.mRecurringChannels[index]     = this.mRecurringChannels[index + 1];
            this.mRecurringChannels[index + 1] = list;

            this.mChannelsListBox.SelectedIndex = index + 1;
        }
Esempio n. 5
0
        private void onShowUpClick(object sender, EventArgs e)
        {
            int index = this.mChannelsListBox.SelectedIndex;
            RecurringRecordingList list = this.mRecurringChannels[index];

            index = this.mShowsListBox.SelectedIndex;
            if (index == 0)
            {
                return;
            }

            object display = this.mShowsListBox.Items[index];

            this.mShowsListBox.Items[index]     = this.mShowsListBox.Items[index - 1];
            this.mShowsListBox.Items[index - 1] = display;

            RecurringRecording rec = list[index];

            list[index]     = list[index - 1];
            list[index - 1] = rec;

            this.mShowsListBox.SelectedIndex = index - 1;
        }
Esempio n. 6
0
        private void onFileOpenClick(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter           = "XML Files (*.xml)|*.xml";
            dialog.RestoreDirectory = true;
            dialog.ShowReadOnly     = true;
            dialog.ReadOnlyChecked  = true;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                this.mFileName = dialog.FileName;
                XmlDocument document = new XmlDocument();
                document.Load(this.mFileName);
                string rootName = document.DocumentElement.Name;
                if (rootName.Equals("recurrings"))
                {
                    RecurringRecordingList channel = new RecurringRecordingList(document);
                    this.mRecurringChannels     = channel.DivideByChannel(RecNameSort.None, RecSizeSort.None);
                    this.mRecurringChannelCount = this.mRecurringChannels.Length;
                    this.mRecurringTrash        = new RecurringChannel[this.mRecurringChannelCount];
                    this.mRecurringTrashCount   = 0;
                    for (int i = 0; i < this.mRecurringChannelCount; i++)
                    {
                        channel = this.mRecurringChannels[i];
                        this.mChannelsListBox.Items.Add(string.Concat(channel.ChannelName, " | ", channel.Count.ToString()));
                    }
                    this.saveToolStripMenuItem.Enabled   = dialog.ReadOnlyChecked;
                    this.saveAsToolStripMenuItem.Enabled = true;
                    this.closeToolStripMenuItem.Enabled  = true;

                    this.mChannelSortButton.Enabled = true;
                    this.mChannelUpButton.Enabled   = this.mRecurringChannelCount > 1;
                    this.mChannelDownButton.Enabled = this.mRecurringChannelCount > 1;
                    this.mTrashDownButton.Enabled   = true;
                }
            }
        }
Esempio n. 7
0
        private void onFileSaveClick(object sender, EventArgs e)
        {
            RecurringRecordingList list = RecurringRecordingList.MergeLists(this.mRecurringChannels, this.mRecurringChannelCount);

            list.Serialize(this.mFileName);
        }
Esempio n. 8
0
        private void onTrashDownClick(object sender, EventArgs e)
        {
            int index = this.mChannelsListBox.SelectedIndex;
            RecurringRecordingList recList = this.mRecurringChannels[index];

            index = this.mShowsListBox.SelectedIndex;
            RecurringRecording rec = recList[index];
            RecurringChannel   channel;

            if (this.mRecurringTrashCount == 0)
            {
                channel = new RecurringChannel(rec.ChannelOID, rec.ChannelName, recList);
                channel.Shows.Add(rec);
                this.mRecurringTrash[this.mRecurringTrashCount++] = channel;
                this.mTrashChannelsListBox.Items.Add(string.Concat(channel.Name, " | 1"));
            }
            else
            {
                int i = 0;
                channel = this.mRecurringTrash[i];
                while (i < this.mRecurringTrashCount && channel.OID != rec.ChannelOID)
                {
                    channel = this.mRecurringTrash[++i];
                }
                if (i == this.mRecurringTrashCount)
                {
                    channel = new RecurringChannel(rec.ChannelOID, rec.ChannelName, recList);
                    channel.Shows.Add(rec);
                    this.mRecurringTrash[this.mRecurringTrashCount++] = channel;
                    this.mTrashChannelsListBox.Items.Add(string.Concat(channel.Name, " | 1"));
                }
                else
                {
                    channel.Shows.Add(rec);
                    this.mTrashChannelsListBox.Items[i] = string.Concat(channel.Name, " | ", channel.Shows.Count.ToString());
                }
            }
            if (recList.Count > 1)
            {
                this.mShowsListBox.SelectedIndex = index == 0 ? 1 : index - 1;
            }
            recList.RemoveAt(index);
            this.mShowsListBox.Items.RemoveAt(index);
            if (recList.Count == 0)
            {
                index = this.mChannelsListBox.SelectedIndex;
                if (this.mRecurringChannelCount > 1)
                {
                    this.mChannelsListBox.SelectedIndex = index == 0 ? 1 : index - 1;
                }
                this.mRecurringChannelCount--;
                for (int j = index; j < this.mRecurringChannelCount; j++)
                {
                    this.mRecurringChannels[j] = this.mRecurringChannels[j + 1];
                }
                this.mChannelsListBox.Items.RemoveAt(index);
            }
            this.mChannelUpButton.Enabled   = this.mRecurringChannelCount > 1;
            this.mChannelDownButton.Enabled = this.mRecurringChannelCount > 1;
            this.mTrashUpButton.Enabled     = true;
            this.mTrashDownButton.Enabled   = this.mRecurringChannelCount == 0;
        }
Esempio n. 9
0
        static void Main(string[] args)
        {
            string filePath = "";

            if (args.Length == 1 && File.Exists(args[0]))
            {
                filePath = args[0];
            }
            else
            {
                for (int i = 0; i < args.Length; i++)
                {
                    if (File.Exists(args[i]))
                    {
                        filePath = args[i];
                    }
                }
            }
            if (filePath != "")
            {
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(filePath);
                string       outputDir, outputFile;
                StreamWriter channelStats, showStats;
                string       rootName = xmlDoc.DocumentElement.Name;
                if (string.Equals(rootName, "recordings"))
                {
                    Console.WriteLine("NextPVR Recording List Xml File Recognized.");
                    string                outputPath;
                    RecordingList         show;
                    RecordingList[]       shows;
                    RecordingList.Channel channel;
                    outputDir    = CreateOutputDirectory(filePath);
                    channelStats = new StreamWriter(Path.Combine(outputDir, "ChannelStats.txt"));
                    RecordingList list = new RecordingList(xmlDoc);
                    Console.WriteLine(string.Concat(list.Count.ToString(), " recordings found."));
                    RecordingList.Channel[] channels = list.DivideByChannelAndShow();
                    Console.WriteLine(string.Concat(channels.Length.ToString(), " unique channels found."));
                    for (int i = 0; i < channels.Length; i++)
                    {
                        channel = channels[i];
                        shows   = channel.Shows;
                        channelStats.Write(channel.ChannelName);
                        channelStats.Write(" | ");
                        channelStats.WriteLine(shows.Length.ToString());
                        outputPath = Path.Combine(outputDir, channel.ChannelName);
                        if (!Directory.Exists(outputPath))
                        {
                            Directory.CreateDirectory(outputPath);
                        }
                        outputFile = Path.Combine(outputDir, string.Concat(channel.ChannelName, "_ShowStats.txt"));
                        showStats  = new StreamWriter(outputFile);
                        for (int j = 0; j < shows.Length; j++)
                        {
                            show       = shows[j];
                            outputFile = Path.Combine(outputPath, string.Concat(show.ShowName, ".xml"));
                            show.Serialize(outputFile);
                            showStats.Write(show.ShowName);
                            showStats.Write(" | ");
                            showStats.WriteLine(show.Count.ToString());
                        }
                        showStats.Flush();
                        showStats.Close();
                    }
                    channelStats.Flush();
                    channelStats.Close();
                }
                else if (string.Equals(rootName, "recurrings"))
                {
                    Console.WriteLine("NextPVR Recurring Time List Xml File Recognized.");
                    outputDir    = CreateOutputDirectory(filePath);
                    channelStats = new StreamWriter(Path.Combine(outputDir, "ChannelStats.txt"));
                    RecurringRecordingList list = new RecurringRecordingList(xmlDoc);
                    Console.WriteLine(string.Concat(list.Count.ToString(), " recurring timers found."));
                    RecurringRecordingList[] channels = list.DivideByChannel(RecNameSort.NameAscending, RecSizeSort.Descending);
                    Console.WriteLine(string.Concat(channels.Length.ToString(), " unique channels found."));
                    for (int i = 0; i < channels.Length; i++)
                    {
                        list       = channels[i];
                        outputFile = string.Concat("recurring_", list.ChannelName);
                        outputFile = Path.Combine(outputDir, outputFile);
                        list.Serialize(string.Concat(outputFile, ".xml"));
                        channelStats.Write(list.ChannelName);
                        channelStats.Write(" | ");
                        channelStats.WriteLine(list.Count.ToString());
                        showStats = new StreamWriter(string.Concat(outputFile, "_ShowStats.txt"));
                        foreach (RecurringRecording rec in list)
                        {
                            showStats.Write(rec.Name);
                            showStats.Write(" | ");
                            //showStats.Write(rec.EPGTitle);
                            //showStats.Write(" | ");
                            showStats.WriteLine(rec.CreateRuleString());
                        }
                        showStats.Flush();
                        showStats.Close();
                    }
                    outputFile = Path.Combine(outputDir, DateTime.Now.ToString("'recurring_'yyyy-MM-dd_HH'h'mm_ss"));
                    list       = RecurringRecordingList.MergeLists(channels, channels.Length);
                    list.Serialize(string.Concat(outputFile, ".xml"));
                    channelStats.Flush();
                    channelStats.Close();
                }
            }
        }