songinfo.m 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*---------------------------------------------------
  2. -----------------------------------------------------
  3. Filename: songinfo.m
  4. Version: 1.0
  5. Type: maki/songinfo loading
  6. Date: 09. Sept. 2008 - 10:02
  7. Author: Martin Poehlmann aka Deimos
  8. E-Mail: [email protected]
  9. Internet: www.skinconsortium.com
  10. -----------------------------------------------------
  11. ---------------------------------------------------*/
  12. /**
  13. * This library is still in testing phase
  14. */
  15. #ifndef included
  16. #error This script can only be compiled as a #include
  17. #endif
  18. // use this function to reload songinfo (usually do this on system.onTitleChange())
  19. Function songinfo_reload();
  20. // use this vars to get song information (is faster than function calls)
  21. Global String songinfo_title;
  22. Global String songinfo_artist;
  23. Global String songinfo_album;
  24. Global String songinfo_location; // url or path on your hd
  25. Global String songinfo_displayTitle;
  26. Global String songinfo_streamTitle; // similar to display title
  27. Global String songinfo_streamName; // name of current stream (station title)
  28. Global String songinfo_streamURL;
  29. Global String songinfo_streamAlbumArt; // _full_ URL to an image on the web, like http://images.play.it/amg/album/cov200/drh200/h238/h23853pph7b.jpg
  30. Global Boolean songinfo_isStream; // true if current song is a stream
  31. Global Int songinfo_streamType; // use in conjunction with the values below
  32. #define SONGINFO_STREAMTYPE_SHOUTCAST 2
  33. #define SONGINFO_STREAMTYPE_AOLRADIO 3
  34. #define SONGINFO_STREAMTYPE_CBSRADIO 4
  35. #define SONGINFO_STREAMTYPE_SHOUTCAST2 5
  36. #define SONGINFO_STREAMTYPE_NOSTREAM 0
  37. #define SONGINFO_STREAMTYPE_UNKNOWN 666
  38. /////////////////////////////////////
  39. // IMPLEMENTATION // DO NOT MODIFY //
  40. /////////////////////////////////////
  41. songinfo_reload()
  42. {
  43. // Fill vars with data
  44. songinfo_location = System.getPlayItemString();
  45. songinfo_displayTitle = System.getPlayItemDisplayTitle();
  46. String metaPrefix = ""; // used for streams
  47. // Check for a stream
  48. songinfo_streamType = stringToInteger(getPlayItemMetaDataString("streamtype"));
  49. songinfo_isStream = (songinfo_streamType > 0);
  50. if (songinfo_isStream) // STREAM!
  51. {
  52. if (!(songinfo_streamType == SONGINFO_STREAMTYPE_SHOUTCAST
  53. || songinfo_streamType == SONGINFO_STREAMTYPE_AOLRADIO
  54. || songinfo_streamType == SONGINFO_STREAMTYPE_CBSRADIO
  55. || songinfo_streamType == SONGINFO_STREAMTYPE_SHOUTCAST2))
  56. {
  57. songinfo_streamType = SONGINFO_STREAMTYPE_UNKNOWN;
  58. }
  59. // read stream metadata
  60. songinfo_streamName = getPlayItemMetaDataString("streamname");
  61. songinfo_streamTitle = getPlayItemMetaDataString("streamtitle");
  62. songinfo_streamURL = getPlayItemMetaDataString("streamurl");
  63. if (songinfo_streamType == SONGINFO_STREAMTYPE_AOLRADIO)
  64. {
  65. metaPrefix = "uvox/";
  66. }
  67. else if (songinfo_streamType == SONGINFO_STREAMTYPE_CBSRADIO)
  68. {
  69. metaPrefix = "cbs/";
  70. }
  71. songinfo_streamAlbumArt = getPlayItemMetaDataString(metaPrefix + "albumart");
  72. if (songinfo_streamType == SONGINFO_STREAMTYPE_AOLRADIO)
  73. {
  74. songinfo_streamAlbumArt = "http://broadband-albumart.music.aol.com/scan/" + songinfo_streamAlbumArt;
  75. }
  76. }
  77. else //NO STREAM!
  78. {
  79. // resetting stream specific values
  80. songinfo_streamName = "";
  81. songinfo_streamTitle = "";
  82. songinfo_streamURL = "";
  83. songinfo_streamAlbumArt = "";
  84. }
  85. songinfo_title = getPlayItemMetaDataString(metaPrefix + "title");
  86. songinfo_artist = getPlayItemMetaDataString(metaPrefix + "artist");
  87. songinfo_album = getPlayItemMetaDataString(metaPrefix + "album");
  88. }