-
Notifications
You must be signed in to change notification settings - Fork 23
/
shutdown.html
93 lines (92 loc) · 4.87 KB
/
shutdown.html
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
<!DOCTYPE html>
<html>
<head>
<title>Youtify</title>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="icon" type="image/png" href="/images/logo/logo_16x16.png" sizes="16x16" />
<link rel="icon" type="image/png" href="/images/logo/logo_32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="/images/logo/logo_64x64.png" sizes="64x64" />
<link rel="icon" type="image/png" href="/images/logo/logo_128x128.png" sizes="128x128" />
<link rel="icon" type="image/png" href="/images/logo/logo_512x512.png" sizes="512x512" />
<style>
.actions .logout, .actions .download { display: none; }
</style>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script>
window.youtify = { loginUrl: null, userid: null, dump: '' };
window.console = (window.console || { log: function(){} });
$.getJSON('/api/main', function(data) {
var $btn = $('.actions .export');
console.log(data);
youtify.loginUrl = data.loginUrl;
youtify.logoutUrl = data.logoutUrl;
youtify.userid = (data.user || { id: null }).id;
youtify.username = (data.user || { displayName: null }).displayName;
if (!youtify.userid)
$btn.text('here');
else if (youtify.username) {
$btn.text('here (' + youtify.username + ')');
$('.actions .logout').show().prop('href', youtify.logoutUrl);
}
$btn.on('click', function(event) {
$btn.prop('disabled', true);
if (youtify.userid) {
$.getJSON('/api/users/' + youtify.userid + '/playlists', function(data) {
var calls = 0;
$.each(data, function(index, item) {
calls += 1;
$.get('/api/playlists/' + item.remoteId, function(data, x, y) {
console.log(data);
youtify.dump += data.title + '\n' + '===' + '\n';
var playlists = JSON.parse(data.videos) || [];
for (i = 0; i < playlists.length; i += 1) {
if (playlists[i].type === 'youtube')
youtify.dump += playlists[i].title + '\t' + 'http://www.youtube.com/watch?v=' + playlists[i].videoId + '\n';
else if (playlists[i].type === 'soundcloud')
youtify.dump += playlists[i].title + '\t' + 'http://www.soundcloud.com' + '\n';
else
youtify.dump += playlists[i].title + '\n';
}
youtify.dump += '\n';
calls -= 1;
});
});
var t = setTimeout(function() {
console.log(calls)
if (calls === 0) {
clearTimeout(t);
if (youtify.dump.length === 0) {
$('.actions').text(' - No data found.');
} else {
$('.actions .export, .actions .logout').hide();
$('.actions .download')
.prop('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(youtify.dump))
.show();
}
}
}, 100);
});
} else {
window.location = youtify.loginUrl;
}
return false;
});
});
</script>
</head>
<body>
<div class="content">
<h1>Youtify is no more</h1>
<p>Youtify was a skin for playing videos from YouTube and music from SoundCloud.</p>
<p>Previous users can download data
<span class="row actions">
<a href="#" class="export">here</a>
<a href="#" class="download" download="youtify-backup.txt">save text file</a><br /><br />
<a href="#" class="logout">Logout</a><br />
</span>
</p>
<p>All data will be permanently deleted February the 1th, 2015.</p>
</div>
</body>
</html>