equal
deleted
inserted
replaced
66 |
66 |
67 /** |
67 /** |
68 * Rebuilds the copy of the playlist in RAM |
68 * Rebuilds the copy of the playlist in RAM |
69 */ |
69 */ |
70 |
70 |
|
71 $playlist_last_md5 = ''; |
|
72 |
71 function rebuild_playlist() |
73 function rebuild_playlist() |
72 { |
74 { |
73 // import what we need |
75 // import what we need |
74 global $homedir, $playlist; |
76 global $homedir, $playlist; |
75 // sync and load the playlist file |
77 // sync and load the playlist file |
76 $playlist_file = dcop_action('playlist', 'saveCurrentPlaylist'); |
78 $playlist_file = dcop_action('playlist', 'saveCurrentPlaylist'); |
|
79 // check MD5 - if it's not changed, exit to save CPU cycles |
|
80 global $playlist_last_md5; |
|
81 if ( $playlist_last_md5 == @md5_file($playlist_file) ) |
|
82 { |
|
83 return true; |
|
84 } |
|
85 $playlist_last_md5 = @md5_file($playlist_file); |
77 // start XML parser |
86 // start XML parser |
78 try |
87 try |
79 { |
88 { |
80 $xml = simplexml_load_file($playlist_file); |
89 $xml = simplexml_load_file($playlist_file); |
81 } |
90 } |
95 $item = array( |
104 $item = array( |
96 'uri' => $attribs['uri'], |
105 'uri' => $attribs['uri'], |
97 'title' => strval($child->Title), |
106 'title' => strval($child->Title), |
98 'artist' => strval($child->Artist), |
107 'artist' => strval($child->Artist), |
99 'album' => strval($child->Album), |
108 'album' => strval($child->Album), |
100 'length' => seconds_to_str(intval($child->Length)) |
109 'length' => seconds_to_str(intval($child->Length)), |
|
110 'length_int' => intval($child->Length) |
101 ); |
111 ); |
102 $playlist[] = $item; |
112 $playlist[] = $item; |
103 } |
113 } |
104 } |
114 } |
105 |
115 |