Guest User

Untitled

a guest
May 25th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. package javacogs;
  2.  
  3. import java.io.*;
  4.  
  5. import javax.xml.parsers.ParserConfigurationException;
  6.  
  7. import org.blinkenlights.jid3.*;
  8. import org.blinkenlights.jid3.v1.*;
  9. import org.w3c.dom.*;
  10. import org.xml.sax.SAXException;
  11.  
  12. import discogs.DiscogsService;
  13.  
  14. public class Application {
  15.  
  16. public static void main(String[] args) {
  17. if (args.length == 3) {
  18. File file = new File(args[2]);
  19.  
  20. if (!file.isFile()) {
  21. System.out.println("Filen findes ikke!");
  22. Runtime.getRuntime().exit(1);
  23. } else if (!file.toString().substring(file.toString().length() - 3).equals("mp3")) {
  24. System.out.println("Filen skal være en MP3-fil!");
  25. Runtime.getRuntime().exit(2);
  26. }
  27.  
  28. DiscogsService discogs = new DiscogsService("41c7159d3c");
  29. Document release = null;
  30. try {
  31. release = discogs.getRelease(Integer.parseInt(args[0]));
  32. } catch (NumberFormatException e) {
  33. System.out.println("Release id'et skal være et heltal!");
  34. Runtime.getRuntime().exit(3);
  35. } catch (ParserConfigurationException e) {
  36. System.out.println("Der opstod en fatal konfigurationsfejl!");
  37. Runtime.getRuntime().exit(4);
  38. } catch (IOException e) {
  39. System.out.println("Der opstod en fejl under hentning af data!");
  40. Runtime.getRuntime().exit(5);
  41. } catch (SAXException e) {
  42. System.out.println("Der opstod en fejl under parsing af hentet data!");
  43. Runtime.getRuntime().exit(6);
  44. }
  45.  
  46. MediaFile mediaFile = new MP3File(file);
  47. ID3V1_0Tag id3Tag = new ID3V1_0Tag();
  48.  
  49. System.out.println(release.getNodeName());
  50.  
  51. } else {
  52. System.out.println("Anvendelse: java javacogs.jar <discogs release id> <nummer position> <fil>");
  53. System.out.println("Discogs release id kan findes på discogs.com ved, at gå ind på en udgivelse og se efter en række tal i URL'en, som er id'et.");
  54. }
  55. }
  56.  
  57. }
Add Comment
Please, Sign In to add comment