Ampache
[ class tree: Ampache ] [ index: Ampache ] [ all elements ]

Class: Song

Source Location: /lib/class/song.class.php

Class Overview

database_object
   |
   --Song

database_object


Implements interfaces:

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 22]
database_object

This is a general object that is extended by all of the basic database based objects in ampache. It attempts to do some standard caching for all of the objects to cut down on the database calls




[ Top ]


Class Variables

$addition_time =

[line 41]



Tags:

access:  public

Type:   mixed


[ Top ]

$album =

[line 27]



Tags:

access:  public

Type:   mixed


[ Top ]

$artist =

[line 28]



Tags:

access:  public

Type:   mixed


[ Top ]

$bitrate =

[line 31]



Tags:

access:  public

Type:   mixed


[ Top ]

$enabled =

[line 40]



Tags:

access:  public

Type:   mixed


[ Top ]

$file =

[line 26]



Tags:

access:  public

Type:   mixed


[ Top ]

$id =

[line 25]



Tags:

access:  public

Type:   mixed


[ Top ]

$mime =

[line 38]



Tags:

access:  public

Type:   mixed


[ Top ]

$mode =

[line 33]



Tags:

access:  public

Type:   mixed


[ Top ]

$played =

[line 39]



Tags:

access:  public

Type:   mixed


[ Top ]

$rate =

[line 32]



Tags:

access:  public

Type:   mixed


[ Top ]

$size =

[line 34]



Tags:

access:  public

Type:   mixed


[ Top ]

$time =

[line 35]



Tags:

access:  public

Type:   mixed


[ Top ]

$title =

[line 29]



Tags:

access:  public

Type:   mixed


[ Top ]

$track =

[line 36]



Tags:

access:  public

Type:   mixed


[ Top ]

$type =

[line 37]



Tags:

access:  public

Type:   mixed


[ Top ]

$update_time =

[line 42]



Tags:

access:  public

Type:   mixed


[ Top ]

$year =

[line 30]



Tags:

access:  public

Type:   mixed


[ Top ]

$_fake =  false

[line 46]



Tags:

access:  public

Type:   mixed


[ Top ]

$_transcoded =  false

[line 45]



Tags:

access:  public

Type:   mixed


[ Top ]



Class Methods


static method build_cache [line 79]

static void build_cache( $song_ids)

build_cache

This attempts to reduce # of queries by asking for everything in the browse all at once and storing it in the cache, this can help if the db connection is the slow point




Tags:

access:  public


Parameters:

   $song_ids  

[ Top ]

static method compare_song_information [line 319]

static void compare_song_information( $song, $new_song)

compare_song_information

this compares the new ID3 tags of a file against the ones in the database to see if they have changed it returns false if nothing has changes, or the true if they have. Static because it doesn't need this




Tags:

access:  public


Parameters:

   $song  
   $new_song  

[ Top ]

static method get_fields [line 743]

static void get_fields( )

get_fields

This returns all of the 'data' fields for this object, we need to filter out some that we don't want to present to a user, and add some that don't exist directly on the object but are related




Tags:

access:  public


[ Top ]

static method get_from_path [line 764]

static void get_from_path( $path)

get_from_path

This returns all of the songs that exist under the specified path




Tags:

access:  public


Parameters:

   $path  

[ Top ]

static method get_recently_played [line 936]

static void get_recently_played( [ $user_id = ''])

get_recently_played

This function returns the last X songs that have been played it uses the popular threshold to figure out how many to pull it will only return unique object




Tags:

access:  public


Parameters:

   $user_id  

[ Top ]

static method parse_song_url [line 914]

static void parse_song_url( $url)

parse_song_url

Takes a URL from this ampache install and returns the song that the url represents used by the API, and used to parse out stream urls for localplay right now just gets song id might do more later, hence the complexity




Tags:

access:  public


Parameters:

   $url  

[ Top ]

static method play_url [line 856]

static void play_url( $oid, [ $session_id = ''], [ $force_http = ''])

play_url

This function takes all the song information and correctly formats a a stream URL taking into account the downsmapling mojo and everything else, this is the true function




Tags:

access:  public



Implementation of:
media::play_url()

Parameters:

   $oid  
   $session_id  
   $force_http  

[ Top ]

static method update_album [line 566]

static void update_album( $new_album, $song_id)

update_album

updates the album field




Tags:

access:  public


Parameters:

   $new_album  
   $song_id  

[ Top ]

static method update_artist [line 556]

static void update_artist( $new_artist, $song_id)

update_artist

updates the artist field




Tags:

access:  public


Parameters:

   $new_artist  
   $song_id  

[ Top ]

static method update_bitrate [line 496]

static void update_bitrate( $new_bitrate, $song_id)

update_bitrate

updates the bitrate field




Tags:

access:  public


Parameters:

   $new_bitrate  
   $song_id  

[ Top ]

static method update_comment [line 466]

static void update_comment( $new_comment, $song_id)

update_comment

updates the comment field




Tags:

access:  public


Parameters:

   $new_comment  
   $song_id  

[ Top ]

static method update_enabled [line 598]

static void update_enabled( $new_enabled, $song_id)

update_enabled

sets the enabled flag




Tags:

access:  public


Parameters:

   $new_enabled  
   $song_id  

[ Top ]

static method update_language [line 456]

static void update_language( $new_lang, $song_id)

update_language

This updates the language tag of the song




Tags:

access:  public


Parameters:

   $new_lang  
   $song_id  

[ Top ]

static method update_lyrics [line 476]

static void update_lyrics( $new_lyrics, $song_id)

update_lyrics

updates the lyrics field




Tags:

access:  public


