Package util.exc

Examples of util.exc.TvBrowserException


        if (conn.getResponseCode() == 200) {
          modifiedDates.add(testDay);
        }
        mLog.info("mInternalChannel.lastModified=" + internalChannel.getLastUpdate(testDay));
      } catch (Exception e) {
        throw new TvBrowserException(SweDBTvDataService.class,
                "An error occurred in updateTvData",
                "Please report this to the developer", e);
      }
    } // int b
    mLog.info("Number of modified days for channel " + internalChannel.getName() + ":" + modifiedDates.size());
    monitor.setMessage(mLocalizer.msg("updateTvData.progressmessage.20",
            "{0}: Retrieving updated/new programs.", channel.getName()));

    /*********************************************************************
     * IF we found any modified/missing data, we have to download the
     * files before and after each date, since the XMLTV-data files are
     * split in UTC-time while provider is in a different timezone. This
     * procedure ensures that we get all of the data. (There is a small
     * risk that we miss updated data, since we do not verify if the files
     * before and after the actual date has been modified - but we do not
     * care for now)
     ********************************************************************/
    if (modifiedDates.size() > 0) {
      Date prevDate;
      Date currDate;

      Hashtable<String, Date> fileDates = new Hashtable<String, Date>();
      prevDate = new Date((modifiedDates.get(0)).addDays(-1));
      fileDates.put(prevDate.getDateString(), prevDate);
      for (Date modifiedDate : modifiedDates) {
        currDate = modifiedDate;
        if (currDate.equals(prevDate.addDays(1))) {
          if (!fileDates.containsKey(currDate.getDateString())) {
            fileDates.put(currDate.getDateString(), currDate);
          }
        } else {
          Date tempDate = new Date(prevDate.addDays(1));
          if (!fileDates.containsKey(tempDate.getDateString())) {
            fileDates.put(tempDate.getDateString(), tempDate);
          }
          tempDate = new Date(currDate.addDays(-1));
          if (!fileDates.containsKey(tempDate.getDateString())) {
            fileDates.put(tempDate.getDateString(), tempDate);
          }
          if (!fileDates.containsKey(currDate.getDateString())) {
            fileDates.put(currDate.getDateString(), currDate);
          }

        }
        prevDate = currDate;
      }// for j
      currDate = new Date(prevDate.addDays(1));
      if (!fileDates.containsKey(currDate.getDateString())) {
        fileDates.put(currDate.getDateString(), currDate);
      }
      mLog.info(currDate.getDateString());

      /*******************************************************************
       * OK... So now we are ready to start parsing the selected data
       * files
       ******************************************************************/
      Hashtable<String, MutableChannelDayProgram> dataHashtable = new Hashtable<String, MutableChannelDayProgram>();
      Enumeration<Date> en = fileDates.elements();
      monitor.setMessage(mLocalizer.msg(
              "updateTvData.progressmessage.30", "{0}: Reading datafiles",
              channel.getName()));
      while (en.hasMoreElements()) {
        try {
          Date date = (en.nextElement());
          String strFileDate = createFileName(date);
          mLog.info("getting: " + internalChannel.getBaseUrl()
                  + internalChannel.getId() + "_" + strFileDate
                  + ".xml.gz");
          URL url = new URL(internalChannel.getBaseUrl()
                  + internalChannel.getId() + "_" + strFileDate
                  + ".xml.gz");
          HttpURLConnection con = (HttpURLConnection) url
                  .openConnection();
          con.setReadTimeout(Plugin.getPluginManager()
                  .getTvBrowserSettings()
                  .getDefaultNetworkConnectionTimeout());

          if (con.getResponseCode() == 200) {
            DataHydraDayParser.parseNew(IOUtilities.openSaveGZipInputStream(con
                    .getInputStream()), channel, date, dataHashtable, service);
            if (modifiedDates.contains(date)) {
              mLog.info("Updating lastUpdate property for date "
                      + date.toString());
              internalChannel.setLastUpdate(date, con
                      .getLastModified());
            }
          }
        } catch (Exception e) {
          throw new TvBrowserException(SweDBTvDataService.class,
                  "An error occurred in updateTvData",
                  "Please report this to the developer", e);
        }
      }
      mLog.info("All of the files have been parsed");
View Full Code Here


      monitor.setMessage(mLocalizer.msg("done", "Done with Radio Times data"));

      return channels.toArray(new Channel[channels.size()]);
    } catch (Exception e) {
      throw new TvBrowserException(getClass(), "error.1", "Downloading Channellist failed", e);
    }
  }
