Package unify.data

Examples of unify.data.Season


        try {
          int seasonNum = (Integer.parseInt(showLine.split(" :: ")[1]));
          int episodeNum = (Integer.parseInt(showLine.split(" :: ")[2]));
          String link = showLine.split(" :: ")[3];
          String label = showLine.split(" :: ")[4];
          Season season = show.findSeason(seasonNum);
          if(season==null) {
            season = show.addSeason(seasonNum);
          }
          season.addEpisode(episodeNum, link, label);
        } catch (NumberFormatException e) {
          LOGGER.severe("Invalid number format for " + showLine.split(" :: ")[1]
              + " or " + showLine.split(" :: ")[2]);
          System.exit(1);
        }
View Full Code Here


    }
    if(show==null) {
      show = new Show(title);
      rssShows.add(show);
    }
    Season season = show.findSeason(seasonInt);
    if(season==null) {
      season = show.addSeason(seasonInt);
    }
    season.addEpisode(episodeInt, link, myFeed.getLabel());
  }
View Full Code Here

  }

  private void createMenu(Menu menu, ArrayList<Show> shows) {
    for(int i=0;i<shows.size();i++) {
      Show show = shows.get(i);
      Season season = show.getSeason();
      for(Episode episode : season.getEpisodes()) {
        final Menu showMenu = new Menu(show.getTitle() + " (" + season.getNumber() + "x" + episode.getNumber() + ")");
        menu.add(showMenu);
        final MenuItem linkItem = new MenuItem(episode.getLinkLabel());       
        final URI myURL = URI.create(episode.getLink());
        linkItem.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              Desktop.getDesktop().browse(myURL);
            } catch (IOException e1) {
              LOGGER.warning("IO error " + e1.toString());
            }
          }
        });
        showMenu.add(linkItem);

        addSearchItems(showMenu, season.formatSeasonEp(episode.getNumber()), show.getTitle());
      }
    }
  }
View Full Code Here

    for(int i=0;i<ShowLibrary.getInstance().newShows.size();i++) {
      final Show show = ShowLibrary.getInstance().newShows.get(i);
      final String title = show.getTitle();
      final Menu showMenu = new Menu(title);
      newShows.add(showMenu);
      final Season season = show.getSeason();
      final Episode episode = season.getEpisode();
      String linkLabel = episode.getLinkLabel();
      String link = episode.getLink();
      //Add menu items add, remove, and link
      final MenuItem addItem = new MenuItem("Move to Shows");
      final MenuItem removeItem = new MenuItem("Remove & Ignore");
      final MenuItem linkItem = new MenuItem(linkLabel);
      showMenu.add(addItem);
      showMenu.add(removeItem);
      showMenu.add(linkItem);

      //Add menu item functionality
      addItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          Show newShow = ShowLibrary.getInstance().addShow(show);
          Season season = newShow.addSeason(1);
          Episode episode = show.findSeason(1).findEpisode(1);
          season.addEpisode(1, episode.getLink(), episode.getLinkLabel());
          ShowLibrary.getInstance().newShows.remove(show);
          ShowLibrary.getInstance().doUpdates();
          GUI.getInstance().refresh();
        }
      });
View Full Code Here

                }
              });
            }

            //Remove menu item functionality
            final Season season = mySeason;
            final Episode episode = myEpisode;
            remove.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                int result = JOptionPane.showConfirmDialog(null,"Are you sure you want to remove " + title + " season " + mySeasonNum + " episode " + myEpisodeNum, "Remove Episode?", JOptionPane.YES_NO_OPTION);
                if(result==0) {
                  season.removeEpisode(episode);
                  LOGGER.fine("Removed episode " + episode.getNumber() + " from " + title);
                  if (season.getEpisodes().size()==0) {
                    Show show = ShowLibrary.getInstance().getShow(title);
                    show.removeSeason(season);
                    LOGGER.fine("Season " + season.getNumber() + " of " + title + " is removed because it was empty.");
                  }
                  showLib.doUpdates();
                }
              }
            });
View Full Code Here

      Show rssShow = rssShows.get(i);
      Show show = getShow(rssShow.getTitle());
      if(show!=null) {
        for(Season rssSeason : rssShow.seasons) {
          int seasonInt = rssSeason.getNumber();
          Season season = show.findSeason(seasonInt);
          if(show.getCurSeason()<=seasonInt) {
            if(show.getCurSeason()<seasonInt) {
              season = show.addSeason(seasonInt);
              show.setLastEpisode(0);
              LOGGER.info("Found new season (" + seasonInt + ") of " + show.getTitle());
              show.setCurSeason(seasonInt);
            }
            for(Episode rssEpisode : rssSeason.getEpisodes()) {
              int episodeInt = rssEpisode.getNumber();
              Episode episode = null;
              if(season!=null) {
                episode = season.findEpisode(episodeInt);
              }
              if(show.getLastEpisode()<episodeInt && episode==null) {
                if(season==null) {
                  season = show.addSeason(seasonInt);
                }
                for(int m=show.getLastEpisode()+1;m<episodeInt;m++) {
                  LOGGER.info("Found new episode (" + m + ") of " + show.getTitle() + " in season " + seasonInt);
                  season.addEpisode(m, " ", " ");
                  pendingNotice(show.getTitle() + " (" + seasonInt + "x" + m + ") is now available.");              
                }
                LOGGER.info("Found new episode (" + episodeInt + ") of " + show.getTitle() + " in season " + seasonInt);
                season.addEpisode(episodeInt, rssEpisode.getLink(), rssEpisode.getLinkLabel());
                pendingNotice(show.getTitle() + " (" + seasonInt + "x" + episodeInt + ") is now available.");
                show.setLastEpisode(episodeInt);
              }
              if(episode!=null) {
                int newPriority = Settings.getInstance().getFeedPriority(rssEpisode.getLinkLabel());
View Full Code Here

  private void checkNewShows(ArrayList<Show> rssShows) {
    for(int i=0;i<rssShows.size();i++) {
      Show rssShow = rssShows.get(i);
      if(getShow(this.shows, rssShow.getTitle())==null && getShow(this.newShows, rssShow.getTitle())==null && getShow(this.ignoredShows, rssShow.getTitle())==null) {
        Season season = rssShow.getSeason();
        Episode episode = season.getEpisode();
        if(season.getNumber()==1 && episode.getNumber() == 1) {
          Show show = new Show(rssShow.getTitle());
          Season newSeason = show.addSeason(1);
          newSeason.addEpisode(1, episode.getLink(), episode.getLinkLabel());
          show.setCurSeason(1);
          show.setLastEpisode(1);
          this.newShows.add(show);
          this.ignoredShows.add(show);
          LOGGER.info("Found new show: " + show.getTitle());
View Full Code Here

TOP

Related Classes of unify.data.Season

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.