diff options
author | Paul 'flowerysong' Arthur <flowerysong00@yahoo.com> | 2010-03-14 20:14:52 +0000 |
---|---|---|
committer | Paul 'flowerysong' Arthur <flowerysong00@yahoo.com> | 2010-03-14 20:14:52 +0000 |
commit | 1cb0983ed04c65e06d502ae2ac9ed6d5e31d70dc (patch) | |
tree | 54655ff3e692a71a17f1d37cd97374b263557ca1 /modules/php_musicbrainz | |
parent | ef48bf3fbdca2a4d25f5d025f4c6ad23905e5369 (diff) | |
download | ampache-1cb0983ed04c65e06d502ae2ac9ed6d5e31d70dc.tar.gz ampache-1cb0983ed04c65e06d502ae2ac9ed6d5e31d70dc.tar.bz2 ampache-1cb0983ed04c65e06d502ae2ac9ed6d5e31d70dc.zip |
Cosmetics: remove trailing whitespace
Diffstat (limited to 'modules/php_musicbrainz')
-rw-r--r-- | modules/php_musicbrainz/mbArtist.php | 4 | ||||
-rw-r--r-- | modules/php_musicbrainz/mbArtistAlias.php | 2 | ||||
-rw-r--r-- | modules/php_musicbrainz/mbDisc.php | 6 | ||||
-rw-r--r-- | modules/php_musicbrainz/mbEntity.php | 2 | ||||
-rw-r--r-- | modules/php_musicbrainz/mbFilter.php | 18 | ||||
-rw-r--r-- | modules/php_musicbrainz/mbLabel.php | 2 | ||||
-rw-r--r-- | modules/php_musicbrainz/mbMetadata.php | 4 | ||||
-rw-r--r-- | modules/php_musicbrainz/mbQuery.php | 18 | ||||
-rw-r--r-- | modules/php_musicbrainz/mbRelation.php | 4 | ||||
-rw-r--r-- | modules/php_musicbrainz/mbRelease.php | 4 | ||||
-rw-r--r-- | modules/php_musicbrainz/mbReleaseEvent.php | 2 | ||||
-rw-r--r-- | modules/php_musicbrainz/mbUser.php | 14 | ||||
-rw-r--r-- | modules/php_musicbrainz/mbUtil.php | 6 | ||||
-rw-r--r-- | modules/php_musicbrainz/mbUtil_countrynames.php | 2 | ||||
-rw-r--r-- | modules/php_musicbrainz/mbUtil_languagenames.php | 2 | ||||
-rw-r--r-- | modules/php_musicbrainz/mbUtil_releasetypenames.php | 2 | ||||
-rw-r--r-- | modules/php_musicbrainz/mbWebService.php | 24 | ||||
-rw-r--r-- | modules/php_musicbrainz/mbXmlParser.php | 40 | ||||
-rw-r--r-- | modules/php_musicbrainz/xml/xmlParser.php | 12 |
19 files changed, 84 insertions, 84 deletions
diff --git a/modules/php_musicbrainz/mbArtist.php b/modules/php_musicbrainz/mbArtist.php index 7ba126b0..972ca311 100644 --- a/modules/php_musicbrainz/mbArtist.php +++ b/modules/php_musicbrainz/mbArtist.php @@ -14,7 +14,7 @@ private $releasesCount = 0; private $releasesOffset = 0; private $aliases = array(); - + function mbArtist( $id = '', $type = '', $name = '', $sortName = '' ) { parent::MusicBrainzEntity($id); $this->type = $type; @@ -102,7 +102,7 @@ if ( empty( $rresults ) ) return ""; - + $keys = array(); foreach ( $rresults as $key => $rr ) { $rr = $rr->getRelease(); diff --git a/modules/php_musicbrainz/mbArtistAlias.php b/modules/php_musicbrainz/mbArtistAlias.php index c7e7e95d..3b65fcb6 100644 --- a/modules/php_musicbrainz/mbArtistAlias.php +++ b/modules/php_musicbrainz/mbArtistAlias.php @@ -4,7 +4,7 @@ private $value; private $type; private $script; - + function mbAristAlias( $value='', $type='', $script='' ) { $this->value = $value; $this->type = $type; diff --git a/modules/php_musicbrainz/mbDisc.php b/modules/php_musicbrainz/mbDisc.php index 63087016..90dacc06 100644 --- a/modules/php_musicbrainz/mbDisc.php +++ b/modules/php_musicbrainz/mbDisc.php @@ -1,7 +1,7 @@ <?php /* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */ class mbDiscError extends Exception { } - + class mbDisc { private $id; private $sectors = 0; @@ -22,7 +22,7 @@ function getLastTrackNum ( ) { return $this->lastTrackNum; } function setFirstTrackNum( $track ) { $this->firstTrackNum = $track; } function getFirstTrackNum( ) { return $this->firstTrackNum; } - + function &getTracks() { return $this->tracks; } @@ -46,7 +46,7 @@ foreach ( $disc->getTracks() as $track ) $toc .= '+' . $track[0]; - return "http://" . $netloc . "/bare/cdlookup.html?id=" . $disc->getId() . "&toc=" . $toc . + return "http://" . $netloc . "/bare/cdlookup.html?id=" . $disc->getId() . "&toc=" . $toc . "&tracks=" . $disc->getLastTrackNum(); } } diff --git a/modules/php_musicbrainz/mbEntity.php b/modules/php_musicbrainz/mbEntity.php index 47089279..86cfdc07 100644 --- a/modules/php_musicbrainz/mbEntity.php +++ b/modules/php_musicbrainz/mbEntity.php @@ -21,7 +21,7 @@ function &getRelations( $target_type='', $relation_type='' ) { if ( $target_type == '' && $relation_type == '' ) return $this->relations; - + $result = array(); if ( empty($target_type) ) { diff --git a/modules/php_musicbrainz/mbFilter.php b/modules/php_musicbrainz/mbFilter.php index 02ee41f7..a759fffa 100644 --- a/modules/php_musicbrainz/mbFilter.php +++ b/modules/php_musicbrainz/mbFilter.php @@ -6,11 +6,11 @@ class mbArtistFilter implements MusicBrainzFilter { private $parameterList = array(); - + function createParameters() { return $this->parameterList; } - + function name( $name ) { $this->parameterList['name'] = $name; return $this; @@ -46,14 +46,14 @@ function releaseType( $rtype ) { $type = extractFragment($rtype); - + if ( isset( $this->parameters['releasetypes'] ) ) { $this->parameters['releasetypes'] .= ' ' . $type; } else { $this->parameters['releasetypes'] = $type; } - + return $this; } @@ -71,12 +71,12 @@ $this->parameters['asin'] = $asin; return $this; } - + function limit( $limit ) { $this->parameters['limit'] = $limit; return $this; } - + function offset( $offset ) { $this->parameterList['offset'] = $offset; return $this; @@ -135,14 +135,14 @@ return $this; } } - + class mbUserFilter implements MusicBrainzFilter { private $parameters = array(); - + function createParameters() { return $this->parameters; } - + function name( $value ) { $this->parameters['name'] = $value; } diff --git a/modules/php_musicbrainz/mbLabel.php b/modules/php_musicbrainz/mbLabel.php index a94443f7..67e069ef 100644 --- a/modules/php_musicbrainz/mbLabel.php +++ b/modules/php_musicbrainz/mbLabel.php @@ -34,7 +34,7 @@ function getBeginDate() { return $this->beginDate; } function setEndDate( $endDate ) { $this->endDate = $endDate; } function getEndDate() { return $this->endDate; } - + function getUniqueName() { return empty($this->disambiguation) ? $this->name : $this->name . ' (' . $this->disambiguation . ')'; diff --git a/modules/php_musicbrainz/mbMetadata.php b/modules/php_musicbrainz/mbMetadata.php index 076bf6be..45453d6e 100644 --- a/modules/php_musicbrainz/mbMetadata.php +++ b/modules/php_musicbrainz/mbMetadata.php @@ -54,13 +54,13 @@ function &getArtistResults () { return $this->artistList; } function &getTrackResults () { return $this->trackList; } function &getReleaseResults() { return $this->releaseList; } - + function getUserList2( $remove ) { $ul = $this->userList; $this->userList = array(); return $ul; } - + function getArtistResults2( $remove ) { $al = $this->artistList; $this->artistList = array(); diff --git a/modules/php_musicbrainz/mbQuery.php b/modules/php_musicbrainz/mbQuery.php index 07afd771..df8aa4aa 100644 --- a/modules/php_musicbrainz/mbQuery.php +++ b/modules/php_musicbrainz/mbQuery.php @@ -1,9 +1,9 @@ <?php /* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */ define ( 'NS_MMD_1', "http://musicbrainz.org/ns/mmd-1.0#" ); - + require_once( 'xml/xmlParser.php' ); - + require_once( 'mbUtil.php' ); require_once( 'mbRelation.php' ); require_once( 'mbEntity.php' ); @@ -39,21 +39,21 @@ $this->ws = new mbWebService(); $this->ownWs = true; } - + $this->clientId = $clientId; } function getUserByName( $name ) { $metadata = $this->getFromWebService( "user", "", null, mbUserFilter().name($name) ); $list = $metadata->getUserList(true); - + if ( count($list) > 0 ) { return $list[0]; } - + throw mbResponseError("response didn't contain user data"); } - + function getArtists( mbArtistFilter $artist_filters ) { $metadata = $this->getFromWebService( "artist", "", null, $artist_filters ); return $metadata->getArtistResults2(true); @@ -63,12 +63,12 @@ $metadata = $this->getFromWebService( "release", "", null, $release_filters ); return $metadata->getReleaseResults2(true); } - + function getTracks( mbTrackFilter $track_filters ) { $metadata = $this->getFromWebService( "track", "", null, $track_filters ); return $metadata->getTrackResults2(true); } - + function getArtistById( $aID, mbArtistIncludes $artist_includes ) { try { $id = extractUuid($aID); @@ -106,7 +106,7 @@ $includeList = $includes ? $includes->createIncludeTags() : null; $filterList = $filters ? $filters->createParameters() : null; $content = $this->ws->get( $entity, $id, $includeList, $filterList ); - + try { $parser = new mbXmlParser(); $parsed_content = $parser->parse($content); diff --git a/modules/php_musicbrainz/mbRelation.php b/modules/php_musicbrainz/mbRelation.php index a03efe18..398c950f 100644 --- a/modules/php_musicbrainz/mbRelation.php +++ b/modules/php_musicbrainz/mbRelation.php @@ -4,7 +4,7 @@ const DIR_BOTH = 0; const DIR_FORWARD = 1; const DIR_BACKWARD = 2; - + const TO_ARTIST = "http://musicbrainz.org/ns/mmd-1.0#Artist"; const TO_TRACK = "http://musicbrainz.org/ns/mmd-1.0#Track"; const TO_RELEASE = "http://musicbrainz.org/ns/mmd-1.0#Release"; @@ -76,7 +76,7 @@ function getEndDate() { return $this->endDate; } - + function getDirection() { return $this->direction; } diff --git a/modules/php_musicbrainz/mbRelease.php b/modules/php_musicbrainz/mbRelease.php index 9bcf4321..27afa4db 100644 --- a/modules/php_musicbrainz/mbRelease.php +++ b/modules/php_musicbrainz/mbRelease.php @@ -3,7 +3,7 @@ class mbRelease extends MusicBrainzEntity { // Types const TYPE_NONE = "http://musicbrainz.org/ns/mmd-1.0#None"; - + const TYPE_ALBUM = "http://musicbrainz.org/ns/mmd-1.0#Album"; const TYPE_SINGLE = "http://musicbrainz.org/ns/mmd-1.0#Single"; const TYPE_EP = "http://musicbrainz.org/ns/mmd-1.0#EP"; @@ -21,7 +21,7 @@ const TYPE_PROMOTION = "http://musicbrainz.org/ns/mmd-1.0#Promotion"; const TYPE_BOOTLEG = "http://musicbrainz.org/ns/mmd-1.0#Bootleg"; const TYPE_PSEUDO_RELEASE = "http://musicbrainz.org/ns/mmd-1.0#Pseudo-Release"; - + private $title; private $textLanguage; private $textScript; diff --git a/modules/php_musicbrainz/mbReleaseEvent.php b/modules/php_musicbrainz/mbReleaseEvent.php index a41fa95b..3131ea55 100644 --- a/modules/php_musicbrainz/mbReleaseEvent.php +++ b/modules/php_musicbrainz/mbReleaseEvent.php @@ -11,7 +11,7 @@ $this->country = $country; $this->dateStr = $dateStr; } - + function setCountry ( $country ) { $this->country = $country; } function getCountry ( ) { return $this->country; } function setCatalogNumber( $c_number ) { $this->catalogNumber = $c_number; } diff --git a/modules/php_musicbrainz/mbUser.php b/modules/php_musicbrainz/mbUser.php index 86e384f7..8317bebb 100644 --- a/modules/php_musicbrainz/mbUser.php +++ b/modules/php_musicbrainz/mbUser.php @@ -4,29 +4,29 @@ private $name; private $showNag = false; private $types = array(); - + function mbUser() { } - + function setName( $name ) { $this->name = $name; } function getName() { return $this->name; } - + function getShowNag() { return $this->showNag; } - + function setShowNag( $value ) { $this->setShowNag = $value; } - + function addType( $type ) { $this->types[] = $type; } - + function getNumTypes() { return count($this->types); } - + function getType( $i ) { return $this->types[$i]; } diff --git a/modules/php_musicbrainz/mbUtil.php b/modules/php_musicbrainz/mbUtil.php index eff5f34c..4ebdb33a 100644 --- a/modules/php_musicbrainz/mbUtil.php +++ b/modules/php_musicbrainz/mbUtil.php @@ -1,7 +1,7 @@ <?php /* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */ class mbValueError extends Exception {} - + function extractFragment( $type ) { if ( ( $p = parse_url( $type ) ) == false ) { return $type; @@ -12,7 +12,7 @@ function extractUuid( $uid ) { if ( empty($uid) ) return $uid; - + $types = array( "artist/", "release/", "track/" ); for ( $i = 0; $i < 3; $i++ ) { if ( ($pos = strpos( $uid, $types[$i] )) !== false ) { @@ -52,7 +52,7 @@ return ""; } - + require_once( 'mbUtil_releasetypenames.php' ); function getReleaseTypeName( $id ) { if ( isset( $mbReleaseTypeNames[$id] ) ) diff --git a/modules/php_musicbrainz/mbUtil_countrynames.php b/modules/php_musicbrainz/mbUtil_countrynames.php index 6d0d87e6..c2fa37f8 100644 --- a/modules/php_musicbrainz/mbUtil_countrynames.php +++ b/modules/php_musicbrainz/mbUtil_countrynames.php @@ -1,6 +1,6 @@ <?php /* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */ - $mbCountryNames = array( + $mbCountryNames = array( "BD" => "Bangladesh", "BE" => "Belgium", "BF" => "Burkina Faso", diff --git a/modules/php_musicbrainz/mbUtil_languagenames.php b/modules/php_musicbrainz/mbUtil_languagenames.php index 5006198d..3e56bf82 100644 --- a/modules/php_musicbrainz/mbUtil_languagenames.php +++ b/modules/php_musicbrainz/mbUtil_languagenames.php @@ -1,6 +1,6 @@ <?php /* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */ - $mbLanguageNames = array( + $mbLanguageNames = array( "ART" => "Artificial (Other)", "ROH" => "Raeto-Romance", "SCO" => "Scots", diff --git a/modules/php_musicbrainz/mbUtil_releasetypenames.php b/modules/php_musicbrainz/mbUtil_releasetypenames.php index ad4f2bf0..a655dcdc 100644 --- a/modules/php_musicbrainz/mbUtil_releasetypenames.php +++ b/modules/php_musicbrainz/mbUtil_releasetypenames.php @@ -1,6 +1,6 @@ <?php /* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */ - $mbReleaseTypeNames = array( + $mbReleaseTypeNames = array( "http://musicbrainz.org/ns/mmd-1.0#None" => "None", "http://musicbrainz.org/ns/mmd-1.0#Album" => "Album", "http://musicbrainz.org/ns/mmd-1.0#Single" => "Single", diff --git a/modules/php_musicbrainz/mbWebService.php b/modules/php_musicbrainz/mbWebService.php index 0b59da34..76aa0939 100644 --- a/modules/php_musicbrainz/mbWebService.php +++ b/modules/php_musicbrainz/mbWebService.php @@ -4,7 +4,7 @@ function get ( $entity, $id, $include, $filter, $version = '1' ); function post( $entity, $id, $data, $version = '1' ); } - + class mbWebService implements IWebService { private $host; private $port; @@ -31,7 +31,7 @@ return true; } - + function close() { if ( $this->fSock != -1 ) { fclose($this->fSock); @@ -47,7 +47,7 @@ function parseHeaders( $string ) { $lines = explode( "\n", $string ); $this->lastHeaders = array(); - + foreach ( $lines as $key => $line ) { // Status line if ( $key == 0 ) { @@ -81,7 +81,7 @@ $this->lastHeaders = array(); return false; } - + function getHeaders() { return $this->lastHeaders; } @@ -91,7 +91,7 @@ $this->lastError = "Trying to write to closed socket."; return false; } - + fwrite( $this->fSock, $string . "\r\n" ); fwrite( $this->fSock, "Host: " . $this->host . "\r\n" ); fwrite( $this->fSock, "Accept: */*\r\n" ); @@ -109,7 +109,7 @@ $this->lastError = "Trying to read from closed socket."; return false; } - + $buffer = ""; while ( !feof($this->fSock) ) @@ -120,7 +120,7 @@ return $this->parseHeaders($buffer); } - + function get( $entity, $uid, $includes, $filters, $version="1" ) { $params = array(); $params['type'] = "xml"; @@ -142,17 +142,17 @@ } $URI = $this->pathPrefix . "/" . $version . "/" . $entity . "/" . $uid . "?" . $this->build_query( $params ); - + if ( $this->fSock == -1 && !$this->connect() ) return false; - + $this->sendRequest( "GET $URI HTTP/1.1" ); $this->lastResponse = $this->getResponse(); $this->close(); if ( isset($this->lastHeaders['HTTP_status']) && $this->lastHeaders['HTTP_status'] != 200 ) return false; - + return $this->lastResponse; } @@ -170,11 +170,11 @@ return $this->lastResponse; } - + function build_query( $array ) { $first = true; $query_string = ""; - + if ( !is_array($array) || sizeof($array) == 0 ) return ""; diff --git a/modules/php_musicbrainz/mbXmlParser.php b/modules/php_musicbrainz/mbXmlParser.php index aaad0126..46d39e7c 100644 --- a/modules/php_musicbrainz/mbXmlParser.php +++ b/modules/php_musicbrainz/mbXmlParser.php @@ -5,19 +5,19 @@ class mbXmlParser { private $xml_parser; private $factory; - + function mbXmlParser() { $this->xml_parser = new xmlParser(); $this->factory = new mbDefaultFactory(); } - + private function parseList( XMLNode $node, array &$list, $func ) { for ( $i = 0; $i < $node->nChildNodes(); $i++ ) { $cnode = $node->getChildNode($i); $list[] = call_user_func( array( &$this, $func ), $cnode ); } } - + private function parseResults( XMLNode $node, array &$list, $func, $type ) { for ( $i = 0; $i < $node->nChildNodes(); $i++ ) { $cnode = $node->getChildNode($i); @@ -29,7 +29,7 @@ $list[] = $to_add; } } - + private function parseRelations( XMLNode $node, MusicBrainzEntity $entity ) { $targetType = $node->getAttribute("target-type"); if ( $targetType == '' ) @@ -44,14 +44,14 @@ } } } - + private function parseUserResults( XMLNode $node, array &$userList ) { for ( $i = 0; $i < $node->nChildNodes(); $i++ ) { $cnode = $node->getChildNode($i); $userList[] = $this->createUser( $cnode ); } } - + private function createUser( XMLNode $node ) { $user = $this->factory->newUser(); for ( $i = 0; $i < $node->nChildNodes(); $i++ ) { @@ -68,7 +68,7 @@ } return $user; } - + private function createArtistAlias( XMLNode $node ) { $aa = $this->factory->newArtistAlias(); $aa->setType($node->getAttribute("type")); @@ -77,14 +77,14 @@ return $aa; } - + private function createTag( XMLNode $node ) { $tag = $this->factory->newTag(); $tag->setCount($node->getAttribute("count")); $tag->setName($node->getText()); return $tag; } - + private function createLabelAlias( XML $node ) { $la = $this->factory->newLabelAlias(); $la->setType($node->getAttribute("type")); @@ -92,13 +92,13 @@ $la->setValue($node->getText()); return $la; } - + private function createDisc( XMLNode $node ) { $disc = $this->factory->newDisc(); $disc->setId($node->getAttribute("id")); return $disc; } - + private function createReleaseEvent( XMLNode $node ) { $relEvent = $this->factory->newReleaseEvent(); $relEvent->setCountry($node->getAttribute("country")); @@ -115,7 +115,7 @@ } return $relEvent; } - + private function createLabel( XMLNode $node ) { $label = $this->factory->newLabel(); $label->setId($node->getAttribute("id")); @@ -160,7 +160,7 @@ return $label; } - + private function createArtist( XMLNode $node ) { $artist = $this->factory->newArtist(); $artist->setId($node->getAttribute("id")); @@ -207,7 +207,7 @@ return $artist; } - + private function createTrack( XMLNode $node ) { $track = $this->factory->newTrack(); $track->setId($node->getAttribute("id")); @@ -238,10 +238,10 @@ break; } } - + return $track; } - + private function createRelease( XMLNode $node ) { $release = $this->factory->newRelease(); $release->setId($node->getAttribute("id")); @@ -294,13 +294,13 @@ return $release; } - + private function createRelation( XMLNode $node, $type ) { $relation = $this->factory->newRelation(); $relation->setType(extractFragment($node->getAttribute("type"))); // TODO: fixme $relation->setTargetType($type); $relation->setTargetId($node->getAttribute("target")); - + $dir = mbRelation::DIR_BOTH; switch( strtolower($node->getAttribute("direction")) ) { case "forward": @@ -340,7 +340,7 @@ return $relation; } - + function parse( $data ) { $nodes = $this->xml_parser->parse( $data ); @@ -349,7 +349,7 @@ $md = new mbMetadata(); - + for ( $i = 0; $i < $nodes->nChildNodes(); $i++ ) { $node = $nodes->getChildNode($i); $name = strtolower($node->getName()); diff --git a/modules/php_musicbrainz/xml/xmlParser.php b/modules/php_musicbrainz/xml/xmlParser.php index 1d0058da..7e3311cf 100644 --- a/modules/php_musicbrainz/xml/xmlParser.php +++ b/modules/php_musicbrainz/xml/xmlParser.php @@ -15,7 +15,7 @@ function getParentNode() { return $this->parentNode; } - + function nChildNodes() { return sizeof($this->childNodes); } @@ -46,7 +46,7 @@ return $this->attributes['TEXT']; } } - + class xmlParser { private $_parser; private $_root_node = null; @@ -69,7 +69,7 @@ public function lastError() { return $this->_last_error; } - + public function parse( $data ) { if ( !xml_parse( $this->_parser, $data ) ) { $this->_last_error = xml_get_current_line_number($this->_parser) . ": ". xml_error_string($this->_parser); @@ -77,7 +77,7 @@ } return $this->_root_node; } - + private function start_element_handler( $parser, $name, $attribs ) { if ( !$this->_root_node ) { $new_node = new XMLNode( $name, $attribs ); @@ -90,14 +90,14 @@ $old_node->setChildNode( $new_node ); $this->_curr_node = $new_node; } - + } private function text_handler( $parser, $text ) { if ( $this->_curr_node ) $this->_curr_node->setText( $text ); } - + private function end_element_handler( $parser, $name ) { if ( $this->_root_node ) { $this->_curr_node = $this->_curr_node->getParentNode(); |