PageRenderTime 47ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/services/services/playlist/ram.php

https://github.com/jinzora/jinzora3
PHP | 122 lines | 52 code | 15 blank | 55 comment | 5 complexity | aa7d2ca2fc94da3bd73748b5b8b6ad17 MD5 | raw file
  1. <?php if (!defined(JZ_SECURE_ACCESS)) die ('Security breach detected.');
  2. /**
  3. * - JINZORA | Web-based Media Streamer -
  4. *
  5. * Jinzora is a Web-based media streamer, primarily desgined to stream MP3s
  6. * (but can be used for any media file that can stream from HTTP).
  7. * Jinzora can be integrated into a CMS site, run as a standalone application,
  8. * or integrated into any PHP website. It is released under the GNU GPL.
  9. *
  10. * - Resources -
  11. * - Jinzora Author: Ross Carlson <ross@jasbone.com>
  12. * - Web: http://www.jinzora.org
  13. * - Documentation: http://www.jinzora.org/docs
  14. * - Support: http://www.jinzora.org/forum
  15. * - Downloads: http://www.jinzora.org/downloads
  16. * - License: GNU GPL <http://www.gnu.org/copyleft/gpl.html>
  17. *
  18. * - Contributors -
  19. * Please see http://www.jinzora.org/team.html
  20. *
  21. * - Code Purpose -
  22. * - Creates an RAM compliant playlist
  23. *
  24. * @since 02.17.05
  25. * @author Ben Dodson <ben@jinzora.org>
  26. * @author Ross Carlson <ross@jinzora.org>
  27. */
  28. /**
  29. * Returns the mime type for this playlist
  30. *
  31. * @author Ross Carlson
  32. * @version 2/24/05
  33. * @since 2/24/05
  34. * @param $return Returns the playlist mime type
  35. */
  36. function SERVICE_RETURN_MIME_RAM(){
  37. return "audio/x-pn-realaudio";
  38. }
  39. /**
  40. * Creates an RAM compliant playlist and returns it for playing
  41. *
  42. * @author Ross Carlson
  43. * @version 2/24/05
  44. * @since 2/24/05
  45. * @param $list The list of tracks to use when making the playlist
  46. * @param $return Returns the porperly formated list
  47. */
  48. function SERVICE_CREATE_PLAYLIST_RAM($list){
  49. global $allow_resample, $this_site, $root_dir, $web_root;
  50. // Let's start the list off right
  51. $content = "";
  52. $list->flatten();
  53. // Let's setup Smarty
  54. $smarty = smartySetup();
  55. // Let's start the list off right
  56. $list->flatten();
  57. $i=0;
  58. foreach ($list->getList() as $track) {
  59. // Should we play this?
  60. if ((stristr($track->getPath("String"),".lofi.")
  61. or stristr($track->getPath("String"),".clip."))
  62. and $_SESSION['jz_play_all_tracks'] <> true){continue;}
  63. // Let's get the meta
  64. $meta = $track->getMeta();
  65. // Now let's figure out the full track name
  66. $trackn = $track->getFileName("user");
  67. if (!stristr($trackn,"mediabroadcast.php")) {
  68. $track->increasePlayCount();
  69. }
  70. $tArr[$i]['link'] = $trackn;
  71. $tArr[$i]['artist'] = $meta['artist'];
  72. $tArr[$i]['album'] = $meta['album'];
  73. $tArr[$i]['genre'] = $meta['genre'];
  74. $tArr[$i]['track'] = $meta['title'];
  75. $tArr[$i]['length'] = $meta['length'];
  76. $tArr[$i]['year'] = $meta['year'];
  77. $tArr[$i]['i'] = ($i + 1);
  78. $i++;
  79. }
  80. unset($_SESSION['jz_play_all_tracks']);
  81. $smarty->assign('this_site', $this_site);
  82. $smarty->assign('root_dir', $root_dir);
  83. $smarty->assign('tracks', $tArr);
  84. $smarty->assign('total', count($tArr));
  85. // Now let's include the template
  86. $smarty->display(SMARTY_ROOT. 'templates/playlists/ram.tpl');
  87. return;
  88. // Now let's loop throught the items to create the list
  89. foreach ($list->getList() as $track) {
  90. // Should we play this?
  91. if ((stristr($track->getPath("String"),".lofi.")
  92. or stristr($track->getPath("String"),".clip."))
  93. and $_SESSION['jz_play_all_tracks'] <> true){continue;}
  94. $meta = $track->getMeta();
  95. // Now let's figure out the full track name
  96. $trackn = $track->getFileName("user");
  97. if (!stristr($trackn,"mediabroadcast.php")) {
  98. $track->increasePlayCount();
  99. }
  100. // Now let's set the URL
  101. $content .= $trackn. '&clipinfo="title='. $meta['title']. '|artist name='.$meta['artist']. '|album name='. $meta['album']. '|genre='. $meta['genre']. '|year='. $meta['year']. '"&mode=normal'. "\n";
  102. }
  103. unset($_SESSION['jz_play_all_tracks']);
  104. // Now let's return
  105. return $content;
  106. }
  107. ?>