View Full Code Here

        monitor.setValue(i);
        RadioTimesFileParser parser = new RadioTimesFileParser(channelArr[i]);
        parser.parse(updateManager, endDate);
      }
    } catch (Exception e) {
      throw new TvBrowserException(getClass(), "error.2", "Downloading Data failed", e);
    }
    monitor.setMessage("");
  }
View Full Code Here

     
      // Tell the database updater that this file needs an update
      mUpdater.addUpdateJobForDayProgramFile(completeFileName);
    }
    catch (Exception exc) {
      throw new TvBrowserException(getClass(), "error.1",
        "Updating dayprogram file failed: {0}", completeFile.getAbsolutePath(),
        exc);
    }
    finally {
      mDataService.checkCancelDownload();
View Full Code Here

     
      // Tell the database updater that this file needs an update
      mUpdater.addUpdateJobForDayProgramFile(job.getFileName());
    }
    catch (Exception exc) {
      throw new TvBrowserException(getClass(), "error.1",
        "Saving dayprogram file failed: {0}", completeFile.getAbsolutePath(),
        exc);
    }
    finally {
      mDataService.checkCancelDownload();
View Full Code Here

          url = DEFAULT_CHANNEL_GROUPS_URL;
          IOUtilities.download(new URL(url + (url.endsWith("/") ? "" : "/") + CHANNEL_GROUPS_FILENAME), new File(mDataDir, CHANNEL_GROUPS_FILENAME));
        }
        mGroupFileWasLoaded = true;
      } catch (MalformedURLException e) {
        throw new TvBrowserException(TvBrowserDataService.class, "invalidURL", "Invalid URL: {0}", url, e);
      } catch (IOException e) {
        throw new TvBrowserException(TvBrowserDataService.class, "downloadGroupFileFailed","Could not download group file {0}", url, e);
      }
    }
  }
View Full Code Here

      String url = serverUrl + "/" + metaFileName;
      mLog.fine("Updating Metafile " + url);
      try {
        IOUtilities.download(new URL(url), file);
      } catch (IOException exc) {
        throw new TvBrowserException(getClass(), "error.1", "Downloading file from '{0}' to '{1}' failed", url, file
                .getAbsolutePath(), exc);
      }
    }
  }
View Full Code Here

          file.renameTo(oldFile);
          // Invalidate the channel list
          mAvailableChannelArr = null;
        }
      } catch (Exception exc) {
        throw new TvBrowserException(getClass(), "error.4", "Server has no channel list: {0}", mirror.getUrl(), exc);
      }
    }
  }
View Full Code Here

      int month = Integer.parseInt(fileName.substring(5, 7));
      int day = Integer.parseInt(fileName.substring(8, 10));
      return new Date(year, month, day);
    }
    catch (Exception exc) {
      throw new TvBrowserException(DayProgramFile.class, "error.1",
        "Program file name has wrong syntax: {0}", fileName, exc);
    }
  }
View Full Code Here

      // E.g. '2003-10-04_de_premiere-1_base_update_15.prog.gz'
      //   or '2003-10-04_de_premiere-1_base_full.prog.gz'
      return fileName.substring(11, 13);
    }
    catch (Exception exc) {
      throw new TvBrowserException(DayProgramFile.class, "error.1",
        "Program file name has wrong syntax: {0}", fileName, exc);
    }
  }
View Full Code Here

TOP

Related Classes of util.exc.TvBrowserException

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.