/// <summary> /// Processes the current action against the currently selected item /// </summary> private void ProcessAction(PlayOnItem currentItem, PassAction action) { var matchPattern = action.Name; var excludePattern = action.Exclude; var foundItem = false; _logManager.Log("Matching \"{0}\"...", matchPattern); using (_logManager.NextLogDepth()) { foreach (var childItem in ((PlayOnFolder) currentItem).Items) { _logManager.LogVerbose("Checking \"{0}\"...", childItem.Name); if (!Util.MatchesPattern(childItem.Name, matchPattern)) continue; if (Util.MatchesPattern(childItem.Name, excludePattern)) { _logManager.LogVerbose("Excluded match."); continue; } foundItem = true; switch (action.Type) { case PassActionType.Scan: if (!(childItem is PlayOnFolder)) continue; using (_logManager.NextLogVerboseDepth()) { _logManager.LogVerbose("Entering \"{0}\"", childItem.Name); ProcessActions(childItem, action.Actions); _logManager.LogVerbose("Leaving \"{0}\"", childItem.Name); } break; case PassActionType.Queue: if (!(childItem is PlayOnVideo)) continue; _logManager.Log("Queuing \"{0}\"...", childItem.Name); using (_logManager.NextLogDepth()) QueueMedia((PlayOnVideo) childItem); break; } } if (!foundItem) _logManager.Log("No matches \"{0}\".", matchPattern); } }
/// <summary> /// Loads the full details of a PlayOnItem. /// </summary> public void LoadItemDetails(PlayOnItem item) { var doc = XmlRequest(item.Url); item.LoadFromNode(doc.ChildNodes[0]); }
/// <summary> /// Processes all of the actions against the currently selected item /// </summary> private void ProcessActions(PlayOnItem currentItem, PassActions actions) { if (!(currentItem is PlayOnFolder)) return; foreach (var action in actions) { using (_logManager.NextLogVerboseDepth()) ProcessAction(currentItem, action); } }