Skip to content

Commit

Permalink
Prepared for complete shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
kallux committed Dec 1, 2014
1 parent f288014 commit 87554aa
Show file tree
Hide file tree
Showing 3 changed files with 173 additions and 76 deletions.
138 changes: 71 additions & 67 deletions app.yaml
Expand Up @@ -16,125 +16,129 @@ error_handlers:

handlers:

- url: /admin/migrations/.*
script: migrations.app
login: admin
#- url: /admin/migrations/.*
# script: migrations.app
# login: admin

- url: /admin/fakesetup
script: fakesetup.app
login: admin
#- url: /admin/fakesetup
# script: fakesetup.app
# login: admin

- url: /stats
script: ping.app

- url: /me
script: me.app
#- url: /me
# script: me.app

- url: /me/.*
script: me.app
#- url: /me/.*
# script: me.app

- url: /api/users.*
script: users.app

- url: /api/alternatives.*
script: alternatives.app
#- url: /api/alternatives.*
# script: alternatives.app

- url: /logo
static_files: html/logo-guidlines.html
upload: html/logo-guidlines.html
#- url: /logo
# static_files: html/logo-guidlines.html
# upload: html/logo-guidlines.html
#expiration: "1d"

- url: /about
static_files: html/about.html
upload: html/about.html
#- url: /about
# static_files: html/about.html
# upload: html/about.html
#expiration: "1d"

- url: /yourbrowsersucks
script: sucks.app
#- url: /yourbrowsersucks
# script: sucks.app

- url: /yourdecisionrocks
script: sucks.app
#- url: /yourdecisionrocks
# script: sucks.app

- url: /cron/generate_playlists_toplist.*
script: playlists_toplist.app
login: admin
#- url: /cron/generate_playlists_toplist.*
# script: playlists_toplist.app
# login: admin

- url: /cron/update_external_users
script: external_users.app
login: admin
#- url: /cron/update_external_users
# script: external_users.app
# login: admin

- url: /api/external_users.*
script: external_users.app
#- url: /api/external_users.*
# script: external_users.app

- url: /api/playlists.*
script: playlists.app

- url: /api/favorites.*
script: favorites.app
#- url: /api/favorites.*
# script: favorites.app

- url: /api/toplists/playlists
script: playlists_toplist.app
#- url: /api/toplists/playlists
# script: playlists_toplist.app

- url: /api/dropbox.*
script: dropbox-handler.app
#- url: /api/dropbox.*
# script: dropbox-handler.app

- url: /cron/store_pings
script: ping.app
login: admin
#- url: /cron/store_pings
# script: ping.app
# login: admin

- url: /ping
script: ping.app
#- url: /ping
# script: ping.app

- url: /scripts
static_dir: scripts
#- url: /scripts
# static_dir: scripts

- url: /styles
static_dir: styles
#- url: /styles
# static_dir: styles

- url: /images
static_dir: images
expiration: "1d"
#- url: /images
# static_dir: images
# expiration: "1d"

- url: /favicon.ico
static_files: images/favicon.ico
upload: images/favicon.ico
expiration: "1d"

- url: /youtify.webapp
static_files: youtify.webapp
mime_type: application/x-web-app-manifest+json
upload: youtify.webapp
#- url: /youtify.webapp
# static_files: youtify.webapp
# mime_type: application/x-web-app-manifest+json
# upload: youtify.webapp

- url: /robots.*
static_files: robots.txt
upload: robots.txt
expiration: "1d"

- url: /flattr.*
script: flattr.app
login: required
#- url: /flattr.*
# script: flattr.app
# login: required

- url: /lastfm/*.*
script: lastfm.app
login: required
#- url: /lastfm/*.*
# script: lastfm.app
# login: required

- url: /happytranslate/.*
script: happytranslate.app
#- url: /happytranslate/.*
# script: happytranslate.app

- url: /unsubscribe
script: mail.app

- url: /soundcloud_id_to_permalink
script: soundcloud_id_to_permalink.app
#- url: /soundcloud_id_to_permalink
# script: soundcloud_id_to_permalink.app

- url: /opensearch.xml
static_files: opensearch.xml
upload: opensearch.xml
expiration: "1d"
#- url: /opensearch.xml
# static_files: opensearch.xml
# upload: opensearch.xml
# expiration: "1d"

- url: /api/main
script: main.app

- url: /.*
script: main.app
static_files: html/shutdown.html
upload: html/shutdown.html

#- url: /.*
# script: main.app

18 changes: 9 additions & 9 deletions cron.yaml
@@ -1,12 +1,12 @@
cron:
- description: store pings
url: /cron/store_pings
schedule: every 10 minutes
#- description: store pings
# url: /cron/store_pings
# schedule: every 10 minutes

- description: generate playlists toplist
url: /cron/generate_playlists_toplist
schedule: every 5 minutes
#- description: generate playlists toplist
# url: /cron/generate_playlists_toplist
# schedule: every 5 minutes

- description: get last_updated for external users
url: /cron/update_external_users
schedule: every 5 minutes
#- description: get last_updated for external users
# url: /cron/update_external_users
# schedule: every 5 minutes
93 changes: 93 additions & 0 deletions html/shutdown.html
@@ -0,0 +1,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>

0 comments on commit 87554aa

Please sign in to comment.