Subversion Repositories cheapmusic

Rev

Rev 18 | Rev 58 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18 Rev 44
Line 22... Line 22...
22
			$mainRelease = $xml->main_release;
22
			$mainRelease = $xml->main_release;
23
			$year = $xml->year;
23
			$year = $xml->year;
24
			$title = $xml->title;
24
			$title = $xml->title;
25
 
25
 
26
			$genres = [];
26
			$genres = [];
27
			if (isset($xml->ngenres)) {
27
			if (isset($xml->genres)) {
28
				foreach ($xml->genres->genre as $n) {
28
				foreach ($xml->genres->genre as $n) {
29
					$genres[] = $n;
29
					$genres[] = $n;
30
				}
30
				}
31
			}
31
			}
32
 
32
 
Line 37... Line 37...
37
				}
37
				}
38
			}
38
			}
39
 
39
 
40
			if (isset($xml->artists)) {
40
			if (isset($xml->artists)) {
41
				foreach ($xml->artists->artist as $n) {
41
				foreach ($xml->artists->artist as $n) {
-
 
42
					if (!empty($n->id)) {
42
					fputcsv2($fhArtists, array($id, $n->id), ',', '"', true);
43
						fputcsv2($fhArtists, array($id, $n->id), ',', '"');
-
 
44
					}
43
				}
45
				}
44
			}
46
			}
45
 
47
 
46
			$arr = array(
48
			$arr = array(
47
				$id,
49
				$id,
Line 50... Line 52...
50
				$title,
52
				$title,
51
				join(", ", $genres),
53
				join(", ", $genres),
52
				join(", ", $styles)
54
				join(", ", $styles)
53
			);
55
			);
54
 
56
 
55
			fputcsv2($fh, $arr, ',', '"', true);
57
			fputcsv2($fh, $arr, ',', '"');
56
		}
58
		}
57
 
59
 
58
		return true;
60
		return true;
59
	}
61
	}
60
}
62
}
61
 
63
 
62
$xmlfile = "./in/discogs_20190601_masters.xml.gz";
64
$xmlfile = "./in/discogs_20190701_masters.xml.gz";
63
 
65
 
64
$fh = fopen("out/masters.load", "w+");
66
$fh = fopen("out/masters.load", "w+");
65
$fhArtists = fopen("out/masterArtists.load", "w+");
67
$fhArtists = fopen("out/masterArtists.load", "w+");
66
 
68
 
67
$xmlstream = "compress.zlib://$xmlfile";
69
$xmlstream = "compress.zlib://$xmlfile";