Wireless MP3 downloader...

Discussion in 'iOS Jailbreak & Cydia' started by KrakaJap, May 17, 2008.

  1. KrakaJap

    KrakaJap New Member

    Joined:
    Oct 18, 2007
    Messages:
    33
    Likes Received:
    0
    I'm working on a php script that will allow me (or anyone on the same net) download music straight from my iPod through a web browser. After installing Apache and PHP this seemed like an incredibly easy project; however, I've hit a brick wall when I go to open the iTunes_Control folder... it doesn't matter what permissions I add to that directory, the sub-directories, or the parent directories, I keep getting a permission denied error.

    NOTE: I'm working on this simple little script because this is all I need... a simple way to list all of my music while reading the ID3 tags of each song and displaying the title and artist instead of the cryptic iPod naming scheme.

    This script works fine on a desktop... just not the iPod... any ideas?

    PHP Code:
    Code:
    <?php
    	function find_files($path, $pattern, $callback) {
    		$path = rtrim(str_replace("\\", "/", $path), '/') . '/';
    		$matches = Array();
    		$entries = Array();
    		$dir = dir($path);
    		while (false !== ($entry = $dir->read())) {
    			$entries[] = $entry;
    		}
    		$dir->close();
    		foreach ($entries as $entry) {
    			$fullname = $path . $entry;
    			if ($entry != '.' && $entry != '..' && is_dir($fullname)) {
    				find_files($fullname, $pattern, $callback);
    			} else if (is_file($fullname) && preg_match($pattern, $entry)) {
    				call_user_func($callback, $fullname);
    			}
    		}
    	}
    
    	function my_handler($filename) {
    		$id = filesize($filename) - 128;
    		$fp = fopen($filename, "r");
    		fseek($fp, $id);
    		$tag = fread($fp, 3);
    		if ($tag == "TAG") {
    			$title = rtrim(fread($fp, 30));
    			$artist = rtrim(fread($fp, 30));
    			fclose($fp);
    		}
    		echo "<a href='$filename'>$artist - $title<br />";
    	}
    
    	find_files('/private/var/mobile/Media/iTunes_Control/Music', '/mp3/', 'my_handler');
    ?>
    
    As I stated before, on a normal desktop this works perfectly... so I'm going to assume this either as something to do with permissions, virtual directories, or limitations of the PHP version for the iPod (touch).

    The errors I receive in Safari are:
  2. drkassassin

    drkassassin New Member

    Joined:
    Dec 14, 2007
    Messages:
    1,251
    Likes Received:
    26
    Device:
    2G iPod touch
    if i were you i would post this in application development
    you will get many educated responses
  3. KrakaJap

    KrakaJap New Member

    Joined:
    Oct 18, 2007
    Messages:
    33
    Likes Received:
    0
    Are you referring to application ideas? That's where I posted this first and they recommended I post here instead. I can't seem to find an "Application Development" section... unless you're talking about Web Development.
  4. optimo

    optimo New Member

    Joined:
    Sep 28, 2007
    Messages:
    535
    Likes Received:
    17
    I didn't recommend you to post it here. I did suggest you read up on the already-started Apache/PHP threads if you want some tips. Hopefully you are familiar with the search feature, since you are new here.

    Please Register or Log in to view images



    Either way, you should create a more descriptive title for this topic; mention that you need help with php and apache permissions. You will get more responses this way -- probably why you didnt get many replies in the Dev forum.
  5. KrakaJap

    KrakaJap New Member

    Joined:
    Oct 18, 2007
    Messages:
    33
    Likes Received:
    0
    This is the right place for Apache/PHP questions though right? I guess my topic is a little vague.

    Please Register or Log in to view images



    I don't suppose I have the option of changing the topic do I?

Share This Page