Parameters:

   $new_lyrics  
   $song_id  

[ Top ]

static method update_mode [line 516]

static void update_mode( $new_mode, $song_id)

update_mode

updates the mode field




Tags:

access:  public


Parameters:

   $new_mode  
   $song_id  

[ Top ]

static method update_played [line 588]

static void update_played( $new_played, $song_id)

update_played

sets the played flag




Tags:

access:  public


Parameters:

   $new_played  
   $song_id  

[ Top ]

static method update_rate [line 506]

static void update_rate( $new_rate, $song_id)

update_rate

updates the rate field




Tags:

access:  public


Parameters:

   $new_rate  
   $song_id  

[ Top ]

static method update_size [line 526]

static void update_size( $new_size, $song_id)

update_size

updates the size field




Tags:

access:  public


Parameters:

   $new_size  
   $song_id  

[ Top ]

static method update_song [line 409]

static void update_song( $song_id, $new_song)

update_song

this is the main updater for a song it actually calls a whole bunch of mini functions to update each little part of the song... lastly it updates the "update_time" of the song




Tags:

access:  public


Parameters:

   $song_id  
   $new_song  

[ Top ]

static method update_time [line 536]

static void update_time( $new_time, $song_id)

update_time

updates the time field




Tags:

access:  public


Parameters:

   $new_time  
   $song_id  

[ Top ]

static method update_title [line 486]

static void update_title( $new_title, $song_id)

update_title

updates the title field




Tags:

access:  public


Parameters:

   $new_title  
   $song_id  

[ Top ]

static method update_track [line 546]

static void update_track( $new_track, $song_id)

update_track

this updates the track field




Tags:

access:  public


Parameters:

   $new_track  
   $song_id  

[ Top ]

static method update_utime [line 576]

static void update_utime( $song_id, [ $time = 0])

update_utime

sets a new update time




Tags:

access:  public


Parameters:

   $song_id  
   $time  

[ Top ]

static method update_year [line 446]

static void update_year( $new_year, $song_id)

update_year

update the year tag




Tags:

access:  public


Parameters:

   $new_year  
   $song_id  

[ Top ]

constructor __construct [line 52]

Song __construct( [ $id = ''])

Constructor Song class, for modifing a song.



Tags:

access:  public


Parameters:

   $id  

[ Top ]

method fill_ext_info [line 179]

void fill_ext_info( )

fill_ext_info

This calls the _get_ext_info and then sets the correct vars




Tags:

access:  public


[ Top ]

method fill_info [line 810]

void fill_info( $results, $pattern, $catalog_id, $key)



Parameters:

   $results  
   $pattern  
   $catalog_id  
   $key  

[ Top ]

method format [line 653]

void format( )

format

This takes the current song object and does a ton of formating on it creating f_??? variables on the current object




Tags:

access:  public



Implementation of:
media::format()
[ Top ]

method format_pattern [line 705]

void format_pattern( )

format_pattern

This reformates the song information based on the catalog rename patterns




Tags:

access:  public


[ Top ]

method format_type [line 197]

void format_type( [ $override = ''])

format_type

gets the type of song we are trying to play, used to set mime headers and to trick players into playing them correctly




Tags:

access:  public


Parameters:

   $override  

[ Top ]

method get_album_name [line 252]

void get_album_name( [ $album_id = 0])

get_album_name

gets the name of $this->album, allows passing of id




Tags:

access:  public


Parameters:

   $album_id  

[ Top ]

method get_artist_name [line 265]

void get_artist_name( [ $artist_id = 0])

get_artist_name

gets the name of $this->artist, allows passing of id




Tags:

access:  public


Parameters:

   $artist_id  

[ Top ]

method get_info_from_filename [line 838]

void get_info_from_filename( $file, $pattern, $tag)



Parameters:

   $file  
   $pattern  
   $tag  

[ Top ]

method get_rel_path [line 786]

void get_rel_path( [ $file_path = 0], [ $catalog_id = 0])



Tags:

access:  public


Parameters:

   $file_path  
   $catalog_id  

[ Top ]

method get_url [line 867]

void get_url( [ $session_id = ''], [ $force_http = ''])

get_url

This function takes all the song information and correctly formats a stream URL taking into account the downsampling mojo and everything else, this is used or will be used by _EVERYTHING_




Tags:

access:  public


Parameters:

   $session_id  
   $force_http  

[ Top ]

method has_flag [line 281]

void has_flag( )

has_flag

This just returns true or false depending on if this song is flagged for something We don't care what so we limit the SELECT to 1




Tags:

access:  public


[ Top ]

method native_stream [line 964]

void native_stream( )

native_stream

This returns true/false if this can be nativly streamed




Tags:

access:  public



Implementation of:
media::native_stream()
[ Top ]

method set_played [line 299]

void set_played( )

set_played

this checks to see if the current object has been played if not then it sets it to played




Tags:

access:  public


[ Top ]

method stream_cmd [line 988]

void stream_cmd( )

stream_cmd

test if the song type streams natively and if not returns a transcoding command from the config we can't use this->type because its been formated for the downsampling




Tags:

access:  public



Implementation of:
media::stream_cmd()
[ Top ]

method update [line 364]

void update( $data)

update

This takes a key'd array of data does any cleaning it needs to do and then calls the helper functions as needed. This will also cause the song to be flagged




Tags:

access:  public


Parameters:

   $data  

[ Top ]

method _get_ext_info [line 156]

void _get_ext_info( )

_get_ext_info

This function gathers information from the song_ext_info table and adds it to the current object




Tags:

access:  public


[ Top ]


Documentation generated on Thu, 12 Feb 2009 08:00:09 +0900 by phpDocumentor 1.4.2