* track request only if we get results, that way we can easily monitor if a certain webservice goes offline

This commit is contained in:
Reinhard Pointner 2011-11-06 04:51:42 +00:00
parent 3026ad53b8
commit 3f22e8ff07
3 changed files with 15 additions and 4 deletions

View File

@ -201,8 +201,10 @@ public class CmdlineOperations implements CmdlineInterface {
if (selectedSearchResult != null) {
CLILogger.fine(format("Fetching episode data for [%s]", selectedSearchResult.getName()));
List<Episode> episodes = db.getEpisodeList(selectedSearchResult, locale);
Analytics.trackEvent(db.getName(), "FetchEpisodeList", selectedSearchResult.getName());
return db.getEpisodeList(selectedSearchResult, locale);
return episodes;
}
}

View File

@ -15,6 +15,7 @@ import java.io.IOException;
import java.net.URI;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import javax.swing.AbstractAction;
@ -24,6 +25,7 @@ import javax.swing.JComponent;
import javax.swing.JSpinner;
import javax.swing.KeyStroke;
import net.sourceforge.filebot.Analytics;
import net.sourceforge.filebot.Settings;
import net.sourceforge.filebot.WebServices;
import net.sourceforge.filebot.ui.AbstractSearchPanel;
@ -224,10 +226,15 @@ public class EpisodeListPanel extends AbstractSearchPanel<EpisodeListProvider, E
@Override
public Collection<Episode> fetch() throws Exception {
List<Episode> episodes;
if (request.getSeason() != ALL_SEASONS)
return request.getProvider().getEpisodeList(getSearchResult(), request.getSeason(), request.getLanguage());
episodes = request.getProvider().getEpisodeList(getSearchResult(), request.getSeason(), request.getLanguage());
else
return request.getProvider().getEpisodeList(getSearchResult(), request.getLanguage());
episodes = request.getProvider().getEpisodeList(getSearchResult(), request.getLanguage());
Analytics.trackEvent(request.getProvider().getName(), "ViewEpisodeList", getSearchResult().getName());
return episodes;
}

View File

@ -130,8 +130,10 @@ class EpisodeListMatcher implements AutoCompleteMatcher {
SearchResult selectedSearchResult = selectSearchResult(query, results);
if (selectedSearchResult != null) {
List<Episode> episodes = provider.getEpisodeList(selectedSearchResult, locale);
Analytics.trackEvent(provider.getName(), "FetchEpisodeList", selectedSearchResult.getName());
return provider.getEpisodeList(selectedSearchResult, locale);
return episodes;
}
}