From: <Dam...@us...> - 2007-02-22 13:25:58
|
Revision: 1343 http://svn.sourceforge.net/azsmrc/?rev=1343&view=rev Author: Damokles Date: 2007-02-22 05:25:45 -0800 (Thu, 22 Feb 2007) Log Message: ----------- reworked the custom ep pattern a bit thx to amc1 Modified Paths: -------------- azsmrcplugins/trunk/lbms/plugins/scanerss/main/GUI.java Modified: azsmrcplugins/trunk/lbms/plugins/scanerss/main/GUI.java =================================================================== --- azsmrcplugins/trunk/lbms/plugins/scanerss/main/GUI.java 2007-02-21 18:16:48 UTC (rev 1342) +++ azsmrcplugins/trunk/lbms/plugins/scanerss/main/GUI.java 2007-02-22 13:25:45 UTC (rev 1343) @@ -1445,6 +1445,8 @@ } + + Button defaultButton = new Button(comp, SWT.PUSH); defaultButton.setText("Show Default Settings"); defaultButton.setToolTipText("Click this button to show suggested settings for the chosen Mode"); @@ -1489,25 +1491,57 @@ patternText.setText(""); break; case Episode: - patternText.setText("(\\d+)"); + patternText.setText("(\\d{1,3})"); break; case Episode_Episode: - patternText.setText("(\\d+).*?(\\d+)"); + patternText.setText("(\\d{1,3}).*?(\\d{1,3})"); break; case Season_Episode: - patternText.setText("(\\d+).*?(\\d+)"); + patternText.setText("(\\d{1,3}).*?(\\d{1,3})"); break; case Season_Episode_Episode: - patternText.setText("(\\d+).*?(\\d+).*?(\\d+)"); + patternText.setText("(\\d{1,3}).*?(\\d{1,3}).*?(\\d{1,3})"); break; case Season_Episode_Season_Episode: - patternText.setText("(\\d+).*?(\\d+).*?(\\d+).*?(\\d+)"); + patternText.setText("(\\d{1,3}).*?(\\d{1,3}).*?(\\d{1,3}).*?(\\d{1,3})"); break; } } }); + typeCombo.addSelectionListener(new SelectionAdapter() { + /* (non-Javadoc) + * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) + */ + @Override + public void widgetSelected(SelectionEvent e) { + if (patternText.equals("")) { + EpisodePatternMatching mode = EpisodePatternMatching.values()[typeCombo.getSelectionIndex()]; + switch (mode) { + case Normal: + patternText.setText(""); + break; + case Episode: + patternText.setText("(\\d{1,3})"); + break; + case Episode_Episode: + patternText.setText("(\\d{1,3}).*?(\\d{1,3})"); + break; + case Season_Episode: + patternText.setText("(\\d{1,3}).*?(\\d{1,3})"); + break; + case Season_Episode_Episode: + patternText.setText("(\\d{1,3}).*?(\\d{1,3}).*?(\\d{1,3})"); + break; + case Season_Episode_Season_Episode: + patternText.setText("(\\d{1,3}).*?(\\d{1,3}).*?(\\d{1,3}).*?(\\d{1,3})"); + break; + } + } + } + }); + Composite bComp = new Composite(comp, SWT.NULL); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 3; @@ -1524,7 +1558,27 @@ public void handleEvent(Event arg0) { EpisodePatternMatching mode = EpisodePatternMatching.values()[typeCombo.getSelectionIndex()]; Episode e = new Episode(testText.getText(),mode,Pattern.compile(patternText.getText(), Pattern.CASE_INSENSITIVE)); - outputText.setText(e.toString()); + switch (mode) { + case Normal: + outputText.setText(""); + break; + case Episode: + outputText.setText("Episode: "+e.getEpisode()); + break; + case Episode_Episode: + outputText.setText("Episode: "+e.getEpisode()+" - Episode: "+e.getEpisode_end()); + break; + case Season_Episode: + outputText.setText("Season: "+e.getSeason()+" Episode: "+e.getEpisode()); + break; + case Season_Episode_Episode: + outputText.setText("Season: "+e.getSeason()+" Episode: "+e.getEpisode()+" - Episode: "+e.getEpisode_end()); + break; + case Season_Episode_Season_Episode: + outputText.setText("Season: "+e.getSeason()+" Episode: "+e.getEpisode()+" - Season: "+e.getSeason()+" Episode: "+e.getEpisode_end()); + break; + } + } }); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |