Navigation

    ask avan logo
    • Register
    • Login
    • Search
    • Categories
    • Unsolved
    • Solved
    1. Home
    2. MPG Radio
    • Profile
    • Following 1
    • Followers 0
    • Topics 8
    • Posts 20
    • Best 2
    • Groups 0

    MPG Radio

    @MPG Radio

    2
    Reputation
    2
    Profile views
    20
    Posts
    0
    Followers
    1
    Following
    Joined Last Online
    Website twitter.com/mpgradio

    MPG Radio Follow

    Best posts made by MPG Radio

    • RE: How to copy files from one directory and adding two supporting files into the copied directory/directories

      Thank you, so now I know how to include more than one file and not just the files in a directory when moving a directory to another directory.

      posted in PHP
      MPG Radio
      MPG Radio
    • RE: Adding an extention .txt to a saved file from checkbox selections

      That's so weird it works with this change..

      $name = time();
      $txtName = $name . ".txt";
      $myFile=fopen($txtName,"a");
      $txt = $VarCheck;
      fwrite($myFile,$txt);
      fclose($myFile);
      
      posted in PHP
      MPG Radio
      MPG Radio

    Latest posts made by MPG Radio

    • RE: Switch statement php

      Yes, a if statement sounds like the option, I think something like this....
      Here’s how I think I might approach it:

      // get the date in an easy to compare format: Jan 1st is 101, Dec 31st 1231
      $date = date('n') * 100 + date('j');

      if($date < 124) {
      $content = "between jan 1 and jan 23;
      } elseif($date < 215) {
      $content = "between jan 24 and feb 15";
      }

      // ... repeat for each grouping I want?

      posted in PHP
      MPG Radio
      MPG Radio
    • Switch statement php

      How would I say in this switch statement Pisces displays at X number of days in January and Aries at some other day in the same month? Dahnus is default for January and should disappear when replaced by the others on the specified days.

      There will be 24 months in this switch all having replacement switch definitions.

      <?php
      // date command to find out the day of the week
      $date = date('F');
      // our switch statement will assess which day of the week it is and
      // assign our $content as assigned.
      switch ($date) {
        case 'Jan':
          $content = "Dahnus";
      //$content = " Pisces";
      //$content = " Aries";
          break;
        case 'Feb':
          $content = "Aquarius";
      //$content = " Virgo";
      //$content = " Kanya";
      
          break;
        
      }
      
      // display our content regardless of day 
      echo $content;
      ?>
      posted in PHP
      MPG Radio
      MPG Radio
    • Exclude Text from the out put using printf

      I would like to exclude words from the output of printf, I think this is the correct way to go about it but the page breaks and data disappears, any suggestions thank you.

      function outputPlaylist($playlist) {
      	$entries = parse_m3u($playlist);
      	echo "<pre>\n";
      		$iDontWant1="imm/"
      		$iDontWant2="bla2"
      		$iDontWant3="bla3"
      	foreach($entries as $entry) {
      	
      		if($entry->Artist == $iDontWant1 || $entry->Artist == $iDontWant2 || $entry->Artist == $iDontWant3) continue; 	
      	
      	printf("\"%s\" by %s!\n", $entry['title'], $entry['artist']);
      	}
      	echo "</pre>";
      

      the expected output should be "British" by After Alice!
      not "British" by imm/After Alice!

      posted in PHP
      MPG Radio
      MPG Radio
    • RE: Create m3u playlist from a folder and place in directory

      When I manage to solve I would be happy to post an answer.

      posted in PHP
      MPG Radio
      MPG Radio
    • Create m3u playlist from a folder and place in directory

      In Linux how would we create an m3u playlist of mp3 files in a directory?

      In windows, we can say..use PHP and a bat file
      like so.

      <?php
          system("c:\WINDOWS\system32\cmd.exe /c C:\\ezstream\\PlaylistRefresh-imm.bat");    
          header('Location: playlists.php');
      ?>
      

      Then the bat file

      @echo off
      REM ***working directory***
      cd \ezstream\
       
      >nul chcp %ACP%
      dir imm /o:n /b *.mp3 *.flac > imm/Playlist.m3u
      
      

      This gives us a playlist from the mp3 in a folder called "imm"
      How would this be done in Linux as there is no bat file rather an exe or better yet in PHP to generate the list?

      posted in PHP
      MPG Radio
      MPG Radio
    • RE: Parsing m3u from single column to two equal columns

      got it going and works just fine with some minor adjustments to fit the application.
      demo

      function outputPlaylist($playlist) {
      	$entries = parse_m3u($playlist);
      	echo "<div class='row'>\n";
      		echo "<pre>\n";
      		$size = sizeof($entries);
              $size_half = ceil($size / 2);
              $counter = 0;
      			echo "<div class='row'>\n";
      				echo "<div class='column'>\n";
      	foreach($entries as $entry) {
      		// Check for half way point
                           if($counter++ == $size_half ){
                                   // Close column and open new one
      				echo "</div>\n";
                           }
      						printf ("%s\n", $entry['title'], $entry['artist'] );
      		
      	}
      	// Close column and row
      			echo "</div>\n";
      		echo "</pre>";
      	echo "</div>\n";
      }
      ?>
      
      posted in PHP
      MPG Radio
      MPG Radio
    • RE: Parsing m3u from single column to two equal columns

      like so...http://mpg.dnset.com/radio/cvshows/showlist.php
      "Chuck Vans Show 19.10.20"
      "Chuck Vans Show 19.10.7"
      "Chuck Vans Show 19.10.8"
      "Chuck Vans Show 19.11.1"
      "Chuck Vans Show 19.11.14"
      "Chuck Vans Show 19.11.21"
      "Chuck Vans Show 19.11.29"
      "Chuck Vans Show 19.12.15"
      "Chuck Vans Show 19.12.9"
      "Chuck Vans Show 19.6.18"
      "Chuck Vans Show 19.6.25"
      "Chuck Vans Show 19.7.2"
      "Chuck Vans Show 19.7.9"
      "Chuck Vans Show 19.9.26"
      "Chuck Vans Show 19.9.5"

      posted in PHP
      MPG Radio
      MPG Radio
    • Parsing m3u from single column to two equal columns

      To parse a m3u file in a single column we have this.

      Display the content..

      <?php
      	require("parseshow_m3u.php");
      ?>
      <?php outputPlaylist('/ezstream/cvshows/playlist.m3u');?>
      

      Parse the content..

      <?php
      
      function outputPlaylist($playlist) {
      	$entries = parse_m3u($playlist);
      	echo "<pre>\n";
      	foreach($entries as $entry) {
      		printf("\"%s\"\n", $entry['title'], $entry['artist']);
      		
      	}
      	echo "</pre>";
      }
      
      ?>
      

      How would we make two equal columns out of this by modifying <pre></pre> in a styled div?

      posted in PHP
      MPG Radio
      MPG Radio
    • RE: Adding an extention .txt to a saved file from checkbox selections

      That's so weird it works with this change..

      $name = time();
      $txtName = $name . ".txt";
      $myFile=fopen($txtName,"a");
      $txt = $VarCheck;
      fwrite($myFile,$txt);
      fclose($myFile);
      
      posted in PHP
      MPG Radio
      MPG Radio
    • Adding an extention .txt to a saved file from checkbox selections

      In menu we have a menu.txt file with times to select.

      <?php
      	echo '<form method="POST" action="process.php">';
      		$file = fopen("menu.txt","r");
      	echo '<table border="1">';
      		while(! feof($file))
      	{
      		$data= fgets($file);
      		if(trim($data) != '') {
      	echo '<tr>
      		<td><input type="checkbox" name="check[]" value="'.$data.'"></td>
      		<td>'.$data.'</td></tr>';
      	}
      		}
      		fclose($file);
      	echo '<input type="submit" value="send">';
      	echo '</form>';
      ?>
      

      In the process below we have a way to save those selections $myFile=fopen($name,"a"); but when including .txt in save $myfile=fopen($name . ".txt","a"); and saving as txt file the data does not save in the text file. The selections only save when we try not to add an extension in the code.

      <?php
      if(isset($_POST['check']) && ! empty($_POST['check']))  
      {
          $check=$_POST['check'];
          $numberOfCheck=count($check);
      		echo ("You have checked $numberOfCheck checkboxes : ");
      		//echo ("You have ordered $numberOfCheck itmes on the breakfast menu : ");
      			for ($i=0; $i<$numberOfCheck; $i++)  
      		{
      			echo '<br>';
      			echo ($check[$i]. " ");
      		$VarCheck=$check[$i];
              $name=time();
              **$myFile=fopen($name,"a");**
      		//$myfile=fopen($name.'.txt','a'); 		
      		//$myfile=fopen($name . ".txt","a");
      		$txt=$VarCheck;
      			fwrite($myFile,$txt);
      			fclose($myFile);    
      		}
      	}
      	else
      	{
      		echo "Zero check selected";
      	}
      ?>
      
      posted in PHP
      MPG Radio
      MPG Radio