-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #673 from omarroth/add-playlists
Add initial support for custom playlists
- Loading branch information
Showing
40 changed files
with
1,796 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
function add_playlist_item(target) { | ||
var tile = target.parentNode.parentNode.parentNode.parentNode.parentNode; | ||
tile.style.display = 'none'; | ||
|
||
var url = '/playlist_ajax?action_add_video=1&redirect=false' + | ||
'&video_id=' + target.getAttribute('data-id') + | ||
'&playlist_id=' + target.getAttribute('data-plid'); | ||
var xhr = new XMLHttpRequest(); | ||
xhr.responseType = 'json'; | ||
xhr.timeout = 10000; | ||
xhr.open('POST', url, true); | ||
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); | ||
|
||
xhr.onreadystatechange = function () { | ||
if (xhr.readyState == 4) { | ||
if (xhr.status != 200) { | ||
tile.style.display = ''; | ||
} | ||
} | ||
} | ||
|
||
xhr.send('csrf_token=' + playlist_data.csrf_token); | ||
} | ||
|
||
function remove_playlist_item(target) { | ||
var tile = target.parentNode.parentNode.parentNode.parentNode.parentNode; | ||
tile.style.display = 'none'; | ||
|
||
var url = '/playlist_ajax?action_remove_video=1&redirect=false' + | ||
'&set_video_id=' + target.getAttribute('data-index') + | ||
'&playlist_id=' + target.getAttribute('data-plid'); | ||
var xhr = new XMLHttpRequest(); | ||
xhr.responseType = 'json'; | ||
xhr.timeout = 10000; | ||
xhr.open('POST', url, true); | ||
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); | ||
|
||
xhr.onreadystatechange = function () { | ||
if (xhr.readyState == 4) { | ||
if (xhr.status != 200) { | ||
tile.style.display = ''; | ||
} | ||
} | ||
} | ||
|
||
xhr.send('csrf_token=' + playlist_data.csrf_token); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
-- Table: public.playlist_videos | ||
|
||
-- DROP TABLE public.playlist_videos; | ||
|
||
CREATE TABLE playlist_videos | ||
( | ||
title text, | ||
id text, | ||
author text, | ||
ucid text, | ||
length_seconds integer, | ||
published timestamptz, | ||
plid text references playlists(id), | ||
index int8, | ||
live_now boolean, | ||
PRIMARY KEY (index,plid) | ||
); | ||
|
||
GRANT ALL ON TABLE public.playlist_videos TO kemal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
-- Table: public.playlists | ||
|
||
-- DROP TABLE public.playlists; | ||
|
||
CREATE TABLE public.playlists | ||
( | ||
title text, | ||
id text primary key, | ||
author text, | ||
description text, | ||
video_count integer, | ||
created timestamptz, | ||
updated timestamptz, | ||
privacy privacy, | ||
index int8[] | ||
); | ||
|
||
GRANT ALL ON public.playlists TO kemal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-- Type: public.privacy | ||
|
||
-- DROP TYPE public.privacy; | ||
|
||
CREATE TYPE public.privacy AS ENUM | ||
( | ||
'Public', | ||
'Unlisted', | ||
'Private' | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.