-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmisc.php
More file actions
50 lines (40 loc) · 1.26 KB
/
Copy pathmisc.php
File metadata and controls
50 lines (40 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?
function strtr_utf8($str, $from, $to) {
$keys = array();
$values = array();
preg_match_all('/./u', $from, $keys);
preg_match_all('/./u', $to, $values);
$mapping = array_combine($keys[0], $values[0]);
return strtr($str, $mapping);
}
function replacetitlechars($title) {
return strtr_utf8($title, "ÝÁáàäãâéèëêíìïîóòöõôúùüûý'[]:.,/()|#&>! ", "yaaaaaaeeeeiiiiooooouuuuy_______________");
//return strtr($title, "ä", "a");
}
function scrappingTracks($remotedir) {
$audiolist = array();
$doc = new DOMDocument();
@$doc->loadHTMLFile($remotedir);
$links = $doc->getElementsByTagName('a');
foreach ($links as $link) {
$attrs = $link->attributes;
$href = $attrs->getNamedItem('href')->nodeValue;
$filetype = substr($href,-4);
if (($filetype == ".mp3") || ($filetype == ".ogg")) {
//print("<br>found a sound file: ".$href);
$thisfile = $remotedir."/".$href;
unset($foundbefore);
$foundbefore = false;
foreach ($audiolist as $al) {
//print("<br>comparing: ".$al." with ".$thisfile);
if (strcmp($al,$thisfile) == 0) $foundbefore = true;
}
if (!$foundbefore) {
print("<br>listed a sound file: ".$thisfile);
array_push($audiolist, $thisfile);
}
}
}
return $audiolist;
}
?>