This repository was archived by the owner on Feb 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp_automate.php
More file actions
101 lines (83 loc) · 2.94 KB
/
Copy pathp_automate.php
File metadata and controls
101 lines (83 loc) · 2.94 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
$AutomationPlaylistID = 5343;
$bAdding = false;
require_once("connect.php");
require_once("header.php");
require_once("hash_functions.php");
require_once("position_check.php");
$query = "
SELECT DISTINCT a.album_name, a.albumID, b.artist_name, b.artistID, t.track_num, t.track_name
FROM libPlaylistTrackMap p
JOIN libtrack t on t.albumID = p.albumID and t.track_num = p.track_num
JOIN libalbum a on p.albumID = a.albumID
JOIN libartist b on b.artistID = a.artistID
WHERE p.playlistID = ".$AutomationPlaylistID;
//Submit Query
$list = mysql_query($query, $link);
//If query returns FALSE, no albums were returned. Die with error
if (!$list) die ('No albums returned: ' . mysql_error());
echo "
<div id = 'filters'>
<table><tr>
<td><div id = 'search'><input id = 'searchInput' type='text' value='Search: '></div></td>
<td><div id = 'centerlab'><a href='p_automate.php?'>ZAutomate Queue</a></div></td>
</tr></table>
</div>
<div id='results'>
<div id = 'list'>
<div id = 'addQueue'>
<div>
<button type='submit' class='pure-button pure-input-1-2 pure-button-primary'>Add</button>
</div>
</div>
<table>
<tr>
<th>Track</th>
<th>Album</th>
<th>Artist</th>
<th>Score</th>
</tr> ";
//Get row from SQL Query, populate tables with albums
while($row = mysql_fetch_assoc($list)) {
echo "
<tr>
<td><a href ='albumID=".$row['albumID']."&track_num=".$row['albumID']."'>".$row['track_name']."</a></td>
<td><a href ='albumID=".$row['albumID']."'>".$row['album_name']."</a></td>
<td><a href ='artistID=".$row['artistID']."'>".$row['artist_name']."</a></td>
<td>∧ 13 ∨<img src='crystal.png'></td>
</tr> ";
}
echo "
</table>
</div> </div>";
echo "
<script type = 'text/javascript'>
$('#addQueue button').click(function(event){
event.preventDefault();
if ($('#addQueue div').size() == 1) {
$.post('p_addTrack.php', function(data) {
$('#addQueue').append(data);
});
}
else {
$('#addQueue div:nth-child(2)').remove();
//$('#addQueue').append('<p>Added!</p>');
}
});
$('#list a').click(function(event){
event.preventDefault();
var qs = $(this).attr('href');
$.post('p_library.php?' + qs, function(data) {
$('#center').html(data);
});
});
/*
$('#crystal').hover(function (event) {
//$('#crystalUpDown').show();
});
$('#crystalUpDown').click(function (event) {
//if(this.html() = '^') {post some shit}
});
*/
</script>";
?>